From 52982ca9e7816ca8cc2543cbd673141661141da5 Mon Sep 17 00:00:00 2001 From: lolwierd Date: Mon, 30 Mar 2026 16:55:35 +0530 Subject: [PATCH] feat: make initializing pages first for all apps --- _common/caddy-setup.sh | 15 +++++++++++---- erpnext/install.sh | 7 ++++++- ghost/install.sh | 7 ++++++- gitea/install.sh | 3 ++- jellyfin/install.sh | 4 +++- metabase/install.sh | 3 ++- n8n/install.sh | 3 ++- nocodb/install.sh | 3 ++- open-webui/install.sh | 5 ++++- openclaw/install.sh | 7 ++++++- picoclaw/install.sh | 7 ++++++- plausible/install.sh | 7 ++++++- signoz/install.sh | 7 ++++++- uptime-kuma/install.sh | 3 ++- vaultwarden/install.sh | 3 ++- 15 files changed, 66 insertions(+), 18 deletions(-) diff --git a/_common/caddy-setup.sh b/_common/caddy-setup.sh index 97eaf84..b95b11f 100644 --- a/_common/caddy-setup.sh +++ b/_common/caddy-setup.sh @@ -16,6 +16,14 @@ SCRIPT_DIR_CADDY="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +reload_or_start_caddy() { + if systemctl is-active --quiet caddy; then + systemctl reload caddy + else + systemctl enable --now caddy + fi +} + write_loading_pages() { local app_name="$1" local app_dir="$2" @@ -48,8 +56,7 @@ https://${domain} { } EOF - systemctl enable caddy - systemctl reload caddy + reload_or_start_caddy echo "Caddy serving initializing page for ${app_name}" } @@ -89,7 +96,7 @@ EOF fi touch "${app_dir}/.excloud/.ready" - systemctl reload caddy + reload_or_start_caddy echo "App is ready — Caddy switched to reverse proxy" } @@ -119,7 +126,7 @@ https://${domain} { EOF fi - systemctl reload caddy + reload_or_start_caddy echo "Domain switched to ${domain}" } diff --git a/erpnext/install.sh b/erpnext/install.sh index becd03e..accf203 100644 --- a/erpnext/install.sh +++ b/erpnext/install.sh @@ -17,11 +17,16 @@ if [ -z "${DOMAIN}" ]; then fi ERPNEXT_DIR="${APP_DIR}/${APP_NAME}" +BOOTSTRAP_DIR="${APP_DIR}/.${APP_NAME}-bootstrap" STATE_DIR="${ERPNEXT_DIR}/.excloud" COMPOSE_FILE="${ERPNEXT_DIR}/pwd.yml" ADMIN_PASSWORD_FILE="${STATE_DIR}/admin-password" -apt-get install -y caddy git openssl +mkdir -p "${BOOTSTRAP_DIR}" +source /var/excloud/scripts/caddy-setup.sh +setup_initializing_page "$DOMAIN" "$APP_NAME" "$BOOTSTRAP_DIR" + +apt-get install -y git openssl if git -C "${ERPNEXT_DIR}" rev-parse 2>/dev/null; then echo "Git repo exists" diff --git a/ghost/install.sh b/ghost/install.sh index 9c86e28..ecc5e49 100644 --- a/ghost/install.sh +++ b/ghost/install.sh @@ -18,8 +18,13 @@ if [ -z "${DOMAIN}" ]; then fi GHOST_DIR="${APP_DIR}/${APP_NAME}" +BOOTSTRAP_DIR="${APP_DIR}/.${APP_NAME}-bootstrap" -apt-get install -y caddy git openssl +mkdir -p "${BOOTSTRAP_DIR}" +source /var/excloud/scripts/caddy-setup.sh +setup_initializing_page "$DOMAIN" "$APP_NAME" "$BOOTSTRAP_DIR" + +apt-get install -y git openssl if [ ! -d "${GHOST_DIR}/.git" ]; then git clone "${REPO_URL}" "${GHOST_DIR}" diff --git a/gitea/install.sh b/gitea/install.sh index ca10dcc..a87479f 100644 --- a/gitea/install.sh +++ b/gitea/install.sh @@ -19,8 +19,9 @@ fi GITEA_DIR="${APP_DIR}/${APP_NAME}" COMPOSE_FILE="${GITEA_DIR}/docker-compose.yml" -apt-get install -y caddy mkdir -p "${GITEA_DIR}" +source /var/excloud/scripts/caddy-setup.sh +setup_initializing_page "$DOMAIN" "$APP_NAME" "$GITEA_DIR" cat > "${COMPOSE_FILE}" < "${COMPOSE_FILE}" < "${COMPOSE_FILE}" < "${COMPOSE_FILE}" < "${COMPOSE_FILE}" </dev/null; then echo "Git repo exists" diff --git a/uptime-kuma/install.sh b/uptime-kuma/install.sh index 46f4c8e..8be5a21 100644 --- a/uptime-kuma/install.sh +++ b/uptime-kuma/install.sh @@ -19,8 +19,9 @@ fi UPTIME_KUMA_DIR="${APP_DIR}/${APP_NAME}" COMPOSE_FILE="${UPTIME_KUMA_DIR}/docker-compose.yml" -apt-get install -y caddy mkdir -p "${UPTIME_KUMA_DIR}" +source /var/excloud/scripts/caddy-setup.sh +setup_initializing_page "$DOMAIN" "$APP_NAME" "$UPTIME_KUMA_DIR" cat > "${COMPOSE_FILE}" < "${COMPOSE_FILE}" <