Files
server-infra/scripts/deploy.sh
T
westfarn 2abcdd7c58
Sync runner checkout / sync (push) Successful in 6s
Register print_forge for django deploy (closes #27) (#28)
## Summary
- Closes [#27](#27).
- Register `print_forge` in `app_catalog` (`type: django`, repo `ai_ml_operations/print_forge`, default branch `master`).
- Add `host_apps` prod `:8007` / beta `:8019` on **adama**, **roslin**, **starbuck**, **apollo**, and **ai-server-4080**.
- dj-queue **worker singleton on adama** only (`compose_profiles: [worker]`); other hosts web-only.
- Document ports, NPM hosts, Postgres DBs, secrets, Nominatim (`10.0.0.128:8089`), and the app-repo companion ([print_forge#1](ai_ml_operations/print_forge#1)).
- Update `scripts/deploy.sh` `--app` help.
- Move unused `abc_be` prod port reserve **8007 → 8009** so it does not collide with `print_forge`.

## Test plan
- [ ] Confirm `print_forge` appears in `app_catalog` and `--app print_forge` is listed in `deploy.sh --help`
- [ ] Confirm beta `host_apps` on all five hosts (port **8019**); adama has `compose_profiles: [worker]`
- [ ] Confirm prod port **8007** reserved on those hosts (no NPM until launch)
- [ ] After merge (ops, not this PR): create Postgres DBs `print_forge_beta` + `print_forge` on `10.0.0.230`, grant `westfarn`
- [ ] After merge (ops): write `~/Documents/secrets/print_forge/print_forge_{beta,prod}.env` from app `.env.prod.example`; add `print_forge:<token>` to `SHORTENER_API_TOKENS` (beta first)
- [ ] After merge (ops): NPM `print-forge-preview.aimloperations.com` → `:8019` active/active; do **not** NPM-route `printforgeprints.com` until launch
- [ ] After secrets + DBs: `~/Documents/repos/server-infra/scripts/deploy.sh --app print_forge --env beta --ref master` and hit `/healthz/`

Reviewed-on: #28
2026-09-06 06:35:48 -07:00

91 lines
1.9 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, scha, chat_web_app, chat_backend, monica_site, url_shortening_service, college_craft, print_forge, abc_be, abc_worker, abc_fe)
--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[@]}"