In part 11 of our twelve-part DevOps series, we explore why keeping your environments as close to identical as possible is crucial.
Factor 11: Maintain parity
Keeping all of your environments, including those local to the developers’ workstations, as close to identical as possible is crucial to optimal DevOps practices. Although the compute and storage resources available across environments may vary, the backing applications and services should not.
Developers are tempted to use lightweight services like SQLite or an in-memory cache for local work because they’re perceived as quick and simple to set up, despite production using PostgreSQL and Memcached. This is not a valid excuse anymore. Tools like Terraform, Ansible, Puppet, Vagrant, Minikube, and Docker make standing up a local environment that almost perfectly mirrors production fast and relatively simple, and their overall cost and learning curves are low to modest.
- Terraform lets you provision and configure most resources, including message busses and databases.
- Ansible and Puppet can be used for configuration management, ensuring necessary developer tools and services are present and all on the same version, as well as deploying the working applications.
- Vagrant is useful for creating developer VMs with the required software pre-installed.
- Minikube and Docker provide runtime environments for containerized applications and their backing services which are identical to the live environment Kubernetes or Docker orchestrators.
Do not run different services locally. Over time, the numerous but subtle differences and inconsistencies add up, and you slow down the build and deploy process by needing to troubleshoot. The code that worked perfectly on the developer’s laptop does not work in staging. Ultimately this drives teams away from continuous integration and deployment.
Parity must also be maintained when moving through live environments. Your staging, QA, and production environments must also mirror each other to avoid breakage. This means keeping the same number of nodes (if different in terms of compute), the same types & versions of backing services. Again, tools like Terraform, and Cloud Formation, and Azure Resource Manager templates should be used to define your infrastructure and reinforce consistency across environments.
Keeping your resources up-to-date to stay compliant with your organization’s governance and security requirements will introduce some variation in the overall patch level across environments, but that’s okay. The automated tests you put in place earlier will help you quickly detect and remediate any problems that arise and shorten the window to updating production, restoring parity. And because you’ve built fault-tolerance in and automated your processes, you should be able to perform these operations with zero downtime and no-to-minimal impact.
Setting up and enforcing parity is a relatively time-consuming task, but it’s one where the effort is largely front-loaded. Once in place, you’ll find that the benefits you reap from it in terms of successful deployments, reduced outages, and simplified maintenance more than make up for the initial outlay.