Skip to content

This checklist ensures a safe and successful deployment of the Campaign Architecture Redesign (v2.0) to production.


Pre-Deployment Phase

1. Code Review & Testing

  • [ ] All Phase 1-9 tasks completed (verify in TendSocial_Implementation_Checklist.md)
  • [ ] Full test suite passes
    bash
    cd apps/backend
    pnpm test
  • [ ] TypeScript compilation succeeds
    bash
    cd apps/backend
    pnpm build
  • [ ] No linting errors
    bash
    cd apps/backend
    pnpm lint

2. Database Migration Review

  • [ ] Review all pending migrations

    bash
    cd apps/backend
    ls -la prisma/migrations
  • [ ] Verify migration SQL correctness

    • Check latest migration: 20251130034654_tend_social_campaign_architecture_plan_v2
    • Ensure all tables, indexes, and foreign keys are correct
    • Verify no destructive operations without proper safeguards
  • [ ] Test migration on development database

    bash
    pnpm db:migrate
  • [ ] Verify Prisma client generation

    bash
    pnpm generate

3. Environment & Configuration

  • [ ] Verify production environment variables

    • DATABASE_URL (Neon/Postgres connection string)
    • AI_GATEWAY_ADAPTER (default: vercel-ai-sdk)
    • ANTHROPIC_API_KEY
    • GOOGLE_AI_API_KEY
    • OPENAI_API_KEY
    • AI_CONFIG_CACHE_TTL (default: 60)
    • AI_GATEWAY_CACHE_TTL (default: 300)
    • JOBS_ENABLED (default: true)
  • [ ] Verify Google Cloud configuration

    • Cloud Run service: tendsocial-api
    • Region: us-central1
    • Cloud Tasks queue: tendsocial-tasks
  • [ ] Verify Vercel configuration

    • Dashboard app: apps/frontend
    • Marketing site: apps/marketing
    • VITE_API_URL points to Cloud Run URL

4. Backup & Rollback Preparation

  • [ ] Create production database backup

    bash
    # Neon database backup via dashboard or CLI
    # Or use pg_dump if direct access
    pg_dump $DATABASE_URL > backup_$(date +%Y%m%d_%H%M%S).sql
  • [ ] Verify backup integrity

    • Download backup file
    • Check file size > 0
    • Optionally test restore on staging
  • [ ] Review rollback plan (rollback-plan.md)

  • [ ] Tag current production release

    bash
    git tag -a v2.0-pre-campaign-arch -m "Pre-Campaign Architecture Deployment"
    git push origin v2.0-pre-campaign-arch

5. Communication

  • [ ] Schedule maintenance window (if needed)

    • Most migrations are non-blocking
    • Consider off-peak hours for safety
  • [ ] Notify team of deployment

    • Engineering team
    • Support team
    • Stakeholders

Deployment Phase

6. Database Migration

  • [ ] Run migration deployment script

    bash
    cd scripts
    bash deploy-migrations.sh
  • [ ] Verify migration success

    • Check for error messages
    • Verify all migrations applied
  • [ ] Seed AI Model Configurations

    bash
    cd apps/backend
    pnpm db:seed
  • [ ] Verify seed data

    sql
    SELECT task, provider, model FROM "AIModelConfig";

    Expected: 7 rows (campaign_planning, social_posts, blog_writing, video_script, image_generation, profile_analysis, performance_analysis)

7. Application Deployment

  • [ ] Build and push API container

    bash
    # From root directory
    gcloud auth configure-docker gcr.io
    docker build -f apps/backend/Dockerfile -t gcr.io/tendsocial/tendsocial-api:v2.0 .
    docker push gcr.io/tendsocial/tendsocial-api:v2.0
  • [ ] Deploy to Cloud Run

    bash
    gcloud run deploy tendsocial-api \
      --image gcr.io/tendsocial/tendsocial-api:v2.0 \
      --region us-central1 \
      --platform managed \
      --allow-unauthenticated
  • [ ] Deploy frontend apps

    bash
    # Dashboard
    pnpm --filter @tendsocial/frontend exec vercel deploy --prod
    
    # Marketing site
    pnpm --filter @tendsocial/marketing exec vercel deploy --prod

8. Post-Deployment Verification

  • [ ] Run deployment verification script

    bash
    cd apps/backend
    tsx src/scripts/verify-deployment.ts
  • [ ] Run smoke tests

    bash
    tsx src/scripts/smoke-tests.ts
  • [ ] Manual verification

    • [ ] Health check: https://tendsocial-api-xyz.run.app/health
    • [ ] Admin UI: Login and verify AI Config page loads
    • [ ] Create test campaign
    • [ ] Generate test social post with campaign context
    • [ ] Verify post has campaignId and generationContext

Post-Deployment Phase

9. Monitoring Setup

  • [ ] Verify error logging

    bash
    gcloud logging read "resource.type=cloud_run_revision AND resource.labels.service_name=tendsocial-api AND severity>=ERROR" --limit 10
  • [ ] Monitor AI costs

    sql
    SELECT DATE(created_at) as date, SUM(total_cost_cents) / 100 as cost_usd
    FROM "AIUsageLog"
    WHERE created_at >= NOW() - INTERVAL '1 day'
    GROUP BY date;
  • [ ] Monitor job execution

    sql
    SELECT status, COUNT(*) FROM "ProfileAnalysisJob" WHERE "createdAt" >= NOW() - INTERVAL '1 day' GROUP BY status;
    SELECT status, COUNT(*) FROM "PerformanceSyncJob" WHERE "createdAt" >= NOW() - INTERVAL '1 day' GROUP BY status;
  • [ ] Set up cost alerts (run tsx src/scripts/cost-alerts.ts)

  • [ ] Configure monitoring alerts

    • Error rate > 5% over 5 minutes
    • Latency p99 > 5 seconds
    • Daily AI cost > $50

10. Team Notification

  • [ ] Announce successful deployment to team
  • [ ] Share monitoring dashboard links
  • [ ] Review training guide with support team
  • [ ] Schedule follow-up review (1 week post-deployment)

Beta Period Setup

11. Feature Flags & A/B Testing

  • [ ] Enable campaign-centric features
  • [ ] Create first A/B test
    bash
    tsx src/scripts/create-ab-test.ts
  • [ ] Verify A/B test assignments
    sql
    SELECT "variantName", COUNT(*) FROM "AIABAssignment" WHERE "testId" = '<test-id>' GROUP BY "variantName";

12. Support Team Readiness

  • [ ] Conduct training session (use training-guide.md)
  • [ ] Provide admin dashboard access
  • [ ] Review common troubleshooting scenarios
  • [ ] Schedule follow-up training (2 weeks)

Rollback Criteria

If any of the following occur, execute the rollback plan immediately:

  • ❌ Error rate exceeds 10%
  • ❌ Critical functionality broken (auth, content generation, publishing)
  • ❌ Database corruption detected
  • ❌ AI costs spike unexpectedly (>200% of baseline)
  • ❌ Job processing completely fails

See rollback-plan.md for detailed rollback procedures.


Checklist Owner: _____________________
Deployment Date: _____________________
Sign-off: _____________________

TendSocial Documentation