#!/usr/bin/env bash # ghost — INSTALL-TIME hook (Phase 2 Q4.4). Runs during the install tier AFTER `abra app new` + # EXTRA_ENV + `abra app secret generate` and BEFORE the single `abra app deploy` # (lifecycle.py::_run_install_steps), with CCCI_RECIPE / CCCI_APP_DOMAIN / CCCI_APP_ENV in env. # # Purpose: provide the cc-ci deploy overlay `compose.ccci-health.yml` (app healthcheck start_period # bump) into the recipe checkout so recipe_meta's COMPOSE_FILE (compose.yml:compose.ccci-health.yml) # resolves. Without the larger start_period, Ghost's ~6-9min fresh-DB migration is killed mid-flight # by the recipe's 1m-start_period healthcheck, leaving a stale migrations_lock → deadlock (see the # overlay file header). The overlay is an UNTRACKED file in the recipe repo, so `git checkout -f` # (the upgrade tier's re-checkout to PR head) preserves it — COMPOSE_FILE keeps resolving across # install AND upgrade deploys. CHAOS_BASE_DEPLOY=True (recipe_meta) lets the pinned base deploy # proceed despite this untracked file (abra's clean-tree check would otherwise FATA). set -euo pipefail : "${CCCI_RECIPE:?missing CCCI_RECIPE}" SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" RECIPE_DIR="${HOME}/.abra/recipes/${CCCI_RECIPE}" if [ ! -d "$RECIPE_DIR" ]; then echo " ghost install_steps: recipe dir $RECIPE_DIR missing — cannot provide health overlay" >&2 exit 1 fi cp "$SCRIPT_DIR/compose.ccci-health.yml" "$RECIPE_DIR/compose.ccci-health.yml" echo " ghost install_steps: provided compose.ccci-health.yml (healthcheck start_period bump) to ${CCCI_RECIPE}"