Production Deployment Checklist - nself-org/nchat GitHub Wiki
Use this checklist before deploying nself-chat to production.
-
All required variables are set:
-
NEXT_PUBLIC_GRAPHQL_URL(production URL, not localhost) -
NEXT_PUBLIC_AUTH_URL(production URL, not localhost) -
NEXT_PUBLIC_STORAGE_URL(production URL, not localhost) -
HASURA_ADMIN_SECRET(minimum 32 characters) -
JWT_SECRET(minimum 32 characters)
-
-
Run validation script:
pnpm validate:env:prod
-
Development auth is disabled:
NEXT_PUBLIC_USE_DEV_AUTH=false
-
Strong secrets are generated (use openssl):
openssl rand -base64 48
-
Secrets are stored securely (not in code):
- Platform environment variables
- Secret management service (AWS Secrets Manager, etc.)
- Kubernetes Secrets
-
No localhost patterns in URLs:
- ❌
localhost - ❌
127.0.0.1 - ❌
0.0.0.0 - ❌
.local - ❌
host.docker.internal
- ❌
-
All URLs use HTTPS (not HTTP):
- ✓
https://graphql.example.com/v1/graphql - ✓
https://auth.example.com/v1/auth - ✓
https://storage.example.com/v1/storage
- ✓
-
TypeScript compiles without errors:
pnpm type-check
-
Build succeeds:
pnpm build
-
No console errors or warnings
-
All tests pass:
pnpm test -
E2E tests pass (if applicable):
pnpm test:e2e
-
Manual testing in staging environment
# Set environment variables
vercel env add NEXT_PUBLIC_GRAPHQL_URL production
vercel env add NEXT_PUBLIC_AUTH_URL production
vercel env add NEXT_PUBLIC_STORAGE_URL production
vercel env add HASURA_ADMIN_SECRET production
vercel env add JWT_SECRET production
vercel env add NEXT_PUBLIC_USE_DEV_AUTH production
# Deploy
vercel --prod# Deploy with environment variables
netlify deploy --prod# Build image
docker build -t nself-chat:latest .
# Run with environment file
docker run --env-file .env.production -p 3000:3000 nself-chat:latest# Apply configuration
kubectl apply -f deploy/k8s/configmap.yaml
kubectl apply -f deploy/k8s/secrets.yaml
kubectl apply -f deploy/k8s/deployment.yaml
# Verify deployment
kubectl rollout status deployment/nchat- Application loads successfully
- Authentication works
- Database connections established
- Storage is accessible
- Real-time features working
- Error tracking configured (Sentry, etc.)
- Analytics enabled
- Logging configured
- Alerts set up
- SSL/TLS certificate valid
- CORS configured correctly
- Rate limiting enabled
- Security headers configured
- No sensitive data in logs
- Page load times acceptable
- Database queries optimized
- CDN configured for static assets
- Caching configured
If deployment fails:
-
Immediate Rollback:
# Vercel vercel rollback # Netlify netlify sites:list-deploys netlify deploy --site-id=<site-id> --prod --alias=production # Kubernetes kubectl rollout undo deployment/nchat
-
Investigate Issues:
- Check deployment logs
- Review error tracking
- Test in staging environment
-
Fix and Redeploy:
- Address root cause
- Run validation again
- Deploy to staging first
- Deploy to production
Solution:
# Verify all required variables are set
pnpm validate:env:prodSolution:
# Update URLs to production endpoints
NEXT_PUBLIC_GRAPHQL_URL=https://api.example.com/v1/graphql
NEXT_PUBLIC_AUTH_URL=https://auth.example.com/v1/auth
NEXT_PUBLIC_STORAGE_URL=https://storage.example.com/v1/storageSolution:
# Generate a secure secret
openssl rand -base64 48Solution:
# Disable development auth
NEXT_PUBLIC_USE_DEV_AUTH=false-
Rotate Secrets Regularly
- JWT secrets every 90 days
- Database passwords every 6 months
- API keys as needed
-
Use Environment-Specific Secrets
- Never reuse production secrets in staging/dev
- Generate unique secrets per environment
-
Secret Management
- Use a secret management service
- Never commit secrets to version control
- Use encrypted storage for backups
-
Access Control
- Limit who can access production secrets
- Use role-based access control (RBAC)
- Enable audit logging
# Basic validation
pnpm validate:env
# Production validation (strict)
pnpm validate:env:prod
# With custom environment
NODE_ENV=production NEXT_PUBLIC_ENV=production pnpm validate:env:prod
# Test validation script
./scripts/test-prod-validation.sh- DevOps Lead: [contact]
- Security Team: [contact]
- On-call Engineer: [contact]
- Platform Support: [platform support]
Last Updated: 2025-01-29 Version: 1.0.0