You can implement zero-downtime patching by maintaining two versions of your game image. For example, one might be named Image A, and the other Image B. At any point, you’ll have one version live while you’re updating the other. Once you’re ready to deploy the updated image version, you’ll switch the live game version by switching your fleet to the profile associated with the updated build. Once the profile switch completes, Image B will be live in production, while Build A is ready for the next update.
Zero-downtime patching is possible because profiles and game versions are tightly coupled. In the above scenario, the Image A image version would have a profile named Image A, and the Image B image version would have a profile named Image B. When you want to switch your active image to Image B, all you need to do is call the Fleet Profile Switch endpoint. Once you’ve started the switch, you can check the switch status by calling the Fleet Profile Switch Status endpoint.
Zero downtime patching requirements
There are a few prerequisites for implementing zero-downtime patching. First, you must create a mirror profile and game image version pairing for each of your existing pairings. For example, if you have a branch for production, development, and staging, you’ll have two profiles for production, two profiles for development, and two profiles for staging.
Zero downtime patching workflow
Apart from the prerequisites, the zero downtime patching workflow is like the process for updating via the CLI, with the addition of the Fleet Profile Switch step. The flow comprises four primary steps:
-
Create an image update on your build machine.
-
Create a difference analysis from the update.
-
Create a new image version from the difference analysis results.
-
Switch your fleet profile to the profile associated with the game image version you updated.
We highly recommend that you test your game image on your build machine before proceeding from step one to step two.
Step 1. Deploy the update to your build machine
Once you've prepared the updated game image by uploading it to your Steam bucket, Google Cloud bucket, or AWS bucket, you’re ready to deploy the updated game image to your build machine. Deploy the updated game image to your build machine with the Image Create Update endpoint.
Check the status of the Image Create Update job with the Image Update Status endpoint. If the status returns a failed state, troubleshoot the cause of the failure, then use the Image Update Retry endpoint to retry the update.
Once the Image Update Status confirms that the update completed successfully, test the updated game image on your build machine. We recommend that you test the updated game image on your build machine before continuing any further. This way, if there’s anything wrong with the image, you’ll catch it before deploying it to the rest of your infrastructure.
Step 2. Create a difference analysis
After you’ve confirmed that the updated game image works correctly on your build machine, create a difference analysis (also called a diff analysis) from the updated image with the Image Diff Create endpoint.
Check the status of the diff analysis with the Image Diff Status endpoint. If the diff analysis failed, you can retry the diff analysis with the Image Diff Retry endpoint.
Once the diff analysis completes successfully, you can reject the diff analysis with the Image Diff Reject endpoint or create a new image version from the diff analysis with the Image Version Create endpoint.
Check the diff analysis status |
After sending the request to create the diff analysis, you can use the Image Diff Status endpoint to check the current status of the diff analysis job. |
|
Reject the diff analysis |
Reject the results of the diff analysis if it contains any unexpected changes. After you reject the diff analysis by the unique diff ID, you can generate a new diff analysis. If you attempt to generate another diff analysis from the same game image before rejecting or accepting the outstanding diff analysis, you will receive an error stating that the image is locked by the diff ID XXXX. |
|
Retry the diff analysis |
If the diff analysis failed, troubleshoot the failure, then retry the diff analysis |
|
Create a new image version from the diff analysis |
Creating a new image version from a diff analysis is the same as accepting the results of the diff analysis. |
Step 3. Deploy the update to your fleet machines
Once you’ve accepted the diff analysis by calling the Image Version Create endpoint with the diff ID, you can check on the status of the Image Version Create job with the Image Version Status endpoint.
The statuses (job states) of the Image Version Status endpoint are described in the table below.
1 |
Created (new job) |
2 |
Pending (waiting to be queued) |
3 |
Queued (waiting to be processed) |
4 |
Running (in process) |
5 |
Completed (successful) |
6 |
Failed (unsuccessful) |
Step 4. Switch the fleet profile
After the result of the Image Version Status endpoint confirms that the image version is ready, switch your start allocating servers with the Server Allocate endpoint with the Profile ID that’s associated with the updated game version. The response body should contain a success message and the Profile ID that you supplied in the request body.
Reservation based fleets
For reservation based fleets, you must call the Fleet Profile Switch endpoint to switch to the updated game version.
After the result of the Image Version Status endpoint confirms that the image version is ready, switch your Fleet Profile to the Profile that’s tied with the image version you updated with the Fleet Profile Switch endpoint.
Check the status of the Fleet Profile Switch job with the Fleet Profile Status endpoint. Once the return body contains a success message, the process is complete. If you encounter any problems or error messages, contact the Customer Success team.