Deployment

Production deployment guide for Mystery Gift platform services.

Overview

Mystery Gift platform services are deployed to:

  • Cloudflare Workers (Serverless) - Marketplace API, Landing page
  • Hetzner VPS (PM2) - Livestream Server
  • Phala TEE (CVMs) - Randomness, Vault, Miss AI, Pokemon TCG API

Pre-deployment Checklist

  • [ ] Ensure all .env variables are set for production
  • [ ] Run type-check: pnpm type-check
  • [ ] Run tests: pnpm test (if available)
  • [ ] Backup existing database (if applicable)
  • [ ] Verify TEE service URLs

deploying-to-cloudflare-workers

Marketplace API

cd apps/marketplace/api
npx wrangler deploy

Landing Page

cd apps/landing
npx wrangler pages deploy dist

Deploying-to-hetzner-vps

Livestream Server

cd apps/livestream/server
pm2 start ecosystem.config.js
pm2 save

Deploying-to-phala-tee

Randomness Service

cd services/verifiable-randomness-service
phala deploy --cvm-id <cvm_id> --compose phala-compose.yaml -e .env.production

Vault Service

cd services/verifiable-wallet-service
phala deploy --cvm-id <cvm_id> --compose phala-compose.yaml -e .env.production

Miss AI

cd services/miss
phala deploy --cvm-id <cvm_id> --compose phala-compose.yaml -e .env.production

Post-deployment Verification

  1. Health checks:

  2. https://agent.mysterygift.fun/health (Miss AI)

  3. https://rng.mysterygift.fun/health (Randomness)
  4. https://vault.mysterygift.fun/health (Vault)

  5. Test raffle flow manually on stream overlay

  6. Verify winner announcements on Twitter

Monitoring

Use PM2 logs for livestream server and check Cloudflare dashboard for API metrics.

Next Steps

  • Testing - Post-deployment testing