Development Edge setup guide
The following steps describe how to set up a RaspberryPI 4 to serve as development Edge, e.g. for the use in Hackathons.
The setup includes the installation of Docker and the deployment of the OI4 OEC demo services. The demo services consist of the OI4 OEC Registry, a demo OT connector and a demo logger service. The demo connector simulates ambient sensors by querying the API of OpenWeather. The demo logger service simulates a consumer of OI4 OEC data from the bus.
Hardware (BOM):
- Raspberry Pi 4 Model B 8GB
- SD Card - 128 GB microSDHC 3
- USB-C power supply with > 2A
- (Optional) SD-Card reader
- (Optional) RaspberryPi case
- (Optional) HDMI Micro adapter to HDMI
- (Optional) USB or (non-Bluetooth) wireless Keyboard
Setup
- Install Raspberry Pi Imager and start it
- Choose Raspberry Pi OS Lite (64-bit) - tested with version from 2024-03-15
- Enable ssh in the extended settings and Wifi config if needed
- (Optional) set host name
- Flash image to SD following the instructions of the imager
- Insert the SD-Card into your RaspberryPi and power it
- Lookup the IP address in your router or WLan AP or use the set hostname
- (Only for headless installation) Login via
ssh ssh pi@<raspberry-ip-address / or hostname>
(initial password is raspberry if not changed in ) - (Optional if not done in the imager) run sudo raspi-config and change user password
- Update and upgrade the linux system with
sudo apt-get update && sudo apt-get upgrade
- Reboot the RaspberryPi with
sudo reboot
Install Docker
The following steps are taken out of the Official Docker documentation
- (Optional) Uninstall old versions with:
for pkg in docker.io docker-doc docker-compose podman-docker containerd runc; do sudo apt-get remove $pkg; done
apt-get
might report that you have none of these packages installed.
- Set up the Docker
apt
repository:
# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
# Add the repository to Apt sources:
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update - Install the Docker packages:
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
- Verify that the installation is successful by running the
hello-world
image:sudo docker run hello-world
- Add pi user to docker user group with
sudo usermod -aG docker pi
- Reboot the RaspberryPi with
sudo reboot
(Optional) Portainer.io
Portainer is a lightweight management UI which allows you to easily manage your Docker host. It is not necessary but can be helpful for managing the containers.
- Pull portainer.io docker image and install container
docker pull portainer/portainer-ce:lts
docker run -d -p 8000:8000 -p 9000:9000 --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:lts
- Access portainer via browser at
http://<RASPBERRY_PI_IP_ADDRESS_OR_DNS_NAME>:9000
- Create initial user
- Select Get Started - Docker - Manage the local Docker environment and click on connect
Install Open Edge Computing demo services
The demo services consist of the OI4 OEC Registry, a demo OT connector and a demo logger service. The demo connector simulates ambient sensors by querying the API of OpenWeather. The demo logger service simulates a consumer of OI4 OEC data from the bus.
The demo services can be used with the help of a docker-compose file. The docker compose and all relevant configuration files can be found here
- Create a folder where you want to store the configuration and navigate to it
sudo mkdir /etc/oi4
cd /etc/oi4
- Download and extract the configuration
sudo apt install wget
sudo wget https://oi4.github.io/oi4-oec-documentation/download/oi4-oec-demo.zip
sudo unzip -d . oi4-oec-demo.zip
- The OT Demo Connector uses the OpenWeather API to retrieve the weather data. The OpenWeather API requires an account to retrieve the weather data. OpenWeather provides a free account - SIGN UP. Once you created an account switch to your API keys and note it down. The api key is needed in the next step.
- The downloaded zip contains a script to customize the configuration. Run it with:
sudo ./customize.sh
- Switch to the
oi4-oec-demo
folder and start the services with:
cd oi4-oec-demo
sudo docker compose up -d