Skip to content

Upgrades

This guide covers upgrading Rack Gateway to new versions, including planning, execution, and rollback procedures.

Always review the release notes for breaking changes:

  1. Visit the GitHub Releases
  2. Read all releases between your current and target version
  3. Note any breaking changes or migration requirements
Terminal window
# Check deployed version
convox ps -a rack-gateway | head -5
# Or via API
curl https://gateway.example.com/api/v1/health

Create a backup before upgrading:

Terminal window
# 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 backup
pg_dump $DATABASE_URL > backup_pre_upgrade.sql
  1. Update the image tag

    Edit convox.yml:

    services:
    gateway:
    image: docker.io/docspringcom/rack-gateway:v1.2.0
  2. Review environment changes

    Check if new environment variables are required:

    Terminal window
    # Compare current env with docs
    convox env -a rack-gateway
  3. Deploy

    Terminal window
    convox deploy -a rack-gateway
  4. Verify deployment

    Terminal window
    # Check health
    curl https://gateway.example.com/api/v1/health
    # Check logs for errors
    convox logs -a rack-gateway --since 5m
  1. Pull new image

    Terminal window
    docker pull docker.io/docspringcom/rack-gateway:v1.2.0
  2. Stop current container

    Terminal window
    docker-compose down
  3. Update docker-compose.yml

    services:
    gateway:
    image: docker.io/docspringcom/rack-gateway:v1.2.0
  4. Run migrations

    Terminal window
    docker-compose run --rm gateway rack-gateway-api migrate
  5. Start new version

    Terminal window
    docker-compose up -d
  6. Verify

    Terminal window
    curl http://localhost:8080/api/v1/health
    docker-compose logs -f
  1. Update deployment

    apiVersion: apps/v1
    kind: Deployment
    spec:
    template:
    spec:
    containers:
    - name: gateway
    image: docker.io/docspringcom/rack-gateway:v1.2.0
  2. Apply migration job

    Terminal window
    kubectl apply -f migration-job.yaml
    kubectl wait --for=condition=complete job/rack-gateway-migrate
  3. Roll out deployment

    Terminal window
    kubectl apply -f deployment.yaml
    kubectl rollout status deployment/rack-gateway
  4. Verify

    Terminal window
    kubectl get pods -l app=rack-gateway
    kubectl logs -l app=rack-gateway --tail=100

For high-availability deployments:

  • At least 2 gateway instances
  • Load balancer with health checks
  • Rolling deployment strategy

Convox handles this automatically with proper configuration:

services:
gateway:
scale:
count: 3
deployment:
minimum: 2 # Keep 2 running during deploy

Migrations run automatically or can be run manually:

Configure the gateway to run migrations on startup:

Terminal window
# Migrations run before server starts
# This is the default behavior

For more control, run migrations separately:

Terminal window
# Run migration job
convox run gateway rack-gateway migrate
# Then deploy
convox deploy
  1. Restore from backup if needed
  2. Deploy the previous version
  3. Migrations are forward-only; previous versions must be compatible
Terminal window
# List previous releases
convox releases -a rack-gateway
# Rollback to previous release
convox releases rollback RELEASE_ID -a rack-gateway
Terminal window
# Update to previous image
convox env set IMAGE_TAG=v1.1.0 -a rack-gateway
convox deploy -a rack-gateway

If a migration caused issues:

  1. Stop the gateway
  2. Restore database from backup
  3. Deploy previous version
Terminal window
# Stop gateway
convox 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 version

Rack Gateway maintains backward compatibility within major versions:

Version RangeCompatibility
v1.x → v1.yAPI compatible
v1.x → v2.xCheck migration guide

The CLI should match the gateway major version:

GatewayCLICompatible
v1.2.0v1.0.0Yes
v1.2.0v2.0.0Check release notes

Database migrations are additive within major versions. Rollback requires:

  1. Previous version must be able to read new schema
  2. Or restore from backup

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
Terminal window
# Check pod/container status
convox ps -a rack-gateway
# Check events
convox logs -a rack-gateway --since 5m
Terminal window
# Test health endpoint directly
convox run gateway -- curl localhost:8443/api/v1/health
# Check startup logs
convox logs -a rack-gateway | grep -i "start\|error"
Terminal window
# Check migration status
convox run gateway -- rack-gateway migrate --dry-run
# View detailed error
convox run gateway -- rack-gateway migrate --verbose