diff --git a/deployments/simplex/backup.sh b/deployments/simplex/backup.sh index c5e8271..cf43301 100644 --- a/deployments/simplex/backup.sh +++ b/deployments/simplex/backup.sh @@ -98,6 +98,7 @@ TARGETS=( # Current environment and docker-compose setup "$SIMPLEX_DIR/.env" "$SIMPLEX_DIR/docker-compose.yml" + "$SIMPLEX_DIR/caddy_conf/Caddyfile" "$SIMPLEX_DIR/print-addresses.sh" # Tor configs diff --git a/deployments/simplex/deploy-simplex.sh b/deployments/simplex/deploy-simplex.sh index 66e5b47..38c0685 100644 --- a/deployments/simplex/deploy-simplex.sh +++ b/deployments/simplex/deploy-simplex.sh @@ -221,7 +221,7 @@ done # 5. Lay out /opt/simplex # ---------------------------------------------------------------------------- log "Writing compose stack to ${INSTALL_DIR}..." -mkdir -p "$INSTALL_DIR"/tor_conf +mkdir -p "$INSTALL_DIR"/tor_conf "$INSTALL_DIR"/caddy_conf cd "$INSTALL_DIR" cat > .env <`): the closing `}` and the heredoc's `EOF` were +# both at the scalar's base indent, so YAML folded them into `} EOF`, leaving the +# heredoc unterminated and the script a parse error. caddy-init exited 2 on every +# run, `service_completed_successfully` never fired, and nothing downstream of +# caddy ever started. Generating the file here removes the whole class of problem +# -- and, unlike the old `if [ ! -f ]` guard, applies a changed DOMAIN/ACME_EMAIL/ +# KEY_TYPE on a re-run instead of freezing them at the first deploy. +# +# The heredoc is deliberately UNQUOTED so ${DOMAIN}/${ACME_EMAIL}/${KEY_TYPE} +# expand here. Caddy's own {uri} has no `$` so it survives; any future Caddy +# {$ENV} placeholder must be escaped as \${...}. +CADDY_CHANGED=0 +cat > caddy_conf/Caddyfile.new < docker-compose.yml <<'YAML' name: simplex services: - caddy-init: - image: alpine:latest - command: > - sh -c ' - if [ ! -f /etc/caddy/Caddyfile ]; then - cat > /etc/caddy/Caddyfile <