fix: power outage auto-recovery improvements

Mosquitto:
- Change restart: always (was unless-stopped) to survive daemon restarts
- Add healthcheck (pub/sub ping) for depends_on conditions
- All downstream services use condition: service_healthy

Party-lock:
- Add MQTT connection retry loop (was crashing on DNS race after restart)

Zigbee2mqtt:
- Add entrypoint wrapper that auto-applies BLZ bridge patch at startup
- Bridge patch no longer needs manual 'just z2m-patch-bridge' after image pulls

Mopidy:
- Add python3-gi + python3-gi-cairo via apt (fixes 'No module named gi')
- Set PYTHONPATH to expose system gi module to Python 3.12
This commit is contained in:
2026-07-09 18:56:36 -07:00
parent 5383edd4ae
commit ba3e172dda
4 changed files with 36 additions and 6 deletions
+14 -4
View File
@@ -2,7 +2,7 @@ services:
mosquitto:
image: eclipse-mosquitto:latest
container_name: mosquitto
restart: unless-stopped
restart: always
user: "1883:1883"
ports:
- "1883:1883"
@@ -10,6 +10,12 @@ services:
- ./mosquitto/config:/mosquitto/config
- ./mosquitto/data:/mosquitto/data
- ./mosquitto/log:/mosquitto/log
healthcheck:
test: ["CMD", "sh", "-c", "timeout 3 mosquitto_sub -p 1883 -t healthcheck -C 1 --quiet & sleep 0.5 && mosquitto_pub -p 1883 -t healthcheck -m ok -r; wait"]
interval: 10s
timeout: 5s
retries: 3
start_period: 15s
zigbee2mqtt:
image: ghcr.io/pine64/zigbee2mqtt:latest-dev # BLZ fork, NOT koenkk
@@ -23,6 +29,7 @@ services:
- ./zigbee2mqtt:/app/data
devices:
- /dev/ttyUSB0:/dev/ttyUSB0
entrypoint: ["/app/data/scripts/entrypoint.sh"]
environment:
TZ: America/Los_Angeles
@@ -43,7 +50,8 @@ services:
container_name: nodered
restart: unless-stopped
depends_on:
- mosquitto
mosquitto:
condition: service_healthy
user: "1000:1000"
ports:
- "1880:1880"
@@ -65,7 +73,8 @@ services:
container_name: doorbell-listener
restart: unless-stopped
depends_on:
- mosquitto
mosquitto:
condition: service_healthy
volumes:
- ./doorbell-listener/state:/data/doorbell-listener
environment:
@@ -146,7 +155,8 @@ services:
container_name: party-lock
restart: unless-stopped
depends_on:
- mosquitto
mosquitto:
condition: service_healthy
volumes:
- ./mosquitto/config:/mosquitto/config
- /var/run/docker.sock:/var/run/docker.sock