Split deploy into independent poller and web stacks
Decouple the privileged hardware poller from web iterations so a web
redeploy can never recreate/restart the poller (the backplane-touching
container). Two images from one Dockerfile via build targets:
- jbod-poller: privileged producer, ships smartmontools/sg3-utils/ledmon,
Redis-only deps (~197MB)
- jbod-web: unprivileged read-only consumer (REST/UI/MQTT), no hardware
tools, no /dev (~147MB)
Two compose projects sharing Redis over host networking:
- compose.infra.yml (jbod-infra): poller + redis — stable substrate
- compose.web.yml (jbod-web): app — 'up -d --build' touches only app
build.sh builds/pushes both images; split requirements-{poller,web}.txt;
dropped the combined docker-compose.yml; .dockerignore excludes tmp/ (keeps
the venv and the mqtt.env creds out of the build context).
This commit is contained in:
33
compose.web.yml
Normal file
33
compose.web.yml
Normal file
@@ -0,0 +1,33 @@
|
||||
# Web stack: REST API + UI + Home Assistant MQTT. Read-only consumer of the
|
||||
# Redis filled by compose.infra.yml. Iterate freely here — this command only
|
||||
# ever touches the `app` container, never the poller:
|
||||
#
|
||||
# docker compose -f compose.web.yml up -d --build
|
||||
#
|
||||
# Requires the infra stack (Redis) to be running. Reaches Redis at
|
||||
# 127.0.0.1:6379 via host networking (separate compose project, shared host net).
|
||||
name: jbod-web
|
||||
|
||||
services:
|
||||
app:
|
||||
image: docker.adamksmith.xyz/jbod-web:latest # pin to a SHA in deploy
|
||||
container_name: jbod-monitor
|
||||
restart: unless-stopped
|
||||
network_mode: host
|
||||
environment:
|
||||
- TZ=America/Denver
|
||||
- UVICORN_LOG_LEVEL=info
|
||||
- REDIS_HOST=127.0.0.1
|
||||
- REDIS_PORT=6379
|
||||
- REDIS_DB=0
|
||||
# Home Assistant MQTT publishing (EMQX, bridged to Mosquitto HA add-on).
|
||||
- MQTT_HOST=10.5.30.3
|
||||
- MQTT_PORT=1883
|
||||
- MQTT_DISCOVERY_PREFIX=homeassistant
|
||||
- MQTT_BASE_TOPIC=jbod-monitor
|
||||
- MQTT_PUBLISH_INTERVAL=60
|
||||
# Broker credentials (MQTT_USERNAME/MQTT_PASSWORD). Optional: container
|
||||
# starts without it (MQTT just won't authenticate).
|
||||
env_file:
|
||||
- path: /etc/jbod-monitor/mqtt.env
|
||||
required: false
|
||||
Reference in New Issue
Block a user