1 of 11

Immutable Deployment

Immutable infrastructure and continuous deployment

2 of 11

Introduction

  • Mutable Server Infrastructure
  • Immutable Server Infrastructure

3 of 11

Practical Differences: Embracing the Cloud

4 of 11

Conceptual Differences: Pets vs Cattle

5 of 11

Benefits

  • Known-good server state and fewer deployment failures
  • No configuration drift or snowflake servers
  • Consistent staging environments
  • Easy horizontal scaling
  • Simple rollback and recovery processes

6 of 11

Recommendation and Requirements

  • Servers in a cloud computing environment
  • Full automation of your entire deployment pipeline
  • Service-oriented architecture
  • Stateless, volatile application layer
  • Persistent data layer

7 of 11

Process overview

Artifact deployment script

Make changes to code

Create ELB

Create Route53

Build artifact

Bake AMI

Create LC

Create OR Update ASG

One Time Setup

Deploy new version

8 of 11

Deployment Flow

Env

9 of 11

Rolling Blue/Green

10 of 11

Ansible Immutable Deployment script

- name: provision new instance

hosts: localhost

vars_files:

- extra_vars/{{ env }}_all.yml

- extra_vars/{{ evn }}_backend/build.yml

roles:

- role: launch_instance

- name: deploy artifact

hosts: {{ env }}_backend_build

remote_user: admin

become_method: sudo

become: yes

become_user: root

roles:

- deploy-backend

- name: deploy new release

hosts: localhost

vars:

release: "{{ backend_release }}"

vars_files:

- extra_vars/{{ env }}_all.yml

- extra_vars/{{ env }}_backend/build.yml

roles:

- create-ami

- create-launch-configuration

- update-autoscaling

- clean up

hosts: localhost

vars_files:

- extra_vars/{{ env }}_all.yml

roles:

- terminate_instance

- delete-old-ami

11 of 11