Deployment Theory

Deployment pipeline is an integral part of Devops toolchain, enabling best practices like continuous integration and continuous delivery.

Automation is a crucial aspect of Deployment pipeline and can be achieved using Jenkins pipeline and tools like puppet, chef or ansible which can turn infrastructure into code. To quote Paul Venezia: “Puppet, Chef, Ansible, and Salt were all built with that very goal in mind: to make it much easier to configure and maintain dozens, hundreds, or even thousands of servers.”

Infrastructure as code

"The enabling idea of Infrastructure as Code is that the systems and devices used to run software can be treated as if they, themselves, are software." -- Kief Morris

Infrastructure as code (IaC) is a mechanism to make the infrastructure reliable, repeatable and fast by writing code for configuring environments and automating the provisioning of infrastructure.

Goals

  1. Infrastructure should never be resistant to changes, which should be made in a regular and automated fashion.
  2. Repetitive tasks should done via automation.
  3. Spinning up new environments should be self service.
  4. Focus should be on failure recovery rather than failure avoidance.

Benefits

  1. It helps delivering stable environments rapidly and scalably.
  2. Since the desired state of the environment is represented by code, no manual configuration is required.
  3. As opposed to manual provisioning, which are harder to debug because of different configurations and imprecise instructions, IaC makes servers more consistent, as their configuration is defined using code.

Principles

As described in detail in the book "Infrastructure as Code" by Kief Morris, following are the principles of IaC.

  1. Reproducibility: One should be able to build or rebuild any part of the infrastructure.
  2. Consistency: All servers should run the same version of software and configurations.
  3. Disposability: It should be possible to destroy servers for cases like hardware failures, reducing capacity, replacing servers etc.
  4. Service Continuity: Even if infrastructure pieces fail, service should be able to handle user requests. Having backup servers are required to prevent interruption of service in case a server goes down.
  5. Self-testing systems: Automated testing is one of the key practices that enables fast feedback to developers in order to assess whether their changes would work correctly without causing any breakages.
  6. Self-documenting systems: With IaC, the documentation is implicit in the scripts and tools carrying out the process.
  7. Versioning infrastructure code: Just like in application code, version control helps in keeping track of changes to infrastructure code and rolling them back if required.
Sources