Head of Product & Engineering f99772d8c0 feat: add production deployment artifacts for ghl.cast.ph (Vultr)
- deploy/nginx/ghl.cast.ph.conf: Nginx reverse proxy with SSL (Let's Encrypt)
- deploy/setup-server.sh: one-shot Ubuntu VPS bootstrap (Docker, Nginx, Certbot, UFW)
- deploy/deploy.sh: pull-and-redeploy script using Docker Compose
- docker-compose.yaml: bind bridge to 127.0.0.1 only; add Mongo healthcheck;
  bridge waits for Mongo healthy before starting

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-04-05 01:46:26 +02:00

36 lines
991 B
Bash

#!/usr/bin/env bash
# deploy.sh — Pull latest code and redeploy via Docker Compose
# Run from /opt/cast-ghl-plugin after initial server setup.
# Usage: bash deploy/deploy.sh
set -euo pipefail
APP_DIR="$(cd "$(dirname "$0")/.." && pwd)"
cd "$APP_DIR"
echo "==> Pulling latest code"
git pull --ff-only
echo "==> Building and restarting services"
docker compose pull mongo # pull latest Mongo image if updated
docker compose build --no-cache bridge
docker compose up -d --remove-orphans
echo "==> Waiting for health check"
sleep 5
STATUS=$(docker compose ps --format json | python3 -c "
import sys, json
for line in sys.stdin:
s = json.loads(line)
if s.get('Service') == 'bridge':
print(s.get('Health', s.get('State', 'unknown')))
" 2>/dev/null || echo "unknown")
echo "Bridge container status: $STATUS"
echo "==> Tailing last 20 log lines"
docker compose logs --tail=20 bridge
echo ""
echo "=== Deploy complete ==="
echo "Health endpoint: https://ghl.cast.ph/health"