Playing around with AWS Lambda, Rekognition, Polly, DynamoDB, Lex, S3, etc. to create a system for deploying Docker containers by talking to a Raspberry Pi. The containers are deployed locally on a PC running the “p4docker” service while the other two services (p4security and p4voiceui) are running on the Raspberry Pi.
It’s extremely quick to get started with EdgeX Foundry. Less than 5 minutes – including installing Docker and Docker-compose (provided you have a reasonable internet connection).
Note: This is for the Edinburgh 1.01 release. Other releases can be downloaded from here: link
vagrant@EdgeXblog:~$ sudo apt install apt-transport-https ca-certificates curl software-properties-common
Reading package lists… Done
Building dependency tree
Reading state information… Done
ca-certificates is already the newest version (20180409).
...
vagrant@EdgeXblog:~$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
OK
vagrant@EdgeXblog:~$ sudo apt install docker-ce
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following additional packages will be installed:
...
vagrant@EdgeXblog:~$ sudo docker-compose up -d
Creating network "vagrant_edgex-network" with driver "bridge"
Creating network "vagrant_default" with the default driver
Creating volume "vagrant_db-data" with default driver
Creating volume "vagrant_log-data" with default driver
Creating volume "vagrant_consul-config" with default driver
Creating volume "vagrant_consul-data" with default driver
...
List containers and ports
vagrant@EdgeXblog:~$ sudo docker-compose ps
Name Command State Ports
edgex-config-seed /edgex/cmd/config-seed/con … Exit 0
edgex-core-command /core-command --registry - … Up 0.0.0.0:48082->48082/tcp
edgex-core-consul docker-entrypoint.sh agent … Up 8300/tcp, 8301/tcp, 8301/udp, 8302/tcp, 8302/udp,
0.0.0.0:8400->8400/tcp, 0.0.0.0:8500->8500/tcp,
0.0.0.0:8600->8600/tcp, 8600/udp
edgex-core-data /core-data --registry --pr … Up 0.0.0.0:48080->48080/tcp, 0.0.0.0:5563->5563/tcp
edgex-core-metadata /core-metadata --registry … Up 0.0.0.0:48081->48081/tcp, 48082/tcp
edgex-device-virtual /device-virtual --profile= … Up 0.0.0.0:49990->49990/tcp
edgex-export-client /export-client --registry … Up 0.0.0.0:48071->48071/tcp
edgex-export-distro /export-distro --registry … Up 0.0.0.0:48070->48070/tcp, 0.0.0.0:5566->5566/tcp
edgex-files /bin/sh -c /usr/bin/tail - … Up
edgex-mongo docker-entrypoint.sh /bin/ … Up 0.0.0.0:27017->27017/tcp
edgex-support-logging /support-logging --registr … Up 0.0.0.0:48061->48061/tcp
edgex-support-notifications /support-notifications --r … Up 0.0.0.0:48060->48060/tcp
edgex-support-rulesengine /bin/sh -c java -jar -Djav … Up 0.0.0.0:48075->48075/tcp
edgex-support-scheduler /support-scheduler --regis … Up 0.0.0.0:48085->48085/tcp
edgex-sys-mgmt-agent /sys-mgmt-agent --registry … Up 0.0.0.0:48090->48090/tcp
edgex-ui-go ./edgex-ui-server Up 0.0.0.0:4000->4000/tcp
vagrant_portainer_1 /portainer -H unix:///var/ … Up 0.0.0.0:9000->9000/tcp
Access EdgeX Foundry
Either access directly via the API’s or use the console on port 4000: “http://<ubuntu ip>:4000”.
Username: “admin”
Password: “admin”
Shut down EdgeX Foundry
Not that you would ever want to, but just in case: Stopping EdgeX Foundry containers can be done as per the below. Make sure the command is executed in the same directory as the “docker-compose.yml” file is located in.
Photon OS is a VMware initiative to create a lightweight Linux based OS with container support. I have to admit my initial reaction to Photon OS was: “y tho?”
It’s a reasonable reaction. There are MANY Linux based OS options out there already and essentially all of them have container support. The reason for creating Photon OS would seem to be that VMware wants their own rubber-stamped Linux OS as part of an ecosystem under their control.
Photon OS’s redeeming feature is the fact that it’s really lightweight. Not as lightweight as Ubuntu Core though. Photon OS for Raspberry Pi weighs in at 512Mb while Ubuntu Core is 450Mb. Still, given the influence of VMware in virtualization and their (our) inroads into IoT / M2M with Pulse, it’s likely that Photon OS will take off eventually.
Currently the main barrier to widespread adoption of Photon OS is a lack of commercial support. At the moment it is simply available as an unsupported download from GitHub (here). This could change in the future though and in that case we may see it being utilized more broadly and also outside the lab environments it is currently inhabiting.
Note that unlike Raspbian, which is 32bit, Photon OS is a 64bit operating system. That too may be something that’ll help float the boat for some.
Getting started with Photon OS on the Raspberry Pi
Deflate the zx compressed image and save to a micro-SD card:
tar xf photon-rpi3-3.0-26156e2.tar.xz
cd rpi3/
sudo dd if=photon-rpi3-3.0-26156e2d.raw of=/dev/mmcblk0 bs=4M;sudo sync
In this example the SD card device is /dev/mmcblk0. This may differ on other systems of course. Please check with “lsblk” or so and please do be careful. Linux / Unix folks don’t refer to dd as “Disk Destroyer” for nothing.
Boot the Raspberry Pi and log in. The default credentials are: root / changeme
DHCP and SSH are both enabled by default and should make it possible to access the Pi across the network if using a wired connection (I haven’t tried though). With a Raspberry Pi it’s likely a wireless connection would be more convenient however. Configuring Wi-Fi is easy and is described in the section that follows.
Photon OS Wi-Fi configuration
There are a few steps to go through for Wi-Fi connectivity but it’s not difficult.
Start the wpa_supplicant service
systemctl start wpa_supplicant@wlan0
Enable the wpa_supplicant service (so it starts with the Pi)
systemctl enable wpa_supplicant@wlan0
Check the service status
systemctl status wpa_supplicant@wlan0
Edit the dhcp settings to get DHCP for wlan0 and not eth0
Photon OS comes in a few different sizes and in the larger ones both Docker and Kubernetes are preinstalled. Not so with the Raspberry Pi version though, so we need to install Docker manually.
Packages are installed with either “yum” or “tdnf”. Docker is available from tdnf so we’ll use that to run the install below.
Refresh the cache but don’t update the packages
We need to refresh the tdnf cache to find the docker package. However, this process can also be used to update all packages. I found that this breaks Wi-Fi. So, if you use Wi-Fi I recommend:
root@photon-rpi3 [ ~ ]# tdnf update
Then select "n" to just refresh the cache without updating any packages.
root@photon-rpi3 [ ~ ]# docker pull hello-world
Using default tag: latest
latest: Pulling from library/hello-world
3b4173355427: Pull complete
Digest: sha256:2557e3c07ed1e38f26e389462d03ed943586f744621577a99efb77324b0fe535
Status: Downloaded newer image for hello-world:latest
root@photon-rpi3 [ ~ ]# docker run hello-world
Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(arm64v8)
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/get-started/
root@photon-rpi3 [ ~ ]#
That’s all! Photon OS is installed, Wi-Fi configured, Docker installed and verified. Ready to rock.