Add --only <service> 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 <noreply@anthropic.com>
This commit is contained in:
jtricerolph 2026-07-01 19:06:49 +00:00
parent fde4fa3115
commit 259a1457aa

View file

@ -946,6 +946,34 @@ SUMMARY
# ════════════════════════════════════════════════════════════════════════════ # ════════════════════════════════════════════════════════════════════════════
# ENTRY POINT # ENTRY POINT
# ════════════════════════════════════════════════════════════════════════════ # ════════════════════════════════════════════════════════════════════════════
# Single-service mode: install-stack.sh --only <service>
# 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 <service> (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 check_vmbr1
collect_config collect_config
gen_secrets gen_secrets