572 lines
13 KiB
Markdown
572 lines
13 KiB
Markdown
# 🚀 Phase 6 Deployment Checklist
|
|
|
|
Use this checklist to deploy Phase 6: Premium Monetization to production.
|
|
|
|
---
|
|
|
|
## Prerequisites
|
|
|
|
- [ ] Production server ready (Node.js 18+, PostgreSQL 14+)
|
|
- [ ] Stripe account verified and activated
|
|
- [ ] Domain configured with SSL/TLS
|
|
- [ ] GitHub repository access
|
|
- [ ] Database backups configured
|
|
|
|
---
|
|
|
|
## 1. Database Setup
|
|
|
|
### Apply Migration
|
|
```bash
|
|
# SSH into production server
|
|
ssh user@your-server.com
|
|
|
|
# Navigate to project directory
|
|
cd /path/to/AeThex-Connect
|
|
|
|
# Apply migration
|
|
npm run migrate
|
|
|
|
# Or manually with psql
|
|
psql $DATABASE_URL -f src/backend/database/migrations/006_premium_monetization.sql
|
|
```
|
|
|
|
### Verify Migration
|
|
```sql
|
|
-- Check tables created
|
|
SELECT table_name FROM information_schema.tables
|
|
WHERE table_schema = 'public'
|
|
AND table_name LIKE 'premium_%' OR table_name LIKE '%_domain%';
|
|
|
|
-- Verify feature_limits populated
|
|
SELECT * FROM feature_limits;
|
|
-- Should show 3 rows: free, premium, enterprise
|
|
|
|
-- Check user column added
|
|
SELECT column_name FROM information_schema.columns
|
|
WHERE table_name = 'users' AND column_name = 'premium_tier';
|
|
```
|
|
|
|
**Status:** ☐ Complete
|
|
|
|
---
|
|
|
|
## 2. Stripe Configuration
|
|
|
|
### 2.1 Create Products & Prices
|
|
|
|
Go to [Stripe Dashboard → Products](https://dashboard.stripe.com/products)
|
|
|
|
**Premium Yearly:**
|
|
- [ ] Create product "AeThex Connect Premium (Yearly)"
|
|
- [ ] Set price: $100.00 USD
|
|
- [ ] Billing: Recurring, interval = 1 year
|
|
- [ ] Copy Price ID: `price_...`
|
|
- [ ] Save to `STRIPE_PREMIUM_YEARLY_PRICE_ID`
|
|
|
|
**Premium Monthly:**
|
|
- [ ] Create product "AeThex Connect Premium (Monthly)"
|
|
- [ ] Set price: $10.00 USD
|
|
- [ ] Billing: Recurring, interval = 1 month
|
|
- [ ] Copy Price ID: `price_...`
|
|
- [ ] Save to `STRIPE_PREMIUM_MONTHLY_PRICE_ID`
|
|
|
|
**Enterprise:**
|
|
- [ ] Create product "AeThex Connect Enterprise"
|
|
- [ ] Set price: $500.00 USD (or custom)
|
|
- [ ] Billing: Recurring, interval = 1 month
|
|
- [ ] Copy Price ID: `price_...`
|
|
- [ ] Save to `STRIPE_ENTERPRISE_PRICE_ID`
|
|
|
|
### 2.2 Configure Webhook
|
|
|
|
Go to [Stripe Dashboard → Developers → Webhooks](https://dashboard.stripe.com/webhooks)
|
|
|
|
- [ ] Click "Add endpoint"
|
|
- [ ] Endpoint URL: `https://yourdomain.com/webhooks/stripe`
|
|
- [ ] Select events to send:
|
|
- [ ] `customer.subscription.created`
|
|
- [ ] `customer.subscription.updated`
|
|
- [ ] `customer.subscription.deleted`
|
|
- [ ] `invoice.payment_succeeded`
|
|
- [ ] `invoice.payment_failed`
|
|
- [ ] `customer.subscription.trial_will_end`
|
|
- [ ] Click "Add endpoint"
|
|
- [ ] Copy signing secret (starts with `whsec_`)
|
|
- [ ] Save to `STRIPE_WEBHOOK_SECRET`
|
|
|
|
### 2.3 Get API Keys
|
|
|
|
Go to [Stripe Dashboard → Developers → API Keys](https://dashboard.stripe.com/apikeys)
|
|
|
|
**⚠️ Important:** Switch to **LIVE MODE** (toggle in top right)
|
|
|
|
- [ ] Copy "Publishable key" (starts with `pk_live_`)
|
|
- [ ] Save to `STRIPE_PUBLISHABLE_KEY`
|
|
- [ ] Reveal "Secret key" (starts with `sk_live_`)
|
|
- [ ] Save to `STRIPE_SECRET_KEY`
|
|
|
|
**Status:** ☐ Complete
|
|
|
|
---
|
|
|
|
## 3. Environment Variables
|
|
|
|
### 3.1 Backend Environment
|
|
|
|
Edit production `.env` file:
|
|
|
|
```bash
|
|
# Switch to production
|
|
NODE_ENV=production
|
|
|
|
# Stripe LIVE keys (not test!)
|
|
STRIPE_SECRET_KEY=sk_live_...
|
|
STRIPE_PUBLISHABLE_KEY=pk_live_...
|
|
STRIPE_WEBHOOK_SECRET=whsec_...
|
|
|
|
# Stripe Price IDs (from step 2.1)
|
|
STRIPE_PREMIUM_YEARLY_PRICE_ID=price_...
|
|
STRIPE_PREMIUM_MONTHLY_PRICE_ID=price_...
|
|
STRIPE_ENTERPRISE_PRICE_ID=price_...
|
|
|
|
# Blockchain (optional - Phase 7)
|
|
POLYGON_RPC_URL=https://polygon-mainnet.g.alchemy.com/v2/YOUR_KEY
|
|
FREENAME_REGISTRY_ADDRESS=0x...
|
|
DOMAIN_MINTER_PRIVATE_KEY=0x... # Use hardware wallet!
|
|
|
|
# Platform settings
|
|
PLATFORM_FEE_PERCENTAGE=10
|
|
FREE_MAX_FRIENDS=5
|
|
FREE_STORAGE_GB=0.1
|
|
PREMIUM_STORAGE_GB=10
|
|
ENTERPRISE_STORAGE_GB=-1
|
|
|
|
# Security
|
|
JWT_SECRET=<generate-new-secret>
|
|
SESSION_SECRET=<generate-new-secret>
|
|
ENCRYPTION_KEY=<generate-32-char-key>
|
|
|
|
# Database
|
|
DATABASE_URL=postgresql://user:password@host:5432/database
|
|
|
|
# CORS
|
|
CORS_ORIGINS=https://yourdomain.com,https://www.yourdomain.com
|
|
```
|
|
|
|
**Generate Secrets:**
|
|
```bash
|
|
# Generate JWT secret
|
|
node -e "console.log(require('crypto').randomBytes(64).toString('hex'))"
|
|
|
|
# Generate encryption key (32 chars)
|
|
node -e "console.log(require('crypto').randomBytes(16).toString('hex'))"
|
|
```
|
|
|
|
**Verification:**
|
|
- [ ] All secrets generated and unique
|
|
- [ ] Stripe keys are LIVE (not test)
|
|
- [ ] Database URL is production
|
|
- [ ] CORS origins match production domain
|
|
- [ ] NODE_ENV=production
|
|
|
|
### 3.2 Frontend Environment
|
|
|
|
Edit frontend `.env` (or `.env.production`):
|
|
|
|
```bash
|
|
REACT_APP_STRIPE_PUBLISHABLE_KEY=pk_live_...
|
|
REACT_APP_API_URL=https://yourdomain.com/api
|
|
REACT_APP_SOCKET_URL=https://yourdomain.com
|
|
```
|
|
|
|
**Verification:**
|
|
- [ ] Publishable key is LIVE (not test)
|
|
- [ ] API URL is production
|
|
- [ ] Socket URL is production
|
|
|
|
**Status:** ☐ Complete
|
|
|
|
---
|
|
|
|
## 4. Code Deployment
|
|
|
|
### 4.1 Pull Latest Code
|
|
|
|
```bash
|
|
# On production server
|
|
cd /path/to/AeThex-Connect
|
|
git pull origin main
|
|
```
|
|
|
|
### 4.2 Install Dependencies
|
|
|
|
```bash
|
|
# Install/update backend dependencies
|
|
npm install --production
|
|
|
|
# Install/update frontend dependencies
|
|
cd src/frontend
|
|
npm install
|
|
npm run build
|
|
```
|
|
|
|
### 4.3 Restart Services
|
|
|
|
```bash
|
|
# Using PM2
|
|
pm2 restart aethex-connect
|
|
|
|
# Or systemd
|
|
sudo systemctl restart aethex-connect
|
|
|
|
# Or Docker
|
|
docker-compose restart
|
|
```
|
|
|
|
**Verification:**
|
|
```bash
|
|
# Check server is running
|
|
curl https://yourdomain.com/health
|
|
|
|
# Check logs
|
|
pm2 logs aethex-connect
|
|
# or
|
|
sudo journalctl -u aethex-connect -f
|
|
```
|
|
|
|
**Status:** ☐ Complete
|
|
|
|
---
|
|
|
|
## 5. Security Hardening
|
|
|
|
### 5.1 SSL/TLS Configuration
|
|
- [ ] SSL certificate installed (Let's Encrypt, etc.)
|
|
- [ ] HTTPS enforced (HTTP redirects to HTTPS)
|
|
- [ ] Certificate auto-renewal configured
|
|
- [ ] Strong cipher suites enabled
|
|
|
|
### 5.2 Firewall & Network
|
|
- [ ] Firewall configured (allow 80, 443, deny all else)
|
|
- [ ] Rate limiting enabled
|
|
- [ ] DDoS protection active
|
|
- [ ] Database not publicly accessible
|
|
|
|
### 5.3 Application Security
|
|
- [ ] CORS configured for production domain only
|
|
- [ ] Helmet.js security headers enabled
|
|
- [ ] SQL injection protection (parameterized queries)
|
|
- [ ] XSS protection enabled
|
|
- [ ] CSRF protection enabled
|
|
|
|
### 5.4 Secrets Management
|
|
- [ ] Environment variables not in Git
|
|
- [ ] `.env` file has restricted permissions (600)
|
|
- [ ] Database credentials rotated
|
|
- [ ] API keys documented in secure location
|
|
|
|
**Status:** ☐ Complete
|
|
|
|
---
|
|
|
|
## 6. Testing
|
|
|
|
### 6.1 Test Webhook Endpoint
|
|
|
|
```bash
|
|
# Test webhook is accessible
|
|
curl -X POST https://yourdomain.com/webhooks/stripe \
|
|
-H "Content-Type: application/json" \
|
|
-d '{"test": true}'
|
|
|
|
# Should return 400 (no signature) - that's good!
|
|
# Should NOT return 404 or 500
|
|
```
|
|
|
|
### 6.2 Test Stripe Webhook (Stripe CLI)
|
|
|
|
```bash
|
|
# Install Stripe CLI
|
|
brew install stripe/stripe-cli/stripe
|
|
|
|
# Login
|
|
stripe login
|
|
|
|
# Forward events to production (for testing)
|
|
stripe listen --forward-to https://yourdomain.com/webhooks/stripe
|
|
```
|
|
|
|
### 6.3 Test Premium Upgrade Flow
|
|
|
|
**Using Browser:**
|
|
1. [ ] Go to `https://yourdomain.com/premium/upgrade`
|
|
2. [ ] Select "Premium" tier
|
|
3. [ ] Enter domain name
|
|
4. [ ] Check availability works
|
|
5. [ ] Enter test card: `4242 4242 4242 4242`
|
|
6. [ ] Complete subscription
|
|
7. [ ] Verify redirect to success page
|
|
8. [ ] Check Stripe dashboard for subscription
|
|
|
|
**Using API:**
|
|
```bash
|
|
# Get auth token first
|
|
TOKEN="your-jwt-token"
|
|
|
|
# Test domain availability
|
|
curl -X POST https://yourdomain.com/api/premium/domains/check-availability \
|
|
-H "Authorization: Bearer $TOKEN" \
|
|
-H "Content-Type: application/json" \
|
|
-d '{"domain": "testuser.aethex"}'
|
|
|
|
# Test subscription creation
|
|
curl -X POST https://yourdomain.com/api/premium/subscribe \
|
|
-H "Authorization: Bearer $TOKEN" \
|
|
-H "Content-Type: application/json" \
|
|
-d '{
|
|
"tier": "premium",
|
|
"paymentMethodId": "pm_card_visa",
|
|
"billingPeriod": "yearly"
|
|
}'
|
|
```
|
|
|
|
### 6.4 Verify Database Updates
|
|
|
|
```sql
|
|
-- Check subscription created
|
|
SELECT * FROM premium_subscriptions
|
|
WHERE user_id = 'test-user-id'
|
|
ORDER BY created_at DESC LIMIT 1;
|
|
|
|
-- Check user tier updated
|
|
SELECT id, email, premium_tier
|
|
FROM users
|
|
WHERE id = 'test-user-id';
|
|
|
|
-- Check payment logged
|
|
SELECT * FROM payment_transactions
|
|
ORDER BY created_at DESC LIMIT 5;
|
|
```
|
|
|
|
**Status:** ☐ Complete
|
|
|
|
---
|
|
|
|
## 7. Monitoring Setup
|
|
|
|
### 7.1 Application Monitoring
|
|
- [ ] Error tracking configured (Sentry, Rollbar, etc.)
|
|
- [ ] Log aggregation setup (Loggly, Papertrail, etc.)
|
|
- [ ] Uptime monitoring (Pingdom, UptimeRobot, etc.)
|
|
- [ ] Performance monitoring (New Relic, Datadog, etc.)
|
|
|
|
### 7.2 Stripe Monitoring
|
|
- [ ] Email notifications enabled in Stripe
|
|
- [ ] Failed payment alerts configured
|
|
- [ ] Revenue reports scheduled
|
|
|
|
### 7.3 Alerts
|
|
- [ ] Server down alerts
|
|
- [ ] Database connection errors
|
|
- [ ] Failed payment alerts
|
|
- [ ] High error rate alerts
|
|
- [ ] Disk space warnings
|
|
|
|
**Status:** ☐ Complete
|
|
|
|
---
|
|
|
|
## 8. Backup & Recovery
|
|
|
|
### 8.1 Database Backups
|
|
- [ ] Automated daily backups configured
|
|
- [ ] Backup retention policy set (30+ days)
|
|
- [ ] Backup restoration tested
|
|
- [ ] Off-site backup storage
|
|
|
|
### 8.2 Code Backups
|
|
- [ ] Git repository backed up
|
|
- [ ] Environment variables documented
|
|
- [ ] Configuration files backed up
|
|
|
|
### 8.3 Disaster Recovery Plan
|
|
- [ ] Recovery procedures documented
|
|
- [ ] RTO/RPO defined
|
|
- [ ] Failover tested
|
|
|
|
**Status:** ☐ Complete
|
|
|
|
---
|
|
|
|
## 9. Documentation
|
|
|
|
### 9.1 Internal Documentation
|
|
- [ ] Deployment procedures documented
|
|
- [ ] Rollback procedures documented
|
|
- [ ] Environment variables documented
|
|
- [ ] API endpoints documented
|
|
- [ ] Database schema documented
|
|
|
|
### 9.2 User Documentation
|
|
- [ ] Pricing page updated
|
|
- [ ] FAQ created
|
|
- [ ] Support documentation
|
|
- [ ] Terms of service updated
|
|
- [ ] Privacy policy updated
|
|
|
|
**Status:** ☐ Complete
|
|
|
|
---
|
|
|
|
## 10. Launch Checklist
|
|
|
|
### Pre-Launch
|
|
- [ ] All tests passing
|
|
- [ ] No errors in production logs
|
|
- [ ] Stripe test mode disabled
|
|
- [ ] Analytics tracking enabled
|
|
- [ ] Customer support ready
|
|
|
|
### Launch
|
|
- [ ] Announce premium features
|
|
- [ ] Monitor error rates
|
|
- [ ] Watch for failed payments
|
|
- [ ] Check webhook processing
|
|
- [ ] Monitor server load
|
|
|
|
### Post-Launch (First 24 Hours)
|
|
- [ ] Review error logs
|
|
- [ ] Check payment success rate
|
|
- [ ] Verify webhook sync
|
|
- [ ] Monitor user signups
|
|
- [ ] Track revenue
|
|
|
|
### Post-Launch (First Week)
|
|
- [ ] Analyze conversion rates
|
|
- [ ] Review customer feedback
|
|
- [ ] Fix any issues
|
|
- [ ] Optimize performance
|
|
- [ ] Plan improvements
|
|
|
|
**Status:** ☐ Complete
|
|
|
|
---
|
|
|
|
## 11. Rollback Plan
|
|
|
|
If issues occur, follow this rollback procedure:
|
|
|
|
### Immediate Rollback
|
|
```bash
|
|
# SSH to server
|
|
ssh user@server
|
|
|
|
# Stop services
|
|
pm2 stop aethex-connect
|
|
|
|
# Revert to previous version
|
|
git checkout <previous-commit-hash>
|
|
|
|
# Rollback database (if needed)
|
|
psql $DATABASE_URL -f rollback_006.sql
|
|
|
|
# Restart services
|
|
pm2 restart aethex-connect
|
|
```
|
|
|
|
### Database Rollback SQL
|
|
```sql
|
|
-- Drop Phase 6 tables (if needed)
|
|
DROP TABLE IF EXISTS payment_transactions CASCADE;
|
|
DROP TABLE IF EXISTS enterprise_team_members CASCADE;
|
|
DROP TABLE IF EXISTS usage_analytics CASCADE;
|
|
DROP TABLE IF EXISTS domain_transfers CASCADE;
|
|
DROP TABLE IF EXISTS enterprise_accounts CASCADE;
|
|
DROP TABLE IF EXISTS blockchain_domains CASCADE;
|
|
DROP TABLE IF EXISTS feature_limits CASCADE;
|
|
DROP TABLE IF EXISTS premium_subscriptions CASCADE;
|
|
|
|
-- Remove user column
|
|
ALTER TABLE users DROP COLUMN IF EXISTS premium_tier;
|
|
```
|
|
|
|
**Status:** ☐ Documented
|
|
|
|
---
|
|
|
|
## 12. Success Metrics
|
|
|
|
Track these metrics post-launch:
|
|
|
|
### Revenue Metrics
|
|
- [ ] Premium subscriptions created
|
|
- [ ] Enterprise accounts created
|
|
- [ ] Domain registrations
|
|
- [ ] Marketplace sales
|
|
- [ ] MRR (Monthly Recurring Revenue)
|
|
- [ ] ARR (Annual Recurring Revenue)
|
|
|
|
### Technical Metrics
|
|
- [ ] Uptime %
|
|
- [ ] API response times
|
|
- [ ] Failed payment rate
|
|
- [ ] Webhook success rate
|
|
- [ ] Error rate
|
|
|
|
### User Metrics
|
|
- [ ] Free to premium conversion %
|
|
- [ ] Premium to enterprise conversion %
|
|
- [ ] Churn rate
|
|
- [ ] Customer lifetime value
|
|
- [ ] Net promoter score
|
|
|
|
**Status:** ☐ Tracking
|
|
|
|
---
|
|
|
|
## 🎉 Deployment Complete!
|
|
|
|
Once all checkboxes are ✅, Phase 6 is live!
|
|
|
|
### Quick Verification Commands
|
|
|
|
```bash
|
|
# Check server health
|
|
curl https://yourdomain.com/health
|
|
|
|
# Check API
|
|
curl https://yourdomain.com/api/premium/marketplace
|
|
|
|
# Check webhook
|
|
stripe listen --forward-to https://yourdomain.com/webhooks/stripe
|
|
|
|
# Check database
|
|
psql $DATABASE_URL -c "SELECT COUNT(*) FROM premium_subscriptions;"
|
|
|
|
# Check logs
|
|
pm2 logs aethex-connect --lines 50
|
|
```
|
|
|
|
### Support Resources
|
|
|
|
- **Stripe Dashboard:** https://dashboard.stripe.com
|
|
- **Stripe Logs:** https://dashboard.stripe.com/logs
|
|
- **Server Logs:** `pm2 logs` or `/var/log/`
|
|
- **Database:** `psql $DATABASE_URL`
|
|
- **Documentation:** See PHASE6-COMPLETE.md
|
|
|
|
---
|
|
|
|
## 📞 Emergency Contacts
|
|
|
|
- **DevOps Lead:** name@company.com
|
|
- **Backend Lead:** name@company.com
|
|
- **Stripe Support:** https://support.stripe.com
|
|
- **Server Provider:** support link
|
|
|
|
---
|
|
|
|
**Last Updated:** January 10, 2026
|
|
**Version:** 1.0
|
|
**Status:** Ready for Production ✅
|