new-site/scripts/deploy-dev.sh
justin 4f49fad7f9 deploy: bring up the healthcare proxy-relay sidecar on prod and dev
deploy.sh: include proxy-relay in the default service set; it's an upstream
image (ginuerzh/gost) with no build context, so exclude it from 'compose build'
while keeping it in 'compose up'.

deploy-dev.sh: rsync docker-compose.yml to the dev server (it was never synced,
so new services like proxy-relay never reached dev) and add proxy-relay to the
'compose up --build' set.
2026-06-05 18:41:09 -05:00

73 lines
2.4 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"
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"
echo ""
echo "=== Deploy complete ==="
echo "Dev site: https://dev.performancewest.net"
echo "Dev API: https://api.dev.performancewest.net"