Implement shared Caddy setup with initializing and unavailable pages for various apps

- Refactor domain scripts for Ghost, Gitea, Jellyfin, Metabase, n8n, NocoDB, Open WebUI, OpenClaw, PicoClaw, Plausible, Signoz, Uptime Kuma, and Vaultwarden to utilize a common Caddy setup script.
- Introduce `caddy-setup.sh` for managing Caddy configurations and handling app initialization states.
- Create `initializing.html` and `unavailable.html` pages to provide user feedback during app deployment and downtime.
- Update domain handling logic to ensure seamless transitions between initializing and operational states.
- Enhance user experience by providing visual indicators for app status during setup and maintenance.
This commit is contained in:
lolwierd
2026-03-28 14:37:33 +05:30
parent 250730435a
commit ed19997ba0
19 changed files with 810 additions and 181 deletions

View File

@@ -23,6 +23,7 @@ fi
SECRET_KEY_BASE="$(tr -d '\n' < "${SECRET_KEY_FILE}")"
# Always rewrite .env with current domain
cat > "${ENV_FILE}" <<EOF
BASE_URL=https://${DOMAIN}
SECRET_KEY_BASE=${SECRET_KEY_BASE}
@@ -36,14 +37,14 @@ services:
- "127.0.0.1:${APP_UPSTREAM_PORT}:80"
EOF
cat > /etc/caddy/Caddyfile <<EOF
https://${DOMAIN} {
reverse_proxy 127.0.0.1:${APP_UPSTREAM_PORT}
}
EOF
source /var/excloud/scripts/caddy-setup.sh
echo "Caddyfile updated"
systemctl enable caddy
docker compose -f "${PLAUSIBLE_DIR}/compose.yml" -f "${OVERRIDE_FILE}" up -d
systemctl reload caddy
if is_app_ready "$PLAUSIBLE_DIR"; then
# Restart to pick up new domain from .env
docker compose -f "${PLAUSIBLE_DIR}/compose.yml" -f "${OVERRIDE_FILE}" up -d
switch_domain "$DOMAIN" "$APP_UPSTREAM_PORT" "$PLAUSIBLE_DIR"
else
setup_initializing_page "$DOMAIN" "$APP_NAME" "$PLAUSIBLE_DIR"
docker compose -f "${PLAUSIBLE_DIR}/compose.yml" -f "${OVERRIDE_FILE}" up -d
wait_and_switch_to_proxy "$DOMAIN" "$APP_UPSTREAM_PORT" "$PLAUSIBLE_DIR" &
fi