feat: sase.tr v2 full application implementation
Complete rewrite of sase.tr VIN lookup platform with modern stack: Backend (NestJS 10 + Drizzle ORM + PostgreSQL + Redis + BullMQ): - 34 DB models (core + PL24 + EMEX schemas) - Auth via Better Auth (email/password + social) - Brands, Plans, Subscriptions, Payments (iyzico + EFT) - VIN decode orchestration (Corgi + PL24 + EMEX + NHTSA) - Interactive schema viewer backend (MinIO storage) - EMEX scraping integration (Puppeteer + BullMQ workers) - Translation module (EN→TR automotive dictionary) - Admin dashboard API (stats, user mgmt, payment approval) - Rate limiting, Helmet security, file upload validation Frontend (Next.js 15 + Tailwind v4 + shadcn/ui + TanStack Query + Zustand): - 20 routes: auth, dashboard, VIN search, schema viewer, admin - Interactive schema viewer with zoom/pan/hotspot highlighting - Subscription management with brand selector - Payment flow (iyzico 3D Secure + EFT with receipt upload) - i18n support (TR/EN) - Error boundaries, loading skeletons, 404 page Infrastructure: - 85 tests (52 backend + 33 frontend, Vitest) - CI/CD (GitHub Actions: lint, typecheck, test, build, deploy) - Zero-downtime deploy script (PM2) - Env validation script Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
51
scripts/deploy.sh
Executable file
51
scripts/deploy.sh
Executable file
@@ -0,0 +1,51 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# ──────────────────────────────────────────────
|
||||
# Zero-downtime deploy script for sase-v2
|
||||
# ──────────────────────────────────────────────
|
||||
|
||||
DEPLOY_DIR="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
LOG_PREFIX="[deploy]"
|
||||
|
||||
log() {
|
||||
echo "$(date '+%Y-%m-%d %H:%M:%S') $LOG_PREFIX $1"
|
||||
}
|
||||
|
||||
error_exit() {
|
||||
log "ERROR: $1"
|
||||
exit 1
|
||||
}
|
||||
|
||||
cd "$DEPLOY_DIR" || error_exit "Cannot change to project directory: $DEPLOY_DIR"
|
||||
|
||||
log "Starting zero-downtime deployment..."
|
||||
log "Working directory: $DEPLOY_DIR"
|
||||
|
||||
# ── Step 1: Pull latest changes ──
|
||||
log "Pulling latest changes from origin..."
|
||||
git pull origin main || error_exit "git pull failed"
|
||||
|
||||
# ── Step 2: Install dependencies ──
|
||||
log "Installing dependencies (frozen lockfile)..."
|
||||
pnpm install --frozen-lockfile || error_exit "pnpm install failed"
|
||||
|
||||
# ── Step 3: Build all packages and apps ──
|
||||
log "Building all packages..."
|
||||
pnpm build || error_exit "Build failed"
|
||||
|
||||
# ── Step 4: Database migrations (safe push) ──
|
||||
log "Running database migrations (drizzle-kit push)..."
|
||||
cd apps/api
|
||||
pnpm db:push || error_exit "Database migration failed"
|
||||
cd "$DEPLOY_DIR"
|
||||
|
||||
# ── Step 5: Zero-downtime PM2 reload ──
|
||||
log "Reloading PM2 processes (zero-downtime)..."
|
||||
pm2 reload ecosystem.config.js || error_exit "PM2 reload failed"
|
||||
|
||||
# ── Step 6: Verify processes are running ──
|
||||
log "Verifying PM2 process status..."
|
||||
pm2 list
|
||||
|
||||
log "Deployment completed successfully!"
|
||||
Reference in New Issue
Block a user