Device Stack Setup¶
The device stack simulates a Linux IoT device using Docker Compose. It models the full edge lifecycle: PKI bootstrapping, WireGuard VPN, MQTT telemetry, OTA polling, and a web terminal.
Prerequisites¶
- Either a Provider-Stack or a Tenant-Stack must be running and healthy.
- The
root_ca.crtexported from the Tenant step-ca must be available (see the Tenant-Stack setup guide). - Docker and Docker Compose installed on the device (or simulation host).
1. Configure the Device Environment¶
Key variables to set:
| Variable | Description |
|---|---|
DEVICE_ID |
Unique identifier for this device (e.g. device-001) |
BRIDGE_API_URL |
URL of the iot-bridge-api (e.g. http://192.168.1.10:8000) |
STEP_CA_URL |
URL of step-ca (e.g. https://192.168.1.10:9000) |
STEP_CA_FINGERPRINT |
SHA-256 fingerprint of the Root CA — get it with step certificate fingerprint root_ca.crt |
TB_MQTT_HOST |
ThingsBoard MQTT host |
HAWKBIT_URL |
hawkBit server URL |
TSDB_URL |
TimescaleDB (PostgreSQL) URL for Telegraf |
TSDB_TOKEN |
TimescaleDB write credential for Telegraf |
2. Start the Device Stack¶
Boot sequence:
- bootstrap (one-shot) — generates an EC P-256 private key, creates a CSR, calls
iot-bridge-api /devices/{id}/enroll, saves the signed certificate, CA chain, and WireGuard config to the shareddevice-certsvolume. - All other services start only after
bootstrapcompletes successfully. - wireguard-client — applies the WireGuard config and establishes a tunnel to the cloud.
- mqtt-client — publishes simulated telemetry to ThingsBoard using mTLS.
- telegraf — streams CPU/memory/disk metrics to TimescaleDB.
- rauc-hawkbit-updater — polls hawkBit DDI API and simulates RAUC A/B updates.
- ttyd — exposes a web terminal on the WireGuard VPN IP, accessible via the terminal-proxy.
3. Verify Enrollment¶
After the bootstrap container exits (code 0), check that the certificate was issued:
Check the certificate details:
4. Running on Real Hardware (Yocto / Linux)¶
On a real device, replace the Docker simulation with native services:
- Install
step-cliand runenroll.shat first boot (e.g. via a systemd one-shot service). - Install
wireguard-toolsand apply the generatedwg0.conf. - Install
telegrafand deploydevice-stack/telegraf/telegraf.conf. - Install
raucandrauc-hawkbit-updater; deploydevice-stack/updater/rauc-hawkbit-updater.conf. - Install
ttydusingdevice-stack/terminal/setup.sh.
Refer to device-stack/rauc/system.conf for the reference RAUC A/B slot configuration for a Yocto image.
Troubleshooting¶
| Symptom | Likely Cause | Fix |
|---|---|---|
bootstrap exits with code 1 |
BRIDGE_API_URL unreachable |
Verify the cloud stack is up; check URL in .env |
bootstrap exits with code 1 |
step-ca fingerprint mismatch | Re-run step certificate fingerprint root_ca.crt and update STEP_CA_FINGERPRINT |
mqtt-client disconnects immediately |
ThingsBoard not accepting mTLS | Verify the X.509 device profile and that the CA is trusted by ThingsBoard |
wireguard-client stays in waiting |
bootstrap did not write wg0.conf |
Check bootstrap logs |