Add stop.sh (compose down) and disable print_forge (#34)
Sync runner checkout / sync (push) Successful in 6s
Sync runner checkout / sync (push) Successful in 6s
## Summary - Closes [#33](#33). - Add `scripts/stop.sh` → `playbooks/stop-apps.yml` → `docker compose down` for one `--app` + `--env` (no `-v`; checkouts/secrets stay). - `host_apps.enabled: false` skips deploy (including CI `--app`) so a stopped app cannot come back. Rows stay for ports and `stop.sh`. - Disable `print_forge` beta + prod on all app hosts. After merge (or from this branch): `./scripts/stop.sh --app print_forge --env prod` and `--env beta`. ## Test plan - [ ] `./scripts/stop.sh --help` shows required `--app` / `--env` - [ ] `ansible-playbook playbooks/stop-apps.yml --syntax-check -e app=print_forge -e app_env=prod` - [ ] `./scripts/stop.sh --app print_forge --env prod` compose-downs `print_forge_prod` on all webservers - [ ] `./scripts/stop.sh --app print_forge --env beta` compose-downs `print_forge_beta` (including adama worker) - [ ] `./scripts/deploy.sh --app print_forge --env prod --check` skips disabled rows (does not start containers) - [ ] NPM: `print-forge-preview.aimloperations.com` will 502 until the proxy host is disabled (out of scope) Reviewed-on: #34
This commit was merged in pull request #34.
This commit is contained in:
Executable
+95
@@ -0,0 +1,95 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
cd "$REPO_ROOT"
|
||||
|
||||
LIMIT=""
|
||||
EXTRA_ARGS=()
|
||||
EXTRA_VARS=()
|
||||
APP=""
|
||||
APP_ENV=""
|
||||
|
||||
usage() {
|
||||
cat <<EOF
|
||||
Usage: $(basename "$0") [HOST] --app NAME --env ENV [OPTIONS]
|
||||
|
||||
Stop a docker-compose app (compose down). Inverse of deploy.sh.
|
||||
|
||||
Does not remove volumes, checkouts, or secrets. Next deploy.sh of the same
|
||||
app+env will start it again unless host_apps sets enabled: false.
|
||||
|
||||
Node-static apps have no compose project — stop.sh skips them.
|
||||
|
||||
HOST Optional. Limit to one host: adama, roslin, starbuck, apollo, or ai-server-4080.
|
||||
|
||||
Options:
|
||||
--app NAME Required. App to stop (same names as deploy.sh)
|
||||
--env ENV Required. Environment: beta or prod
|
||||
--check Dry run
|
||||
--diff Show diffs
|
||||
--extra-vars V Pass raw extra vars
|
||||
-h, --help Show this help
|
||||
|
||||
Examples:
|
||||
$(basename "$0") --app print_forge --env prod
|
||||
$(basename "$0") --app print_forge --env beta
|
||||
$(basename "$0") adama --app chat_backend --env beta --check
|
||||
EOF
|
||||
}
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
-h|--help)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
--app)
|
||||
APP="$2"
|
||||
EXTRA_VARS+=(-e "app=$2")
|
||||
shift 2
|
||||
;;
|
||||
--env)
|
||||
APP_ENV="$2"
|
||||
EXTRA_VARS+=(-e "app_env=$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
|
||||
|
||||
if [[ -z "$APP" || -z "$APP_ENV" ]]; then
|
||||
echo "error: --app and --env are required" >&2
|
||||
usage >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
CMD=(ansible-playbook playbooks/stop-apps.yml "${EXTRA_ARGS[@]}" "${EXTRA_VARS[@]}")
|
||||
if [[ -n "$LIMIT" ]]; then
|
||||
CMD+=(--limit "$LIMIT")
|
||||
echo "==> Stopping ${APP}/${APP_ENV} on: $LIMIT"
|
||||
else
|
||||
echo "==> Stopping ${APP}/${APP_ENV} on all webservers"
|
||||
fi
|
||||
|
||||
exec "${CMD[@]}"
|
||||
Reference in New Issue
Block a user