deployment
Guide for deployment
Deployment Runbook - Legends of Hastinapur
Pre-Deployment Checklist
- All tests passing in CI (
cargo test,cargo audit) - Code reviewed and approved
- Database migrations tested in staging
- Release notes prepared
- Monitoring dashboards configured
- Rollback plan reviewed
- On-call engineer identified
- Maintenance window communicated (if needed)
Deployment Steps
Staging Deployment
- Merge to staging branch
git checkout staging git merge main git push origin staging - Deploy to staging server
ssh loh-staging cd /opt/loh-backend git pull origin staging cargo build --release sudo systemctl restart loh-backend - Run smoke tests
# Test authentication curl -X POST https://staging.loh.game/api/auth/login \ -d '{"username":"test","password":"test123"}' # Test WebSocket connection wscat -c wss://staging.loh.game/ws # Check health endpoint curl https://staging.loh.game/health - Monitor for 30 minutes
- Check Sentry for errors
- Review server metrics (CPU, memory, connections)
- Verify no spike in error rates
Production Deployment
Deployment Window: Off-peak hours (2 AM - 4 AM UTC)
- Create release tag
git tag -a v1.2.3 -m "Release v1.2.3" git push origin v1.2.3 - Enable maintenance mode (optional)
ssh loh-prod sudo touch /var/www/maintenance.flag - Backup database
# Automatic backup via cron, but verify pg_dump loh_production > /backups/loh_prod_$(date +%Y%m%d_%H%M%S).sql - Deploy application
ssh loh-prod cd /opt/loh-backend git fetch --tags git checkout v1.2.3 cargo build --release - Run database migrations
diesel migration run --database-url=$DATABASE_URL - Restart services
sudo systemctl restart loh-backend sudo systemctl restart loh-game-server - Disable maintenance mode
sudo rm /var/www/maintenance.flag
Post-Deployment Verification
Health Checks
# Backend health
curl https://api.loh.game/health
# WebSocket health
wscat -c wss://game.loh.game/ws
# Database connectivity
psql -h localhost -U loh_user -d loh_production -c "SELECT 1;"Smoke Tests
- Authentication Flow
- Create new account
- Login
- Logout
- Game Connection
- Connect to game server
- Send player movement
- Verify server response
- Core Features
- Inventory operations
- Combat encounter
- Quest progress
Monitoring (First Hour)
- Metrics to watch:
- Error rate < 0.1%
- Response time p95 < 200ms
- WebSocket connections stable
- CPU usage < 70%
- Memory usage < 80%
- Dashboards:
- Grafana: https://metrics.loh.game
- Sentry: https://sentry.io/loh
- Cloudflare Analytics
Rollback Trigger Criteria
Rollback immediately if:
- Error rate > 5%
- Critical feature broken
- Database corruption detected
- Security vulnerability discovered
See: Rollback Procedures
Communication
Deployment Announcement (Discord/Twitter)
š Deployment in progress
Version: v1.2.3
Expected downtime: 5-10 minutes
We'll notify once complete.Deployment Complete
ā
Deployment successful!
Version: v1.2.3 is now live
New features: [LINK TO RELEASE NOTES]
Thank you for your patience!Common Issues & Solutions
Issue: Service won't start
# Check logs
sudo journalctl -u loh-backend -n 100
# Common causes:
# - Port already in use
sudo lsof -i :3000
# - Database connection failed
psql -h localhost -U loh_user -d loh_productionIssue: High error rate post-deployment
#fast rollback
git checkout v1.2.2
cargo build --release
sudo systemctl restart loh-backendEmergency Contacts
- On-Call Engineer: PagerDuty
- DevOps Lead: @devops on Slack
- CTO: Direct phone (P0 incidents only)