Zero Downtime Releases

Codesphere powerful and flexible setup allows for updating your services without any downtime. In this document we will explain how you can use Codesphere deploy updates with a few clicks and zero downtime for your users.

Getting started

Prerequisite for zero downtime deployments is setting up at least two workspaces running your application. Please follow the steps outlined in Staging Environments Documentation if you still need to set this up.
Also you will need to have a verified domain connected to Codesphere. Follow the Custom Domains Documentation if you still need to set this up.

Get the updates onto Codesphere

First make updates to your code or data like you would normally do, either in Codesphere directly (in the staging workspace!) or make changes locally and commit them to your GitHub branch.
Once the changes are committed to your repository, open the second workspace we created earlier, click the + icon to open a terminal and type git pull. You can perform any of the usual git commands here as well (i.e. switching remote branches, rolling back etc.). If your repository is private you will need to use a personal access token to authenticate (see GitHub Documentation if you need to set one up first).

Review changes

Make sure your application is running with the latest version of the code (i.e. running the build command or CI stage again) and open the Codesphere URL of this workspace. Test your changes as thoroughly as needed. Once you are confident that everything works as expected you can deploy the changes to production.

Zero downtime releases

Updating your production URL to use the latest version of the code you just tested in the Staging Environment can be done with a few clicks.
  1. 1.
    Navigate to the Domains tab
  2. 2.
    Click "Edit"
  3. 3.
    Switch the workspace currently running your production environment with the staging workspace
  4. 4.
    Click "Update"
Now your users will be instantly directed to the new application version.
What’s unique about this setup is that should you realize something is going wrong afterwards you can switch back to the old version just as easily by connecting the other workspace again. Switching involves literally zero downtime.