Immutable servers with Packer/Chef/AWS

76
Immutable Servers Меняйте сервера, как перчатки!

Transcript of Immutable servers with Packer/Chef/AWS

Page 1: Immutable servers with Packer/Chef/AWS

Immutable ServersМеняйте сервера, как перчатки!

Page 2: Immutable servers with Packer/Chef/AWS

Павел ГабриельCTO

whitepayments.com @alovak

Page 3: Immutable servers with Packer/Chef/AWS
Page 4: Immutable servers with Packer/Chef/AWS

DevOps is RuiningMy Craft

– ALEX TATIYANTS http://tatiyants.com/devops-is-ruining-my-craft/

Page 5: Immutable servers with Packer/Chef/AWS

“I come from a long line of sysadmins. My father was a sysadmin, as was his father

before him…”

Page 6: Immutable servers with Packer/Chef/AWS

“I consider myself an artist and a craftsman of server building.”

Page 7: Immutable servers with Packer/Chef/AWS

“…my greatest achievement is a collection of servers I built and configured… Just like beautiful

snowflakes swirling in the winter’s breath, no two were exactly alike,

but all were quite similar…”

Page 8: Immutable servers with Packer/Chef/AWS

Who is Who?

Page 9: Immutable servers with Packer/Chef/AWS

What is IS?

Page 10: Immutable servers with Packer/Chef/AWS

– http://martinfowler.com/bliki/ImmutableServer.html

“…a server that once deployed, is never modified, merely

replaced with a new updated instance.”

Page 11: Immutable servers with Packer/Chef/AWS

How to implement IS?

Page 12: Immutable servers with Packer/Chef/AWS

Ingredients

Kris Krüg: Chai Tea Raw Fresh Organic Ingredients https://flic.kr/p/2gZEE

Page 13: Immutable servers with Packer/Chef/AWS

1

Page 14: Immutable servers with Packer/Chef/AWS

“configuration management tool”

Page 15: Immutable servers with Packer/Chef/AWS

Resources

Page 16: Immutable servers with Packer/Chef/AWS
Page 17: Immutable servers with Packer/Chef/AWS
Page 18: Immutable servers with Packer/Chef/AWS

Recipes

Page 19: Immutable servers with Packer/Chef/AWS
Page 20: Immutable servers with Packer/Chef/AWS

Cookbooks

Page 21: Immutable servers with Packer/Chef/AWS

mysql, nginx, apache, java, apt, git, postgresql,

build-essential, php, nodes, mongoldb, etc..

Page 22: Immutable servers with Packer/Chef/AWS

2

Page 23: Immutable servers with Packer/Chef/AWS

– Packer.io

“Packer is a tool for creating identical machine images

for multiple platforms from a single source configuration”

Page 24: Immutable servers with Packer/Chef/AWS

“A machine image is a static unit thatcontains a pre-configured operating

system and installed software …”

Page 25: Immutable servers with Packer/Chef/AWS

Builders• EC2 AMI

• DigitalOcean

• VirtualBox

• VMWare

• Parallels

• OpenStack

• etc.

Page 26: Immutable servers with Packer/Chef/AWS

Provisioners

• Shell

• Ansible

• Chef

• Puppet

• Salt

Page 27: Immutable servers with Packer/Chef/AWS

Templates

Page 28: Immutable servers with Packer/Chef/AWS
Page 29: Immutable servers with Packer/Chef/AWS
Page 30: Immutable servers with Packer/Chef/AWS
Page 31: Immutable servers with Packer/Chef/AWS

Building

Page 32: Immutable servers with Packer/Chef/AWS
Page 33: Immutable servers with Packer/Chef/AWS
Page 34: Immutable servers with Packer/Chef/AWS
Page 35: Immutable servers with Packer/Chef/AWS

3

Page 36: Immutable servers with Packer/Chef/AWS

“Manage virtual servers, load balancers

and …”

Page 37: Immutable servers with Packer/Chef/AWS
Page 38: Immutable servers with Packer/Chef/AWS
Page 39: Immutable servers with Packer/Chef/AWS

Through the APIRuby, JS, Python, Java, C#, PHP, Go

Page 40: Immutable servers with Packer/Chef/AWS

4

a.pitch: smooth stones https://flic.kr/p/5xh1aD

Architecture

Page 41: Immutable servers with Packer/Chef/AWS

Visible DNS, LB

Volatile app servers

Persistance db, logs

Page 42: Immutable servers with Packer/Chef/AWS

ELB

app app app

DB

Visible

Volatile

Persistance

Page 43: Immutable servers with Packer/Chef/AWS

ELB

app app app

DB

Page 44: Immutable servers with Packer/Chef/AWS

Lets Mix It!

Page 45: Immutable servers with Packer/Chef/AWS

ApplicationRubyOnRails

Page 47: Immutable servers with Packer/Chef/AWS

Chef RecipesTo configure app server

Page 48: Immutable servers with Packer/Chef/AWS

Chef Cookbooks

• ruby

• git

• application_ruby

• nginx

• monit (or runit)

Page 49: Immutable servers with Packer/Chef/AWS

Packer Template

• amazon-ebs

• chef-solo

Page 50: Immutable servers with Packer/Chef/AWS

Ruby Scripts to Orchestrate

Page 51: Immutable servers with Packer/Chef/AWS
Page 52: Immutable servers with Packer/Chef/AWS
Page 53: Immutable servers with Packer/Chef/AWS
Page 54: Immutable servers with Packer/Chef/AWS
Page 55: Immutable servers with Packer/Chef/AWS
Page 56: Immutable servers with Packer/Chef/AWS
Page 57: Immutable servers with Packer/Chef/AWS
Page 58: Immutable servers with Packer/Chef/AWS
Page 59: Immutable servers with Packer/Chef/AWS
Page 60: Immutable servers with Packer/Chef/AWS
Page 61: Immutable servers with Packer/Chef/AWS
Page 62: Immutable servers with Packer/Chef/AWS
Page 63: Immutable servers with Packer/Chef/AWS
Page 64: Immutable servers with Packer/Chef/AWS

DONE!

Page 65: Immutable servers with Packer/Chef/AWS

?

Page 66: Immutable servers with Packer/Chef/AWS

PCI DSS

Page 67: Immutable servers with Packer/Chef/AWS

Because

• Scalability

• Testability

• No ad-hoc changes

• …

Page 68: Immutable servers with Packer/Chef/AWS

But!

Page 69: Immutable servers with Packer/Chef/AWS

1 server - 1 role

Page 70: Immutable servers with Packer/Chef/AWS

Micro-services architecture

Page 71: Immutable servers with Packer/Chef/AWS

Discoverability

Page 72: Immutable servers with Packer/Chef/AWS

Data Storages

Page 73: Immutable servers with Packer/Chef/AWS

Freshness

Page 74: Immutable servers with Packer/Chef/AWS

Time

Page 75: Immutable servers with Packer/Chef/AWS

Спасибо!