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:
@@ -44,20 +44,21 @@ OPENCLAW_GATEWAY_BIND=lan
|
||||
OPENCLAW_GATEWAY_TOKEN=${OPENCLAW_GATEWAY_TOKEN}
|
||||
EOF
|
||||
|
||||
source /var/excloud/scripts/caddy-setup.sh
|
||||
|
||||
cd "${OPENCLAW_DIR}"
|
||||
rm -f "${LEGACY_OVERRIDE_FILE}"
|
||||
docker compose run --rm --no-deps --entrypoint node openclaw-gateway dist/index.js config set gateway.mode local
|
||||
docker compose run --rm --no-deps --entrypoint node openclaw-gateway dist/index.js config set gateway.bind lan
|
||||
docker compose run --rm --no-deps --entrypoint node openclaw-gateway dist/index.js config set gateway.controlUi.allowedOrigins "[\"https://${DOMAIN}\",\"http://localhost:${APP_UPSTREAM_PORT}\",\"http://127.0.0.1:${APP_UPSTREAM_PORT}\"]" --strict-json
|
||||
docker compose -f docker-compose.yml up -d openclaw-gateway
|
||||
|
||||
cat > /etc/caddy/Caddyfile <<EOF
|
||||
https://${DOMAIN} {
|
||||
reverse_proxy 127.0.0.1:${APP_UPSTREAM_PORT}
|
||||
}
|
||||
EOF
|
||||
|
||||
echo "Caddyfile updated"
|
||||
|
||||
systemctl enable caddy
|
||||
systemctl reload caddy
|
||||
if is_app_ready "$OPENCLAW_DIR"; then
|
||||
# Update allowed origins for the new domain
|
||||
docker compose run --rm --no-deps --entrypoint node openclaw-gateway dist/index.js config set gateway.controlUi.allowedOrigins "[\"https://${DOMAIN}\",\"http://localhost:${APP_UPSTREAM_PORT}\",\"http://127.0.0.1:${APP_UPSTREAM_PORT}\"]" --strict-json
|
||||
docker compose -f docker-compose.yml up -d openclaw-gateway
|
||||
switch_domain "$DOMAIN" "$APP_UPSTREAM_PORT" "$OPENCLAW_DIR"
|
||||
else
|
||||
setup_initializing_page "$DOMAIN" "$APP_NAME" "$OPENCLAW_DIR"
|
||||
docker compose run --rm --no-deps --entrypoint node openclaw-gateway dist/index.js config set gateway.mode local
|
||||
docker compose run --rm --no-deps --entrypoint node openclaw-gateway dist/index.js config set gateway.bind lan
|
||||
docker compose run --rm --no-deps --entrypoint node openclaw-gateway dist/index.js config set gateway.controlUi.allowedOrigins "[\"https://${DOMAIN}\",\"http://localhost:${APP_UPSTREAM_PORT}\",\"http://127.0.0.1:${APP_UPSTREAM_PORT}\"]" --strict-json
|
||||
docker compose -f docker-compose.yml up -d openclaw-gateway
|
||||
wait_and_switch_to_proxy "$DOMAIN" "$APP_UPSTREAM_PORT" "$OPENCLAW_DIR" &
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user