From 259a1457aa6e421e043f91ca8c90f1f999cfc169 Mon Sep 17 00:00:00 2001 From: jtricerolph Date: Wed, 1 Jul 2026 19:06:49 +0000 Subject: [PATCH] Add --only single-service deploy mode Sources existing credentials file and redeploys just the named service without running the full interactive installer. Works for any service: postgres auth portal npm management noticeboard settings. Co-Authored-By: Claude Sonnet 4.6 --- install-stack.sh | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/install-stack.sh b/install-stack.sh index 383e866..e77ef79 100755 --- a/install-stack.sh +++ b/install-stack.sh @@ -946,6 +946,34 @@ SUMMARY # ════════════════════════════════════════════════════════════════════════════ # ENTRY POINT # ════════════════════════════════════════════════════════════════════════════ + +# Single-service mode: install-stack.sh --only +# Sources existing credentials and redeploys just the named service. +if [[ "${1:-}" == "--only" ]]; then + ONLY="${2:-}" + VALID="postgres auth portal npm management noticeboard settings" + [[ -z "$ONLY" ]] && msg_error "Usage: install-stack.sh --only (one of: ${VALID})" + grep -qw "$ONLY" <<< "$VALID" || msg_error "Unknown service '${ONLY}'. Valid: ${VALID}" + CREDS_FILE=/root/hotel-manage-credentials.txt + [[ -f "$CREDS_FILE" ]] || msg_error "No credentials file at ${CREDS_FILE} — run the full installer first" + set -a; source <(grep -v '^#' "$CREDS_FILE" | grep '='); set +a + USE_FORGEJO=true + [[ -f /root/.ssh/hotel-manage_deploy.pub ]] \ + && MGMT_PUBKEY=$(cat /root/.ssh/hotel-manage_deploy.pub) || MGMT_PUBKEY="" + check_vmbr1 + ensure_pool + case "$ONLY" in + postgres) deploy_postgres ;; + auth) deploy_auth ;; + portal) deploy_portal ;; + npm) deploy_npm ;; + management) deploy_management ;; + noticeboard) deploy_noticeboard ;; + settings) deploy_settings ;; + esac + exit 0 +fi + check_vmbr1 collect_config gen_secrets