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

@@ -14,7 +14,6 @@ if [ -z "$DOMAIN" ]; then
fi
URL="https://${DOMAIN}"
INTERNAL_URL="https://internal-${DOMAIN}"
COMPOSE_FILE="${APP_DIR}/signoz/deploy/docker/docker-compose.yaml"
set_env() {
@@ -32,13 +31,17 @@ set_env() {
fi
}
set_env "SIGNOZ_GLOBAL_EXTERNAL_URL" "${URL}" ".services.signoz.environment"
set_env "SIGNOZ_GLOBAL_INGESTION_URL" "${URL}" ".services.signoz.environment"
set_env "SIGNOZ_ALERTMANAGER_SIGNOZ_EXTERNAL_URL" "${URL}" ".services.signoz.environment"
source /var/excloud/scripts/caddy-setup.sh
cat > /etc/caddy/Caddyfile << EOF
# Signoz needs a custom Caddyfile with multi-route config
read -r -d '' SIGNOZ_CADDYFILE <<EOF
${URL} {
reverse_proxy 127.0.0.1:${APP_UPSTREAM_PORT}
handle_errors {
root * ${APP_DIR}/${APP_NAME}/.excloud
rewrite * /unavailable.html
file_server
}
}
${URL}:4317 {
@@ -48,20 +51,17 @@ ${URL}:4317 {
${URL}:4318 {
reverse_proxy 127.0.0.1:44318
}
# ${INTERNAL_URL} {
# reverse_proxy 127.0.0.1:${APP_UPSTREAM_PORT}
# }
#
# ${INTERNAL_URL}:4317 {
# reverse_proxy h2c://127.0.0.1:44317
# }
#
# ${INTERNAL_URL}:4318 {
# reverse_proxy 127.0.0.1:44318
# }
EOF
echo "Caddyfile updated"
set_env "SIGNOZ_GLOBAL_EXTERNAL_URL" "${URL}" ".services.signoz.environment"
set_env "SIGNOZ_GLOBAL_INGESTION_URL" "${URL}" ".services.signoz.environment"
set_env "SIGNOZ_ALERTMANAGER_SIGNOZ_EXTERNAL_URL" "${URL}" ".services.signoz.environment"
docker compose -f $COMPOSE_FILE up -d --remove-orphans
systemctl reload caddy
if is_app_ready "$APP_DIR/$APP_NAME"; then
docker compose -f $COMPOSE_FILE up -d --remove-orphans
switch_domain "$DOMAIN" "$APP_UPSTREAM_PORT" "$APP_DIR/$APP_NAME" "$SIGNOZ_CADDYFILE"
else
setup_initializing_page "$DOMAIN" "$APP_NAME" "$APP_DIR/$APP_NAME"
docker compose -f $COMPOSE_FILE up -d --remove-orphans
wait_and_switch_to_proxy "$DOMAIN" "$APP_UPSTREAM_PORT" "$APP_DIR/$APP_NAME" "$SIGNOZ_CADDYFILE" &
fi