Rolling deploys with Docker Compose

With Docker Compose on Triton's Elastic Docker Host, you can provide uninterrupted service to your users when updating your application. This includes making changes to the application itself, as well as scaling the number of instances up and down. As long as you have more than one instance running, you can make changes to your application without a hitch.

Docker Compose helps manage your application's lifecyle. On Triton, triton-compose ensures you're using a known good, tested version of Docker Compose.

Watch the video

Watch to learn how to deploy changes to your applications with no downtime, thanks to Docker Compose.

Video transcript

The best way to manage containers running Docker images is with Docker Compose. With the help of the Triton Docker CLI, you will be sure to use tested versions of Compose configured to work with the Triton Elastic Docker Host.

That means when on Triton, instead of the command docker-compose, you’ll use triton-compose. Otherwise, the process is exactly the same.

All it takes is a simple configuration file. Once your instances are up and running, with a simple command you can scale your application up and down, deploy changes, and much more, and your users won’t be affected.

Let’s take a look at a simple, single-service web application. As you can see, a service called nginx is declared with an image, ports, a memory limit, and a CNS service label.

I can easily spin up my application with triton-compose up and scale to as many instances as necessary. Later on, you’ll learn why you want more than one instance running when updating your application.

Let’s take a look at the application. What if I decide I want to change the way it looks?

With triton-compose, I can make those changes, push the new image to Docker Hub, and update the application in the background so that my users don’t experience any downtime.

I’m going to change the background image of my Hello World website to another image. I’ve already got a new image in the images folder, and I’ll make the change to my CSS file.

Now that my changes have been made to the application, I have to update the Docker image. In my local Docker environment, I’m going to build and push the updated image.

I’ll run triton-compose up -d again to update the application. The -d property makes sure the container starts and runs in the background, so you can continue to use the terminal for other commands.

With triton instance get I can find the DNS name of my application, and pull it up in the browser to see my changes in action. It may take a moment to see those changes happen.

Remember earlier that I had scaled to 3 instances? The changes are enacted one at a time, so that other instances remain unaffected. As long as you have more than one instance of your services running, users won’t experience any interruptions while changes are being enacted.

Scaling works the same way. triton-compose scales my application across the data center. And when I scale up to 5 instances of my hello world application, at no point will users experience downtime.

There’s no better way to ensure your users have the best experience with maximum uptime, than by using Docker Compose.

Post written by Alexandra White