Files
shd.build/deploy/bootstrap-production.sh
T
JB 2e868d86ff
Validate and deploy production / validate (push) Successful in 18s
Validate and deploy staging / validate (push) Successful in 18s
Validate and deploy production / deploy (push) Successful in 1m1s
Validate and deploy staging / deploy (push) Successful in 28s
feat: refine ISAC design and prepare production deployment
2026-07-26 12:25:47 -04:00

30 lines
950 B
Bash

#!/bin/sh
set -eu
bundle_path=${1:-}
deployment_directory=${2:-/opt/shd-build-production}
if [ -z "$bundle_path" ] || [ ! -f "$bundle_path" ]; then
echo "Usage: bootstrap-production.sh <bootstrap-bundle.json> [deployment-directory]" >&2
exit 2
fi
compose_file="$deployment_directory/compose.production.yml"
deploy_environment="$deployment_directory/.env.deploy"
compose() {
docker compose --env-file "$deploy_environment" -f "$compose_file" "$@"
}
restart_services() {
compose up -d --no-build app scheduler
}
trap restart_services EXIT
echo "Stopping production before the one-time database bootstrap."
compose stop scheduler app || true
compose run --rm --no-deps \
-e ALLOW_PRODUCTION_BOOTSTRAP=true \
-v "$bundle_path:/import/production-bootstrap.json:ro" \
app node scripts/environment-bootstrap-import.mjs \
/import/production-bootstrap.json --target production --confirm-empty-target-replace
echo "Production bootstrap completed."