═══════════════════════════════════════════════════════════════════════════════ WASIYAT — GoDaddy VPS Deployment Guide Product of Khair Labs Private Limited ═══════════════════════════════════════════════════════════════════════════════ PACKAGE CONTENTS ──────────────── app/ → Pre-built Next.js standalone server (Node.js 20+) prisma/migrations/ → Database migration SQL (run once on fresh DB) nginx/nginx.conf → Nginx reverse proxy config docker-compose.prod.yml → Docker deployment (PostgreSQL + Redis + Nginx) ecosystem.config.js → PM2 config (if not using Docker) .env.production → Environment variables template deploy.sh → Automated deployment script ═══════════════════════════════════════════════════════════════════════════════ OPTION A — DOCKER (Recommended) ═══════════════════════════════════════════════════════════════════════════════ PREREQUISITES (run once on VPS): apt update && apt upgrade -y curl -fsSL https://get.docker.com | sh apt install -y docker-compose-plugin DEPLOY: 1. Upload this folder to VPS (e.g., /home/youruser/wasiyat/) 2. Create .env file: cp .env.production .env nano .env Replace EVERY "CHANGE_ME" with real values. Generate secrets: openssl rand -hex 32 3. Update nginx/nginx.conf: Replace "yourdomain.com" with your actual domain (3 places) 4. Get SSL certificate: apt install -y certbot certbot certonly --standalone -d yourdomain.com -d www.yourdomain.com \ --email your@email.com --agree-tos --no-eff-email 5. Run deployment: chmod +x deploy.sh bash deploy.sh 6. Run database seed (first time only): docker compose -f docker-compose.prod.yml exec app \ node -e "require('./prisma/seed')" 7. Add cron jobs (crontab -e): # Session cleanup at 2am daily 0 2 * * * curl -H "Authorization: Bearer YOUR_CRON_SECRET" \ https://yourdomain.com/api/cron/cleanup-sessions # SSL renewal monthly 0 3 1 * * certbot renew --quiet && \ docker compose -f /home/youruser/wasiyat/docker-compose.prod.yml restart nginx ═══════════════════════════════════════════════════════════════════════════════ OPTION B — NO DOCKER (PM2 + System Nginx) ═══════════════════════════════════════════════════════════════════════════════ PREREQUISITES: # Install Node.js 20 via nvm (no root required): curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash source ~/.bashrc nvm install 20 && nvm use 20 # Install PM2: npm install -g pm2 # Install PostgreSQL & Redis (requires sudo): apt install -y postgresql-16 redis-server nginx certbot DEPLOY: 1. Upload this folder to /home/youruser/wasiyat/ 2. Create .env: cp .env.production .env && nano .env 3. Update DATABASE_URL in .env — use localhost since no Docker: DATABASE_URL=postgresql://wasiyat:PASSWORD@localhost:5432/wasiyat_db 4. Create PostgreSQL database: sudo -u postgres psql -c "CREATE USER wasiyat WITH PASSWORD 'PASSWORD';" sudo -u postgres psql -c "CREATE DATABASE wasiyat_db OWNER wasiyat;" 5. Run migrations: source .env cd app && npx prisma migrate deploy && cd .. 6. Start with PM2: mkdir -p logs pm2 start ecosystem.config.js --env production pm2 save && pm2 startup 7. Configure Nginx: Copy nginx/nginx.conf to /etc/nginx/nginx.conf Replace "yourdomain.com" with your domain Update SSL cert paths and get cert with certbot systemctl restart nginx ═══════════════════════════════════════════════════════════════════════════════ ENVIRONMENT VARIABLES — REQUIRED SERVICES ═══════════════════════════════════════════════════════════════════════════════ SERVICE | SIGN UP AT ────────────────────────────────────────────────────────────────────────── PostgreSQL | Included in Docker / install on VPS Redis | Included in Docker / install on VPS Anthropic AI | console.anthropic.com AWS S3 | aws.amazon.com (bucket in ap-south-1) SendGrid | sendgrid.com MSG91 | msg91.com Razorpay | razorpay.com (use rzp_live_ keys) Sentry | sentry.io (optional, for error tracking) Google SSO | console.cloud.google.com (optional) Microsoft SSO | portal.azure.com (optional) ═══════════════════════════════════════════════════════════════════════════════ VERIFICATION ═══════════════════════════════════════════════════════════════════════════════ After deployment: curl -I https://yourdomain.com → Should return HTTP/2 200 curl -I https://yourdomain.com/login → Should return HTTP/2 200 curl -H "Authorization: Bearer WRONG" \ https://yourdomain.com/api/cron/cleanup-sessions → Should return 401 Logs: Docker: docker compose -f docker-compose.prod.yml logs -f app PM2: pm2 logs wasiyat ═══════════════════════════════════════════════════════════════════════════════ SUPPORT ═══════════════════════════════════════════════════════════════════════════════ Wasiyat is a product of Khair Labs Private Limited. For technical support: support@wasiyat.in ═══════════════════════════════════════════════════════════════════════════════