new-site/scripts/deploy-dev.sh
justin 90d8b94f3f feat(email): wire listmonk-hc into deploy + dev override + hc ramp-cap
- deploy.sh/deploy-dev.sh: bring up listmonk-hc (upstream image, excluded from
  build); document the one-time listmonk_hc DB create + --install.
- docker-compose.dev.override.yml: dev-only override (committed) that drops the
  prod host-port bindings and pins dev's own postgres volume (dev-pgdata) via
  compose !override tags. deploy-dev ships it as docker-compose.override.yml so
  syncing the canonical compose to the shared host no longer breaks dev's
  api-postgres (port :5432 clash + volume switch). Discovered + fixed while
  validating listmonk-hc on dev.
- pw-hc-rampcap.sh: healthcare analogue of pw-listmonk-rampcap, ramps the
  listmonk_hc cap 100->1000/h off /etc/postfix/hc-warmup-start, fully
  independent of the trucking ramp/cap.
2026-06-05 19:19:45 -05:00

81 lines
2.9 KiB
Bash
Executable file

#!/usr/bin/env bash
# Deploy to the dev site at dev.performancewest.net.
# Usage: bash scripts/deploy-dev.sh
#
# What it does:
# 1. Syncs API source + scripts + site to the dev server
# 2. Rebuilds dev API + site Docker containers
# 3. No manual docker-cp or _astro merging needed — everything
# is in site/public/ and gets built into the image.
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
# Single source of truth for the header: rewrite every static page's <nav>
# block from site/src/partials/nav.html so the Services dropdown can never
# drift between dev.performancewest.net, the order pages, and the rest of
# the site. Idempotent.
echo "=== Syncing canonical site header (Services dropdown) ==="
python3 "$SCRIPT_DIR/sync_nav.py"
REMOTE="deploy@207.174.124.71"
SSH="ssh -p 22022"
SCP="scp -P 22022"
DEV_DIR="/opt/performancewest-dev"
RSYNC_OPTS="-avz --delete --exclude=node_modules --exclude=.git --exclude='__pycache__' --exclude=dist --exclude=.env --exclude='site-old'"
echo "=== Syncing source files ==="
rsync $RSYNC_OPTS \
-e "$SSH" \
api/src/ "$REMOTE:$DEV_DIR/api/src/"
rsync $RSYNC_OPTS \
-e "$SSH" \
api/migrations/ "$REMOTE:$DEV_DIR/api/migrations/"
rsync $RSYNC_OPTS \
-e "$SSH" \
scripts/ "$REMOTE:$DEV_DIR/scripts/"
rsync $RSYNC_OPTS \
-e "$SSH" \
site/src/ "$REMOTE:$DEV_DIR/site/src/"
rsync $RSYNC_OPTS \
-e "$SSH" \
site/public/ "$REMOTE:$DEV_DIR/site/public/"
# Also sync config files that live at the site root
for f in site/Dockerfile site/nginx.conf site/package.json site/astro.config.mjs site/tsconfig.json; do
if [ -f "$f" ]; then
rsync -avz -e "$SSH" "$f" "$REMOTE:$DEV_DIR/$f"
fi
done
# Keep the dev compose file in sync with git so service changes (e.g. the
# healthcare proxy-relay sidecar) actually reach dev. The .env is server-managed
# and not overwritten.
rsync -avz -e "$SSH" docker-compose.yml "$REMOTE:$DEV_DIR/docker-compose.yml"
# Dev-only compose override: dev shares the host with prod, so it must NOT bind
# the prod host ports (5432/9100/9101/...) and must use its own postgres data
# volume (dev-pgdata). Shipped as docker-compose.override.yml (compose auto-loads
# it). Without this, syncing the canonical compose makes dev's api-postgres try
# to rebind prod's :5432 and switch volumes -> stack breakage. See
# docs/healthcare-email-stream-plan.md.
rsync -avz -e "$SSH" docker-compose.dev.override.yml "$REMOTE:$DEV_DIR/docker-compose.override.yml"
echo ""
echo "=== Rebuilding containers ==="
# proxy-relay is an upstream image (no build context); `up --build` skips the
# build for it but still (re)creates it from the compose definition.
$SSH "$REMOTE" "cd $DEV_DIR && sudo docker compose up -d --build api site workers proxy-relay listmonk-hc"
echo ""
echo "=== Deploy complete ==="
echo "Dev site: https://dev.performancewest.net"
echo "Dev API: https://api.dev.performancewest.net"