fix(ring): seed bridge config so it actually starts (auto, reproducible)

ring-mqtt v5 needs /data/config.json or it exits immediately — so "always on"
crashed. gen-passwd.sh now generates docker/ring-mqtt/config.json (the broker
mqtt_url for the least-privileged `ring` user), bind-mounted read-only into the
bridge; the token/state stays in the ring-data volume. config.json is gitignored
(has the password); a .example is committed.

Verified live: bridge starts on `docker compose up -d`, web UI answers 200 on
:55123, MQTT URL set — it only waits for the Ring login. Fully automatic, no
manual command.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
feat/phase-1-bootstrap
HomeOS Bootstrap 2026-07-18 11:00:32 +02:00
parent ab8713bcb3
commit 42ae76227b
4 changed files with 13 additions and 4 deletions

1
.gitignore vendored
View File

@ -40,3 +40,4 @@ Thumbs.db
# Codex R15 review outputs (local scratch)
.reviews/
docker/ring-mqtt/config.json

View File

@ -96,12 +96,11 @@ services:
depends_on:
- mosquitto
environment:
MQTTHOST: mosquitto
MQTTPORT: "1883"
MQTTUSER: ring
MQTTPASSWORD: ${MQTT_RING_PASSWORD}
RUNMODE: docker
volumes:
- ring-data:/data
# Generated by gen-passwd.sh (holds the broker mqtt_url); the token/state lives in ring-data.
- ./docker/ring-mqtt/config.json:/data/config.json:ro
ports:
# ring-mqtt setup/token web UI. Port may differ by ring-mqtt version — adjust if needed.
- "${RING_UI_PORT:-55123}:55123"

View File

@ -47,3 +47,9 @@ docker run --rm -e LPASS -e DPASS -e RPASS -e SPASS \
chown '"$(id -u)"':'"$(id -g)"' /cfg/passwd && chmod 0644 /cfg/passwd
'
echo 'Mosquitto passwd generated (users: laravel, sidecar, ring, shelly).'
# ring-mqtt bridge config — points the bridge at our broker as the least-privileged `ring` user.
# Kept out of git (contains the password); the token/state stays in the ring-data volume.
mkdir -p docker/ring-mqtt
printf '{\n "mqtt_url": "mqtt://ring:%s@mosquitto:1883"\n}\n' "$RPASS" > docker/ring-mqtt/config.json
echo 'ring-mqtt config generated (docker/ring-mqtt/config.json).'

View File

@ -0,0 +1,3 @@
{
"mqtt_url": "mqtt://ring:REPLACED_BY_GEN_PASSWD@mosquitto:1883"
}