Files
server-infra/scripts/deploy.sh
T
westfarn 578b749ac5
Sync runner checkout / sync (push) Successful in 7s
Register disney_hotel_service for beta and prod deploy (#48)
## Summary
- Closes #47.
- Register `disney_hotel_service` (`DisneyHotel/disney_hotel_service`, branch `master`) for beta and prod on all five webservers.
- Prod port **8023**, beta port **8024** (8021/8022 stay WordPress `relawfirm`). Alert worker profile only on adama.
- Document Postgres databases `disney_hotel_service` / `disney_hotel_service_beta`, NPM hosts, and the control-node secret layout. This app reads `POSTGRES_*`, not `DATABASE_URL`.

## Test plan
- [ ] `disney_hotel_service` is in `app_catalog` and `./scripts/deploy.sh --help` lists it
- [ ] All five hosts have prod **8023** and beta **8024**; only adama sets `compose_profiles: [worker]`
- [ ] After merge (ops): create both databases on `10.0.0.230` and grant `westfarn`
- [ ] After merge (ops): write `~/Documents/secrets/disney_hotel_service/disney_hotel_service_{prod,beta}.env` (mode 600)
- [ ] After merge (ops): NPM `disneyhotel.app` (+ www) → `:8023`, `beta.disneyhotel.app` → `:8024`
- [ ] Deploy waits on `docker-compose.prod.yml` in the app repo (no bundled db, `${WEB_PORT}:8000`, worker profile `worker`)

Reviewed-on: #48
2026-10-28 11:15:05 -07:00

91 lines
2.0 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "$REPO_ROOT"
LIMIT=""
EXTRA_ARGS=()
EXTRA_VARS=()
usage() {
cat <<EOF
Usage: $(basename "$0") [HOST] [OPTIONS]
Deploy applications with deploy-apps.yml.
HOST Optional. Limit to one host: adama, roslin, starbuck, apollo, or ai-server-4080.
Options:
--app NAME App to deploy (company_site, dta_service, dta_webapp, dta_blog, scha, chat_web_app, chat_backend, monica_site, url_shortening_service, college_craft, print_forge, abc_be, abc_worker, abc_fe, livekit, disney_hotel_service)
--env ENV Environment: beta or prod
--ref REF Git ref/sha to deploy (default: master)
--check Dry run
--diff Show diffs
--extra-vars V Pass raw extra vars
-h, --help Show this help
Examples:
# CI: deploy one app+env at a pinned sha
$(basename "$0") --app company_site --env prod --ref abc123
# Redeploy everything on master (all hosts)
$(basename "$0")
# Dry run for one host
$(basename "$0") adama --check
EOF
}
while [[ $# -gt 0 ]]; do
case "$1" in
-h|--help)
usage
exit 0
;;
--app)
EXTRA_VARS+=(-e "app=$2")
shift 2
;;
--env)
EXTRA_VARS+=(-e "app_env=$2")
shift 2
;;
--ref)
EXTRA_VARS+=(-e "app_ref=$2")
shift 2
;;
--check)
EXTRA_ARGS+=(--check)
shift
;;
--diff)
EXTRA_ARGS+=(--diff)
shift
;;
--extra-vars)
EXTRA_VARS+=(-e "$2")
shift 2
;;
adama|roslin|starbuck|apollo|ai-server-4080)
LIMIT="$1"
shift
;;
*)
echo "Unknown argument: $1" >&2
usage >&2
exit 1
;;
esac
done
CMD=(ansible-playbook playbooks/deploy-apps.yml "${EXTRA_ARGS[@]}" "${EXTRA_VARS[@]}")
if [[ -n "$LIMIT" ]]; then
CMD+=(--limit "$LIMIT")
echo "==> Deploying to: $LIMIT"
else
echo "==> Deploying to all webservers"
fi
exec "${CMD[@]}"