From 134e84177b645aafa56efdcf058b411d64cdad1f Mon Sep 17 00:00:00 2001 From: justin Date: Tue, 28 Apr 2026 02:52:45 -0500 Subject: [PATCH] Add deploy.sh for git-based deployment Usage: ./deploy.sh (all) or ./deploy.sh site (single service) Co-Authored-By: Claude Opus 4.6 (1M context) --- deploy.sh | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100755 deploy.sh 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