feat: add server-side update.sh script for in-place deploys

This commit is contained in:
Vadym Samoilenko 2026-04-27 12:30:50 +01:00
parent a3c9e5b739
commit d4e1e4bf60

25
infra/deploy/update.sh Executable file
View file

@ -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"