fix(services): conditional caddy_net across all Docker service scripts

Only include the caddy_net network block in generated docker-compose.yml
files when ~/docker/caddy exists. Prevents "network caddy_net declared
as external, but could not be found" on standalone installs without Caddy.

Affected: actualbudget, archivebox, arm, audiobookshelf, calibre-web,
changedetection, drum-rhythm-game, emby, fmd, frigate, frigate-audio,
frigate-notify, gatus, homeassistant, immich, iopaint, jellyfin, joplin,
koha, lyrion, magicmirror, mail-archiver, mattermost, mealie, meshcentral,
n8n, nextcloud, ntfy, onlyoffice, portainer, stirling-pdf, syncthing,
traccar, unifi, uptimekuma, vaultwarden, wg-easy

Skipped: authelia (creates caddy_net itself), caddy, crowdsec, wolf,
wolf-pair, and services using network_mode: host with no caddy_net.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D8ckUJQtj1pH8jtAddBDZs
This commit is contained in:
Claude
2026-06-20 04:16:41 +00:00
parent 68a4effad5
commit fa906186c3
37 changed files with 715 additions and 347 deletions
+19 -7
View File
@@ -375,6 +375,23 @@ ENVEOF
[ -n "$DRI_LINE" ] && DEVICES_BLOCK="${DEVICES_BLOCK}\n ${DRI_LINE}"
fi
local _CADDY_NET_BLOCK=""
if [ -d "$DOCKER_DIR/caddy" ]; then
_CADDY_NET_BLOCK=" networks:
- caddy_net
"
fi
local _CADDY_NET_SECTION=""
if [ -d "$DOCKER_DIR/caddy" ]; then
_CADDY_NET_SECTION="
networks:
caddy_net:
external: true
name: ${SITE_CADDY_NET:-caddy_net}
"
fi
cat > "$DIR/docker-compose.yml" << 'COMPOSEEOF'
# Frigate NVR + Mosquitto MQTT + frigate-notify
# Generated by ubuntu-post-install setup.sh
@@ -416,9 +433,7 @@ COMPOSEEOF
- "8554:8554"
- "8555:8555/tcp"
- "8555:8555/udp"
networks:
- caddy_net
healthcheck:
${_CADDY_NET_BLOCK} healthcheck:
test: ["CMD", "curl", "-f", "http://127.0.0.1:5000/api/version"]
interval: 10s
timeout: 5s
@@ -451,10 +466,7 @@ COMPOSEEOF
volumes:
- ./frigate-notify/config.yml:/app/config.yml:ro
networks:
caddy_net:
external: true
name: \${CADDY_NET:-caddy_net}
${_CADDY_NET_SECTION}
COMPOSEEOF
log_success "docker-compose.yml written"