Usage: ./deploy.sh (all) or ./deploy.sh site (single service) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
30 lines
784 B
Bash
Executable file
30 lines
784 B
Bash
Executable file
#!/usr/bin/env bash
|
|
# Deploy latest code from git and rebuild containers.
|
|
# Usage: ./deploy.sh (rebuilds site, api, workers)
|
|
# ./deploy.sh site (rebuilds only site)
|
|
# ./deploy.sh api (rebuilds only api)
|
|
set -euo pipefail
|
|
cd /opt/performancewest
|
|
|
|
SERVICES="${@:-site api workers}"
|
|
|
|
echo "=== Pulling latest from git ==="
|
|
git pull origin main
|
|
|
|
echo ""
|
|
echo "=== Building: $SERVICES ==="
|
|
docker compose build $SERVICES
|
|
|
|
echo ""
|
|
echo "=== Restarting: $SERVICES ==="
|
|
docker compose up -d $SERVICES
|
|
|
|
echo ""
|
|
echo "=== Clearing nginx cache ==="
|
|
sudo rm -rf /var/cache/nginx/* 2>/dev/null || true
|
|
sudo nginx -s reload 2>/dev/null || true
|
|
|
|
echo ""
|
|
echo "=== Done ==="
|
|
git log --oneline -1
|
|
docker compose ps --format "table {{.Name}}\t{{.Status}}" | head -10
|