diff --git a/deploy.sh b/deploy.sh new file mode 100755 index 0000000..3463f62 --- /dev/null +++ b/deploy.sh @@ -0,0 +1,30 @@ +#!/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