Upgrades
This guide covers upgrading Rack Gateway to new versions, including planning, execution, and rollback procedures.
Before Upgrading
Section titled “Before Upgrading”Check Release Notes
Section titled “Check Release Notes”Always review the release notes for breaking changes:
- Visit the GitHub Releases
- Read all releases between your current and target version
- Note any breaking changes or migration requirements
Verify Current Version
Section titled “Verify Current Version”# Check deployed versionconvox ps -a rack-gateway | head -5
# Or via APIcurl https://gateway.example.com/api/v1/healthBackup Database
Section titled “Backup Database”Create a backup before upgrading:
# RDS snapshot (AWS)aws rds create-db-snapshot \ --db-instance-identifier rack-gateway-prod \ --db-snapshot-identifier rack-gateway-pre-upgrade-$(date +%Y%m%d)
# Or manual backuppg_dump $DATABASE_URL > backup_pre_upgrade.sqlUpgrade Procedures
Section titled “Upgrade Procedures”Convox Deployment
Section titled “Convox Deployment”-
Update the image tag
Edit
convox.yml:services:gateway:image: docker.io/docspringcom/rack-gateway:v1.2.0 -
Review environment changes
Check if new environment variables are required:
Terminal window # Compare current env with docsconvox env -a rack-gateway -
Deploy
Terminal window convox deploy -a rack-gateway -
Verify deployment
Terminal window # Check healthcurl https://gateway.example.com/api/v1/health# Check logs for errorsconvox logs -a rack-gateway --since 5m
Docker Deployment
Section titled “Docker Deployment”-
Pull new image
Terminal window docker pull docker.io/docspringcom/rack-gateway:v1.2.0 -
Stop current container
Terminal window docker-compose down -
Update docker-compose.yml
services:gateway:image: docker.io/docspringcom/rack-gateway:v1.2.0 -
Run migrations
Terminal window docker-compose run --rm gateway rack-gateway-api migrate -
Start new version
Terminal window docker-compose up -d -
Verify
Terminal window curl http://localhost:8080/api/v1/healthdocker-compose logs -f
Kubernetes Deployment
Section titled “Kubernetes Deployment”-
Update deployment
apiVersion: apps/v1kind: Deploymentspec:template:spec:containers:- name: gatewayimage: docker.io/docspringcom/rack-gateway:v1.2.0 -
Apply migration job
Terminal window kubectl apply -f migration-job.yamlkubectl wait --for=condition=complete job/rack-gateway-migrate -
Roll out deployment
Terminal window kubectl apply -f deployment.yamlkubectl rollout status deployment/rack-gateway -
Verify
Terminal window kubectl get pods -l app=rack-gatewaykubectl logs -l app=rack-gateway --tail=100
Zero-Downtime Upgrades
Section titled “Zero-Downtime Upgrades”For high-availability deployments:
Prerequisites
Section titled “Prerequisites”- At least 2 gateway instances
- Load balancer with health checks
- Rolling deployment strategy
Procedure
Section titled “Procedure”Convox Rolling Deployment
Section titled “Convox Rolling Deployment”Convox handles this automatically with proper configuration:
services: gateway: scale: count: 3 deployment: minimum: 2 # Keep 2 running during deployDatabase Migrations
Section titled “Database Migrations”Migrations run automatically or can be run manually:
Automatic (Recommended)
Section titled “Automatic (Recommended)”Configure the gateway to run migrations on startup:
# Migrations run before server starts# This is the default behaviorManual
Section titled “Manual”For more control, run migrations separately:
# Run migration jobconvox run gateway rack-gateway migrate
# Then deployconvox deployRollback Migrations
Section titled “Rollback Migrations”- Restore from backup if needed
- Deploy the previous version
- Migrations are forward-only; previous versions must be compatible
Rollback Procedures
Section titled “Rollback Procedures”Quick Rollback (Convox)
Section titled “Quick Rollback (Convox)”# List previous releasesconvox releases -a rack-gateway
# Rollback to previous releaseconvox releases rollback RELEASE_ID -a rack-gatewayImage Rollback
Section titled “Image Rollback”# Update to previous imageconvox env set IMAGE_TAG=v1.1.0 -a rack-gatewayconvox deploy -a rack-gatewayDatabase Rollback
Section titled “Database Rollback”If a migration caused issues:
- Stop the gateway
- Restore database from backup
- Deploy previous version
# Stop gatewayconvox scale gateway --count 0 -a rack-gateway
# Restore database (example for RDS)aws rds restore-db-instance-from-db-snapshot \ --db-instance-identifier rack-gateway-restored \ --db-snapshot-identifier rack-gateway-pre-upgrade-20240115
# Update DATABASE_URL to point to restored instance# Deploy previous versionVersion Compatibility
Section titled “Version Compatibility”API Compatibility
Section titled “API Compatibility”Rack Gateway maintains backward compatibility within major versions:
| Version Range | Compatibility |
|---|---|
| v1.x → v1.y | API compatible |
| v1.x → v2.x | Check migration guide |
CLI Compatibility
Section titled “CLI Compatibility”The CLI should match the gateway major version:
| Gateway | CLI | Compatible |
|---|---|---|
| v1.2.0 | v1.0.0 | Yes |
| v1.2.0 | v2.0.0 | Check release notes |
Database Compatibility
Section titled “Database Compatibility”Database migrations are additive within major versions. Rollback requires:
- Previous version must be able to read new schema
- Or restore from backup
Upgrade Checklist
Section titled “Upgrade Checklist”Before upgrading:
- Read release notes for all versions
- Backup database
- Note any new required environment variables
- Schedule maintenance window (if not zero-downtime)
- Notify users of potential brief interruption
After upgrading:
- Verify health endpoints
- Check application logs for errors
- Test critical functionality (login, deploy)
- Monitor error rates for 24 hours
- Update documentation with new version
Troubleshooting Upgrades
Section titled “Troubleshooting Upgrades”Upgrade Stuck
Section titled “Upgrade Stuck”# Check pod/container statusconvox ps -a rack-gateway
# Check eventsconvox logs -a rack-gateway --since 5mHealth Check Failing
Section titled “Health Check Failing”# Test health endpoint directlyconvox run gateway -- curl localhost:8443/api/v1/health
# Check startup logsconvox logs -a rack-gateway | grep -i "start\|error"Database Migration Error
Section titled “Database Migration Error”# Check migration statusconvox run gateway -- rack-gateway migrate --dry-run
# View detailed errorconvox run gateway -- rack-gateway migrate --verboseFurther Reading
Section titled “Further Reading”- Database Maintenance - Backup and restore procedures
- Monitoring - Verify upgrade success
- Troubleshooting - Resolve upgrade issues