Production Deployment Guide
This guide walks through the complete production deployment process for Dashtray MVP, including environment setup, service configuration, and verification steps.Prerequisites
Before starting the deployment, ensure you have:- Cloudflare account with Pages enabled
- Convex account with production deployment
- DodoPayments account configured
- Resend account for transactional emails
- Custom domain registered (optional)
- GitHub repository with CI/CD workflows
- All required API keys and secrets
Table of Contents
- Environment Variables Setup
- Convex Production Deployment
- Cloudflare Pages Setup
- Custom Domain and SSL
- DodoPayments Webhook Configuration
- Staging Environment Testing
- Production Deployment
- Post-Deployment Verification
- Monitoring Setup
- Rollback Procedures
1. Environment Variables Setup
1.1 Convex Environment Variables
Set these variables in your Convex production deployment:1.2 GitHub Secrets and Variables
Configure these in your GitHub repository settings: Secrets (Settings → Secrets and variables → Actions → New repository secret):1.3 Local .env.local (for reference)
Keep a local copy for development:2. Convex Production Deployment
2.1 Deploy Convex Functions
2.2 Verify Convex Deployment
- Check the Convex dashboard: https://dashboard.convex.dev
- Verify all functions are deployed
- Check cron jobs are scheduled:
sync-pro-metrics(every 3 hours)sync-scale-metrics(every 30 minutes)check-alerts(every 5 minutes)cleanup-old-metrics(daily at 2 AM UTC)
2.3 Test Convex Functions
3. Cloudflare Pages Setup
3.1 Create Cloudflare Pages Project
- Log in to Cloudflare Dashboard
- Navigate to Workers & Pages → Create application → Pages
- Connect your GitHub repository
- Configure build settings:
- Framework preset: SvelteKit
- Build command:
pnpm run build - Build output directory:
.svelte-kit/cloudflare - Root directory:
/
3.2 Configure Environment Variables
In Cloudflare Pages project settings → Environment variables: Production environment:3.3 Configure Build Settings
- Node.js version: 20
- Compatibility flags:
nodejs_compat - Compatibility date:
2025-01-01
4. Custom Domain and SSL
4.1 Add Custom Domain
- In Cloudflare Pages project → Custom domains
- Click Set up a custom domain
- Enter your domain:
dashtray.com - Add DNS records as instructed:
- Type:
CNAME - Name:
@(orwww) - Target:
your-project.pages.dev
- Type:
4.2 Configure SSL/TLS
- Navigate to SSL/TLS in Cloudflare dashboard
- Set encryption mode to Full (strict)
- Enable Always Use HTTPS
- Enable Automatic HTTPS Rewrites
- Enable HTTP Strict Transport Security (HSTS):
- Max Age: 12 months
- Include subdomains: Yes
- Preload: Yes
4.3 Verify SSL Certificate
5. DodoPayments Webhook Configuration
5.1 Configure Webhook URL
- Log in to DodoPayments dashboard
- Navigate to Settings → Webhooks
- Add webhook endpoint:
- URL:
https://your-project.convex.site/dodopayments-webhook - Events: Select all subscription and payment events:
subscription.activesubscription.renewedsubscription.cancelledsubscription.expiredpayment.succeededpayment.failed
- URL:
5.2 Test Webhook
5.3 Verify Webhook Signature
The webhook handler automatically verifies signatures using the DodoPayments SDK. Ensure theDODO_PAYMENTS_API_KEY is correctly set in Convex environment variables.
6. Staging Environment Testing
6.1 Deploy to Staging
6.2 Run Test Suite
6.3 Manual Testing Checklist
- User registration and email verification
- Login with email/password
- OAuth login (Google, GitHub)
- Create project
- Connect integration (Stripe, GitHub, etc.)
- View metrics on dashboard
- Create custom dashboard
- Drag and drop widgets
- Create alert (Pro+ tier)
- Test AI chat with BYOK
- Invite team member
- Upgrade subscription
- Test webhook (DodoPayments)
- Export data (Scale+ tier)
- View audit logs (Scale+ tier)
- Test API endpoints (Scale+ tier)
7. Production Deployment
7.1 Pre-Deployment Checklist
- All tests passing
- Staging environment verified
- Database migrations completed (if any)
- Environment variables configured
- SSL certificate active
- Webhooks configured
- Monitoring setup complete
- Rollback plan documented
7.2 Deploy to Production
7.3 Monitor Deployment
- Watch GitHub Actions workflow: https://github.com/your-org/dashtray/actions
- Monitor Convex logs:
npx convex logs --prod --watch - Check Cloudflare Pages deployment status
- Verify application is accessible: https://dashtray.com
8. Post-Deployment Verification
8.1 Smoke Tests
8.2 Integration Tests
- Stripe integration connects successfully
- GitHub integration fetches metrics
- Vercel integration syncs deployments
- Google Analytics OAuth flow works
- Plausible integration retrieves data
8.3 Webhook Tests
8.4 Performance Tests
- Homepage loads in < 2s
- Dashboard loads in < 3s
- API response time < 200ms
- Widget render time < 500ms
8.5 Security Tests
- HTTPS enforced
- HSTS header present
- CSP headers configured
- API authentication required
- Rate limiting active
- Webhook signatures verified
9. Monitoring Setup
9.1 Uptime Monitoring
Set up uptime monitoring with a service like:- UptimeRobot
- Pingdom
- StatusCake
https://dashtray.com(every 5 minutes)https://your-project.convex.site/api/health(every 5 minutes)
- 3 consecutive failures
- Response time > 5s
- HTTP status code 5xx
9.2 Error Tracking
Configure Sentry or similar:9.3 Performance Monitoring
Monitor Core Web Vitals:- LCP (Largest Contentful Paint) < 2.5s
- FID (First Input Delay) < 100ms
- CLS (Cumulative Layout Shift) < 0.1
9.4 Usage Analytics
Configure analytics (optional):- Plausible Analytics
- Mixpanel
- PostHog
10. Rollback Procedures
10.1 Rollback Convex Deployment
10.2 Rollback Cloudflare Pages
- Go to Cloudflare Pages dashboard
- Navigate to Deployments
- Find the last working deployment
- Click Rollback to this deployment
10.3 Rollback GitHub
Troubleshooting
Common Issues
Issue: Convex functions not deploying- Solution: Check
convex.jsonconfiguration, ensurefunctionspath is correct
- Solution: Verify variables are set in both Convex and Cloudflare Pages
- Solution: Check webhook URL, verify signature validation, check Convex logs
- Solution: Ensure DNS records are correct, wait for propagation (up to 24 hours)
- Solution: Check Node.js version (should be 20), verify dependencies are installed
Support Contacts
- Convex Support: support@convex.dev
- Cloudflare Support: https://dash.cloudflare.com/support
- DodoPayments Support: support@dodopayments.com
Deployment Checklist Summary
Pre-Deployment
- Environment variables configured (Convex, GitHub, Cloudflare)
- Convex functions deployed to production
- Cloudflare Pages project created
- Custom domain configured with SSL
- DodoPayments webhooks configured
- Staging environment tested
- All tests passing
Deployment
- Code merged to main branch
- GitHub Actions workflow completed successfully
- Application accessible at production URL
- SSL certificate active
Post-Deployment
- Smoke tests passed
- Integration tests passed
- Webhook tests passed
- Performance tests passed
- Security tests passed
- Monitoring configured
- Error tracking configured
- Team notified of deployment
Next Steps
After successful production deployment:- Monitor for 24 hours: Watch for errors, performance issues, or user reports
- Set up alerts: Configure monitoring alerts for critical issues
- Document incidents: Keep a log of any issues and resolutions
- Plan next release: Schedule regular deployments (weekly/bi-weekly)
- Gather feedback: Collect user feedback and prioritize improvements