Here at Caylent, we believe one of the major keys to successful DevOps implementation is the complete automation of Continuous Delivery (CD) and Continuous Deployment. Achieving full CD with your IT team unlocks many of the benefits that the DevOps ecosystem has to offer and ensures that you release code swiftly and with fewer errors.

Supported by the findings in the 2017 State of DevOps report, with the combined power of CD and DevOps high-performing IT teams can deploy code 46X more frequently than low-performing ones. Furthermore, you gain:

Meantime to recover: 24X faster

2555X faster Lead time: From starting code to delivery

Considerably lower failure rate: Just 0-15% rather than 31-45%

If you’re looking for ways to integrate DevOps into your organization, give Caylent a try here.

Why Continuous Delivery?

CD aims to significantly reduce your risk level by enabling deployment of small, high-quality batches of code quickly and sustainably. The concept works in line with Continuous Integration, which focuses on helping your team prepare for deployment with ease.

A very interesting theory to note is that CD has also been demonstrated to positively impact the level of happiness and engagement of your team.

Put simply, a better work process = high-quality code = high-quality products = happy customers = happy IT team.

Continuous Delivery Vs. Continuous Deployment

The difference between the two is minimal, and often, the terms are used interchangeably; the variation only comes in at staging or pre-production with a manual acceptance test for Continuous Delivery. At this point, the product owner will manually merge and push the code to production.

How Docker Improves CD

Docker gives us the ability to build and distribute immutable artifacts so that we can retain the exact same build artifact through testing, pre-production, and production. In comparison to Chef, Puppet or other general server builders, Docker allows users to build first then push to servers, whereas Chef and Puppet users must build and modify the servers in real time. Once built, Docker allows you to move an artifact through the pipeline intact.

This advantage improves the artifact’s robustness and reduces the risk of failures and blockages in the production pipeline. Building an immutable artifact once also allows us to test the image repeatedly via local, QA, staging, and production environments. Rollbacks occur in seconds rather than minutes, and deployments are fast and straightforward. Finally, Docker further decouples server config from application deployment.

The 5 Steps

Caylent’s best practices when it comes to using Docker to empower CD can be broken down into these 5 steps:

1

Where possible, build your packages once and once only. Then move your immutable artifact through your CD pipeline to test it from one repository to the next. As it migrates through the pipeline, leverage Docker’s tagging system to promote your image and gain the most stability for deployment.

2

Decouple your code, database migrations, and infrastructure changes to independent pushes. Keep them separate and your code chunks as small as possible.

3

Run your deployment types in the exact same manner in each environment, and in at least one environment that’s an identical mirror of production. Use the environment parameters and secrets within Docker to pass environment variables at run time without drastically changing your artifact. Consider changes to these as Infrastructure-level change.

4

Run tests as part of the container build process and automate the testing of all your deployments. Aim to combine builds and tests together to keep the log files intact and easy to decipher. If a build fails it will remain in the loop, rather than being promoted to the next environment.

5

Keep your stacks and environments similar. If you’re running massive web stacks on your production site, this may be difficult in development and staging, but things like your content delivery network (CDN), proxies, and caches should all be replicated in staging.

While Docker makes it easy to deploy code using CD, it’s important to follow these best practices to build, test and deploy correctly, rather than falling into bad habits.

In next week’s blog, we’ll cover the four main deployment types for Continuous Delivery with Docker. Click here for Docker and Continuous Delivery Deployment Types

Caylent provides a critical DevOps-as-a-Service function to high growth companies looking for expert support with microservices, containers, cloud infrastructure, and CI/CD deployments. Our managed and consulting services are a more cost-effective option than hiring in-house, and we scale as your team and company grow. Check out some of the use cases, learn how we work with clients, and profit from our DevOps-as-a-Service offering too.