Slide 1

Slide 1 text

Immutable Infrastructure with Packer

Slide 2

Slide 2 text

Sebastian StormForger.com @tisba Dirk Freelancer @railsbros_dirk Who?

Slide 3

Slide 3 text

Challenges • Increasing complexity • Multiple target environments • Multi/hybrid cloud • Evolving infrastructure • Communication & Documentation

Slide 4

Slide 4 text

Opportunities • Infrastructure (not just servers) on demand • Flexible APIs for all infrastructure components • Affordable but powerful hardware and services • Virtualization

Slide 5

Slide 5 text

Today: Handling Servers

Slide 6

Slide 6 text

Solution SCRIPTING SCRIPTING

Slide 7

Slide 7 text

No content

Slide 8

Slide 8 text

No content

Slide 9

Slide 9 text

Circle of (Server) Life • initial (hardware) provisioning & basic setup • continuous updates, applying changes • decommissioning

Slide 10

Slide 10 text

Change & Configuration Management • Manual (aka "Turnschuhadministration") • Automatic, convergent (chef, puppet, …)

Slide 11

Slide 11 text

These tools and approaches don't have the modern data center tooling & infrastructure in mind!

Slide 12

Slide 12 text

Pets vs Cattle

Slide 13

Slide 13 text

No content

Slide 14

Slide 14 text

Pets vs Cattle • Pets have names, you care about them • Cattle is… "replaceable", you have many of them • Most servers should be cattle, not pets

Slide 15

Slide 15 text

"Immutable Infrastructure?"

Slide 16

Slide 16 text

Immutable Infrastructure • Idea: Servers do not change! • If you need to change something, build a new server and terminate the existing one http://martinfowler.com/bliki/ImmutableServer.html

Slide 17

Slide 17 text

Servers do not change!

Slide 18

Slide 18 text

What do we need to
 treat Servers as Cattle immutable?

Slide 19

Slide 19 text

Immutable Servers • Treat entire servers as build artifacts • Always build them from a known start state • Deploy servers, not applications • Inject configuration on deploy

Slide 20

Slide 20 text

Solutions? Tools?

Slide 21

Slide 21 text

– @bascht “For any (dev)ops related problem HashiCorp most likely already has a tool.”

Slide 22

Slide 22 text

No content

Slide 23

Slide 23 text

– packer.io "Packer is a tool for creating machine and container images for multiple platforms from a single source configuration." Packer

Slide 24

Slide 24 text

Packer • Packer helps to create pipelines for building servers as artifacts for multiple target platforms • It also integrates with multiple provisioning tools

Slide 25

Slide 25 text

Builders Artifacts

Slide 26

Slide 26 text

Provisioners Builders Artifacts

Slide 27

Slide 27 text

Provisioners Builders Post-Processors Artifacts

Slide 28

Slide 28 text

Dev Production Packer Config Provisioners Builders Amazon EC2 VMWare Post-Processors Ansible Ansible Ansible Atlas Vagrant Atlas Artifacts AMI Vagrant Box

Slide 29

Slide 29 text

Dev Production Builders Artifacts Builders Builders

Slide 30

Slide 30 text

Builders Amazon EC2 (AMI) DigitalOcean Docker Google Compute Engine Null OpenStack Parallels QEMU VirtualBox VMware Custom *currently

Slide 31

Slide 31 text

Provisioners Remote Shell Local Shell File Uploads PowerShell Windows Shell Windows Restart Ansible Chef Client Chef Solo Puppet Masterless Puppet Server Salt Custom *currently

Slide 32

Slide 32 text

Post-Processors Artifice Atlas compress docker-import docker-push docker-save docker-tag Vagrant Vagrant Cloud vSphere *currently

Slide 33

Slide 33 text

{ "variables": { "aws_access_key": "", "aws_secret_key": "" }, "builders": [{ "type": "amazon-ebs", "access_key": "{{user `aws_access_key`}}", "secret_key": "{{user `aws_secret_key`}}", "region": "us-east-1", "source_ami": "ami-de0d9eb7", "instance_type": "t1.micro", "ssh_username": "ubuntu", "ami_name": "packer-example {{timestamp}}" }] }

Slide 34

Slide 34 text

No content

Slide 35

Slide 35 text

{ "variables": ["..."], "builders": ["..."], "provisioners": [{ "type": "shell", "inline": [ "sleep 30", "sudo apt-get update", "sudo apt-get install -y redis-server" ] }] }

Slide 36

Slide 36 text

Q&A Sebastian Cohnen stormforger.com @tisba Dirk Breuer tfcl.de @railsbros_dirk

Slide 37

Slide 37 text

NOT SURE TO USE PACKER NOT SURE TO USE PACKER OR JUST GO WITH DOCKER OR JUST GO WITH DOCKER