5143840d90
Single-file bind mounts pin the container to that file's inode at mount time. sed -i and most editors write-then-rename (atomic write), which swaps in a new inode at the same path -- the container kept reading the orphaned original and never saw edits, silently breaking the hot-reload from the previous commit. Caught by actually testing the reload live instead of trusting the code. Directory mounts resolve paths dynamically and don't have this problem. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
41 lines
1.3 KiB
YAML
41 lines
1.3 KiB
YAML
services:
|
|
api:
|
|
build: ./apps/api
|
|
container_name: homelab-monitor-api
|
|
restart: unless-stopped
|
|
env_file: .env
|
|
environment:
|
|
- HOSTS_CONFIG_PATH=/app/config/hosts.yaml
|
|
- DB_PATH=/app/data/monitor.db
|
|
- SSH_PRIVATE_KEY_PATH=/app/ssh/monitor_ed25519
|
|
- DISCOVERY_FILE_PATH=/app/data/devices-raw.json
|
|
volumes:
|
|
# Directory mount, not a single-file mount: bind-mounting one file pins
|
|
# the container to that file's inode at mount time. Editors/`sed -i`
|
|
# that write-then-rename (the common atomic-write pattern) swap in a new
|
|
# inode at the same path, which the container would never see again
|
|
# without a restart — silently breaking the hot-reload in issue #14.
|
|
# Directory mounts resolve paths dynamically and don't have this problem.
|
|
- ./config:/app/config:ro
|
|
- ./ssh/monitor_ed25519:/app/ssh/monitor_ed25519:ro
|
|
# Bind mount (not a named volume) so scripts/discover-devices.sh, which
|
|
# runs on the host via systemd (see deploy/systemd/), can write
|
|
# devices-raw.json into the same place the container reads it from.
|
|
- ./data:/app/data
|
|
networks:
|
|
- web
|
|
|
|
web:
|
|
build: ./apps/web
|
|
container_name: homelab-monitor-web
|
|
restart: unless-stopped
|
|
ports:
|
|
- "8090:80"
|
|
depends_on:
|
|
- api
|
|
networks:
|
|
- web
|
|
|
|
networks:
|
|
web:
|