IaC Big Picture
Software delivery involves running code on production servers to deliver the application to users. Automating the software delivery process is crucial for efficiency and reliability. Infrastructure as Code (IaC) is the practice of writing and executing code to define, deploy, update and destroy infrastructure, including servers, databases and networks.
Configuration Management Tools
Configuration management tools like Chef, Puppet and Ansible are used to install and manage software on existing servers. These tools follow coding conventions and are idempotent, ensuring that the desired state is achieved consistently.
Server Templating Tools
Server templates are used to install software on images. Create an image of a server that captures a self-contained snapshots of the operating system, software, files etc.
Docker, Packer and Vagrant are server templating tools.
Instead of launching servers and configuring them by running the same code on each one, these images can be installed on servers.
The combination of configuration management, server templating and orchestration tools define the code that runs on each server. Server templates are used to install software on images and when the image is deployed on a server, the software is run.
Provisioning Tools
Provisioning tools are responsible for creating the necessary infrastructure components, such as servers, databases, load balancers, queues and networking. Provisioning and server templating work together to create a complete infrastructure solution.
Terraform is a popular provisioning tool that allows you to declare the desired end state of your infrastructure. Terraform codebases tend to stay small and easy to understand, focusing on deploying infrastructure. It uses a domain-specific language (DSL) that is easier to learn, clearer, and more concise compared to general-purpose programming languages.
Putting It All Together
To automate software delivery, the following steps are involved:
- Use configuration management tools to define the desired state of the software and configurations.
- Create server templates using tools like Packer to capture the operating system, software and configurations into reusable images.
- Provision the infrastructure using tools like Terraform to create servers, databases and other components.
- Deploy the server images onto the provisioned infrastructure.
- Use orchestration tools to manage the deployment and scaling of the application.
By leveraging infrastructure as code principles and tools, we can automate software delivery process, reducing manual effort, increasing consistency and enabling faster and reliable deployments.