Upgrade Process
Upgrading your self-hosted environment ensures that you are running the latest version of the application with all the latest features, bug fixes, and security updates. Follow these steps carefully to minimize downtime and ensure a smooth upgrade.
Download the Latest Version from ECR:
- Use your AWS credentials to log in to the Elastic Container Registry (ECR) and pull the latest Docker images.
- Example commands:
export AWS_ACCESS_KEY_ID=[your access key id] export AWS_SECRET_ACCESS_KEY=[your access secret key] # Log into the ECR repository aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin 025066246552.dkr.ecr.us-east-1.amazonaws.com # Pull the latest version of the image docker pull 025066246552.dkr.ecr.us-east-1.amazonaws.com/rustici-generator:[latest version]
Run the Upgrade Command Within the New Container:
- Within containers running the image you just downloaded, run the following commands to apply any necessary schema changes:
./upgrade_schema.sh
- You can do this with either
docker exec
(after spinning up a container with the new image) ordocker run --rm
to create a new container just for this command. - Example
docker run --rm
commands:docker run --rm --env-file .env 025066246552.dkr.ecr.us-east-1.amazonaws.com/rustici-generator:[latest version] ./upgrade_schema.sh
- Example
docker exec
commands:docker exec [backend container name] ./upgrade_schema.sh
- We strive to ensure these upgrades are blue-green compatible within maintenance releases, but refer to the release notes to confirm there aren’t any special considerations for the version you’re deploying.
- Even if you’re running more than one container for the API and/or worker stack, each of these commands only needs to be run once.
- Running the upgrade more than once won’t cause any problems, it’s just not necessary.
- Within containers running the image you just downloaded, run the following commands to apply any necessary schema changes:
Spin Up New Containers:
- Start new containers using the latest image. Ensure that the environment variables and configurations match your current setup.
Introduce New Container(s) into the Load Balancer:
- Update your load balancer configuration to include the new containers. This allows traffic to be routed to the upgraded containers while keeping the old ones active as a fallback during the transition.
Remove Old Containers from the Load Balancer:
- Once the new containers are confirmed to be functioning correctly, remove the old containers from the load balancer to stop routing traffic to them.
Destroy the Old Containers:
- After confirming that the new containers are fully operational and handling all traffic, stop and remove the old containers to free up resources.
Verify the Upgrade:
- Test the application to ensure that all services are functioning as expected. Use the
/api/v1/health/check_up
endpoint to verify the health of the API and its connections to other services.
- Test the application to ensure that all services are functioning as expected. Use the
Monitor the System:
- Monitor the upgraded environment for any issues. Check logs, metrics, and alerts to ensure the system is stable and performing as expected.