diff --git a/infra/deploy/update.sh b/infra/deploy/update.sh new file mode 100755 index 0000000..5dbf9a1 --- /dev/null +++ b/infra/deploy/update.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash +# Run directly on the server from /opt/ai-cost-tracker/ +# Usage: ./infra/deploy/update.sh [--no-cache] +# Updates to latest code and restarts all containers + +set -euo pipefail + +COMPOSE="docker compose -f infra/docker-compose.yml" +NO_CACHE=${1:-} + +echo "==> Pulling latest code..." +git pull origin main + +echo "==> Building containers${NO_CACHE:+ (no-cache)}..." +$COMPOSE build ${NO_CACHE:+--no-cache} + +echo "==> Restarting services..." +$COMPOSE up -d + +echo "==> Status:" +$COMPOSE ps + +echo "" +echo "Done! App: https://optical-dev.oliver.solutions/cost-tracker/" +echo "API: https://optical-dev.oliver.solutions/cost-tracker/v1/health"