Docker Edge Client
The Docker Edge Client is an edge client packaged as a Docker image. It is the easiest way to run an edge client, for example to develop and test Edge Apps without dedicated edge hardware. The image is available for amd64 and arm64 and is published as ghcr.io/iotopen/edge-client.
The source code is available on GitHub.
Prerequisites
- A Docker host
- An installation in IoT Open and credentials for it
Run with Docker
The image has a small web interface on port 80 inside the container that is used to configure and check the edge client. How the web interface is protected is controlled by environment variables.
| Variable | Description |
|---|---|
INSECURE=true | No authentication to the web interface. Only use this on well protected networks or for short tests. |
BASE=<url> | Authentication with an API key from the given Lynx server, e.g. https://lynx.iotopen.se. |
HEADLESS=true | Turns the web interface off completely. |
Without authentication:
docker run -d -e INSECURE=true -p 8088:80 ghcr.io/iotopen/edge-client:latest
Then open http://localhost:8088 in your browser.
With authentication:
docker run -d -e BASE=https://lynx.iotopen.se -p 8088:80 ghcr.io/iotopen/edge-client:latest
There is no local login. Instead a valid API key from the server in BASE is supplied in the URL:
http://localhost:8088/index.cgi?access-token=<API key>
Configure using the web interface
- Open the web interface.
- Click
Setupand enter the credentials from the installation. The server name should be given without protocol, e.g.lynx.iotopen.se. - Click
Submit. - Click
Re-registerto register the edge client with the new credentials. - Check that everything looks fine under
System Status.
When the edge client is connected there is a green "Edge Client" box on the overview page of the installation.
Link from the installation
A link to the web interface of the edge client can be added to the overview page of the installation with this metadata on the installation:
| Key | Value |
|---|---|
ext_url_Edge Client | http://localhost:8088/index.cgi?access-token=__TOKEN__ |
__TOKEN__ is automatically replaced with your login token, so the link works as long as you are logged in. Since the link above points to localhost it only works on the computer running the container.
Headless
To run without the web interface, start the container with HEADLESS=true and supply the credentials as /etc/iot-open/iotopen.json, for example by mounting the file:
docker run -d -e HEADLESS=true \
-v $PWD/iotopen.json:/etc/iot-open/iotopen.json:ro \
ghcr.io/iotopen/edge-client:latest
Run with Docker Compose
The repository contains a Docker Compose setup in the docker-compose directory.
- Download the files in the
docker-composedirectory. - Replace
config/iotopen.jsonwith the credentials file from the installation. - Start the edge client:
docker compose up -d
The Compose setup runs headless and restarts the container automatically. The comments in docker-compose.yml show how to enable the web interface.
Access to the local MQTT broker
By default the local MQTT broker only listens inside the container. To use it from the local network, for example with Node-RED or mosquitto_sub, uncomment the mosquitto-local.conf volume in docker-compose.yml.
Please observe that this opens the broker to the network without authentication. Only do this on networks you trust.
Upgrading
The edge client is more or less stateless, so upgrading is done by starting a new container with the same iotopen.json.
With Docker Compose:
docker compose pull
docker compose up -d
With Docker, copy the credentials from the old container to a new one:
docker pull ghcr.io/iotopen/edge-client:latest
docker cp <old container>:/etc/iot-open/iotopen.json iotopen.json
docker run -d --restart unless-stopped --name <new container> ghcr.io/iotopen/edge-client:latest
docker cp iotopen.json <new container>:/etc/iot-open/iotopen.json
docker stop <old container>
docker restart <new container>
docker rm <old container>
To reuse the name of the old container it has to be removed first.
Edge App development
For Edge App development it is convenient to mount the source of the app into the container:
docker run -d --name edge-app-dev -e BASE=https://lynx.iotopen.se -p 8088:80 \
-v <path-to-app-source>:/src ghcr.io/iotopen/edge-client:latest
The app can then be test run inside the container with the edge-app command.
Troubleshooting
Duplicate persistence_location
If the whole /etc/iot-open/ directory is mounted from the host and contains a mosquitto.tpl, mosquitto might fail to start with:
Error: Duplicate persistence_location value in configuration.
Remove the line persistence_location from mosquitto.tpl, or mount only iotopen.json instead of the whole directory.
Edge Client shown as offline
See Status.