Farid Siddiqi 47be003f6d
Some checks failed
Build and Deploy API Server / deploy (push) Has been cancelled
Build and Deploy API Server / build (push) Has been cancelled
Simplify deployment structure and consolidate documentation
- Remove redundant manual setup (setup-vps.sh) - Ansible handles all VPS setup
- Remove config templates directory - Ansible creates .env.production
- Delete verbose DEPLOYMENT_SETUP.md - info consolidated into deployment/README.md
- Rewrite deployment/README.md with clear 3-step workflow
- Simplify deployment/ansible/README.md to quick reference
- Reduce total documentation from 1159 lines to 225 lines

The deployment process is now easier to understand:
1. Run Ansible playbook (one-time setup)
2. Push code to Gitea (auto-builds)
3. SSH and promote to production

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-23 17:47:50 -08:00

49 lines
997 B
Bash
Executable File

#!/bin/bash
set -euo pipefail
ARTIFACT_DIR="/opt/api-artifacts"
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m'
log_info() { echo -e "${GREEN}[INFO]${NC} $1"; }
log_warn() { echo -e "${YELLOW}[WARN]${NC} $1"; }
log_error() { echo -e "${RED}[ERROR]${NC} $1"; }
SLOT="${1:-blue}"
SLOT_LINK="$ARTIFACT_DIR/$SLOT"
if [ ! -L "$SLOT_LINK" ]; then
log_error "Slot not found: $SLOT"
exit 1
fi
BUILD_PATH=$(readlink -f "$SLOT_LINK")
MIGRATIONS_DIR="$BUILD_PATH/migrations"
if [ ! -d "$MIGRATIONS_DIR" ]; then
log_error "Migrations directory not found: $MIGRATIONS_DIR"
exit 1
fi
if [ -f "$BUILD_PATH/.env.production" ]; then
source "$BUILD_PATH/.env.production"
fi
if [ -z "${DATABASE_URL:-}" ]; then
log_error "DATABASE_URL not set"
exit 1
fi
log_info "Running migrations from: $MIGRATIONS_DIR"
cd "$BUILD_PATH"
export AUTO_MIGRATE=true
export PORT=0
timeout 30s ./api-server 2>&1 | grep -i "migration" || true
log_info "Migrations completed"