fix: restore app reachability after platform restart
Two root causes: 1. Caddy was started without --resume, so every restart wiped all dynamically-registered app routes (only the base Caddyfile survived). Adding --resume makes Caddy reload its auto-saved config (stored in the caddy-config volume) which includes all app routes. 2. App routes used the container IP address, which changes whenever hiy-net is torn down and recreated by compose. Switch to the container name as the upstream dial address; Podman's aardvark-dns resolves it by name within hiy-net, so it stays valid across network recreations. Together with the existing reconnect loop in start.sh these two changes mean deployed apps survive a platform restart without needing a redeploy. https://claude.ai/code/session_01FKCW3FDjNFj6jve4niMFXH
This commit is contained in:
parent
a8e73df2c3
commit
8267b30b15
2 changed files with 2 additions and 4 deletions
|
|
@ -113,9 +113,7 @@ CADDY_API="${CADDY_API_URL:-http://localhost:2019}"
|
||||||
DOMAIN_SUFFIX="${DOMAIN_SUFFIX:-localhost}"
|
DOMAIN_SUFFIX="${DOMAIN_SUFFIX:-localhost}"
|
||||||
|
|
||||||
if curl --silent --fail "${CADDY_API}/config/" >/dev/null 2>&1; then
|
if curl --silent --fail "${CADDY_API}/config/" >/dev/null 2>&1; then
|
||||||
CONTAINER_IP=$(podman inspect "$CONTAINER_NAME" \
|
UPSTREAM="${CONTAINER_NAME}:${PORT}"
|
||||||
--format '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}')
|
|
||||||
UPSTREAM="${CONTAINER_IP}:${PORT}"
|
|
||||||
log "Updating Caddy: ${APP_ID}.${DOMAIN_SUFFIX} → ${UPSTREAM}"
|
log "Updating Caddy: ${APP_ID}.${DOMAIN_SUFFIX} → ${UPSTREAM}"
|
||||||
|
|
||||||
# Discover actual server name (Caddyfile adapter names it 'srv0', not 'hiy').
|
# Discover actual server name (Caddyfile adapter names it 'srv0', not 'hiy').
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ services:
|
||||||
- ../proxy/Caddyfile:/etc/caddy/Caddyfile:ro
|
- ../proxy/Caddyfile:/etc/caddy/Caddyfile:ro
|
||||||
- caddy-data:/data
|
- caddy-data:/data
|
||||||
- caddy-config:/config
|
- caddy-config:/config
|
||||||
command: caddy run --config /etc/caddy/Caddyfile --adapter caddyfile
|
command: caddy run --config /etc/caddy/Caddyfile --adapter caddyfile --resume
|
||||||
networks:
|
networks:
|
||||||
- hiy-net
|
- hiy-net
|
||||||
- default
|
- default
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue