Successful Automated Deployments
Automated deployments can ensure the deployment process is documented, a human didn’t forget a step, and you can roll back if something goes wrong. Your deployment code can check if a folder has the right permissions and replace a value in a configuration file. Using tools such as Terraform, Ansible, Jenkins, and YAML allows you to write your deployment process as code, store it in source control, and test it. When the actual act of deployment is closer to the click of a button than a three-hour manual ordeal, you can deploy small batches of changes more frequently. It also makes it easier to test deployments in a staging or pre-production environment before they go to production.Gates and Approvals
Many deployment automation tools allow you to build gates and approvals into your process. Gates can be used to require approvals outside the deployment pipeline, perform quality validation such as code coverage or test pass rate, and collect health signals from external services before the deployment can be completed.Automated Rollback
Another critical part of successful automated deployments is a rollback strategy. The use of feature flags and blue-green deployments can make it easy to roll back to the previous state instead of having to take frantic manual steps to undo a change. Feature flags allow you to separate deployment and release, which helps roll out new features for a subset of users. After monitoring shows the new features are successful, you can then roll out them to more users and monitor again, until all users have the new features. If a feature causes problems in the limited rollout, it can simply be turned off instead of requiring a rollback of code. In a blue-green deployment, you deploy to a separate production environment and then swap it with the current production environment, allowing you to swap back if issues are encountered.Monitoring
Automated deployments should be accompanied by automated monitoring. In a data-driven application, you should watch for changes in system metrics such as:- Memory usage
- Disk usage
- Errors logged
- Database throughput
- Database average response time
- Long running queries
- Concurrent database connections
- SQL query performance
Tools, Process, and Culture
While deployment and monitoring tools alone don’t ensure a successful deployment, they certainly help. But it’s also important to build a DevOps culture of good communication, design reviews throughout development, and thorough testing. As shown in Figure 1, automated deployments are just one part of the DevOps lifecycle.Figure 1: The DevOps lifecycle
You can decide where automation brings value in the cycle and create the automation in small chunks over time. Automated deployments can reduce risk and required effort, so you can deploy on a Friday if you need to. Their high ROI often makes them a great place to start automating with DevOps best practices in mind.