Sample implementation of a OPC-UA Server & Client running in Docker on two Raspberry Pi 4B
- Create a Raspberry Pi with the latest Version of Raspberry Pi OS Lite (32 bit)
- Set Hostname to opcua-server
- Enable SSH
- Set user:password (admin:foo123)
- Set WiFi
- Create a Raspberry Pi with the latest Version of Raspberry Pi OS Lite (32 bit)
- Set Hostname to opcua-client
- Enable SSH
- Set user:password (admin:foo123)
- Set WiFi
-
Update & Upgrade
sudo apt-get update sudo apt-get dist-upgrade
-
Install Git
sudo apt install git
-
Install Docker
sudo curl -fsSL https://get.docker.com | sh
-
Add a Non-Root User to the Docker Group
- Add users to the Docker group
sudo usermod -aG docker admin
- Check if running
groups ${USER}
- Add users to the Docker group
-
Install Docker-Compose
sudo apt-get install -y python3-pip sudo pip3 install docker-compose docker-compose version
-
Clone repository
git clone https://github.com/FHatCSW/OPCUA-Sample.git
-
Install libxml2 and libxslt development package
sudo apt-get install libxml2 sudo apt-get install libxslt
-
Reboot Raspberry
sudo reboot
Got to directory
cd /home/admin/OPCUA-Sample/opcua-client
Start docker container
docker-compose up -d
Open your browser
http://opcua-client.local:8000
Define the server address and connect
opc.tcp://<IP OF THE RASPBERRY SERVER>:4840/freeopcua/server/
Got to directory
cd /home/admin/OPCUA-Sample/opcua-server
Start docker container
sudo docker-compose up -d
Stash all local changes on the Raspberry
git stash push --include-untracked
List all docker containers:
docker container ls -s
find all running docker processes
ps aux | grep docker
... or a certainer container
docker ps -a | grep <certain_container>
Shutdown a certain docker compose process:
docker-compose -f docker-compose<...>.yml down
remove a conatiner
docker rm -f influxdb
https://github.com/FreeOpcUa/python-opcua/blob/master/examples/server-minimal.py