Continuous Deployment at Spreaker

24
Continuous Deployment at Marco Pracucci

description

Continuous Deployment on AWS EC2 made easy with Fabric and Zonify.

Transcript of Continuous Deployment at Spreaker

Page 1: Continuous Deployment at Spreaker

Continuous Deploymentat

Marco Pracucci

Page 2: Continuous Deployment at Spreaker

Platform for Creating

and Sharing Audio

8 people (4 developers)

2M unique listeners / month

3.5M audio tracks created

500 reqs / sec

Page 3: Continuous Deployment at Spreaker

We run 80% of our traffic on AWS

about 60 EC2 instances and 50TB on S3

Page 4: Continuous Deployment at Spreaker

We deploy frequently[even on friday]

51 deploys in last 30 days

Page 5: Continuous Deployment at Spreaker

How we deploy

the web [php] app

in 90 seconds

Page 6: Continuous Deployment at Spreaker

Deploy task

Page 7: Continuous Deployment at Spreaker

fab www.deploy

EC2 instances

1. ssh

code repository

Page 8: Continuous Deployment at Spreaker

2. checkout

fab www.deploy

EC2 instances

code repository

Page 9: Continuous Deployment at Spreaker

fab www.deploy

EC2 instances

code repository

3. warmupChecklist

- local cache warmup

- db schema migrations

- check consistency

Page 10: Continuous Deployment at Spreaker

fab www.deploy

EC2 instances

code repository

4. switch code

everything ok?

Page 11: Continuous Deployment at Spreaker

fab www.deploy

EC2 instances

code repository

4. switch code

Checklist

- iptables --dport 80 -j DROP

- ln -sfn /var/www/new /var/www/curr

- clear bytecode cache

- iptables --dport 80 -j ACCEPT

Page 12: Continuous Deployment at Spreaker

fab www.deploy

notify team on IRC

generate report

Page 13: Continuous Deployment at Spreaker

which instances to deploy?

we do auto-scaling, they change dinamically

Page 14: Continuous Deployment at Spreaker

we exploited

DNS

Page 15: Continuous Deployment at Spreaker

Split infrastructure into roles

role: api

api1api2

api3

www1

www2www3

worker1

worker2{

role: web{

role: worker-web

{

EC2 instances

Page 16: Continuous Deployment at Spreaker

Tag each instance with roles

[space separated roles for multi-role instances]

Page 17: Continuous Deployment at Spreaker

https://github.com/airbnb/zonify

Creates Route 53 DNS entries

for all instances and roles

Map names and roles to DNS

Page 18: Continuous Deployment at Spreaker

Address a single instance

Page 19: Continuous Deployment at Spreaker

Address instances by role

Page 20: Continuous Deployment at Spreaker

Easy to integrate with fabric

Page 21: Continuous Deployment at Spreaker

Internally does

fab -R web www.deploy

Do you remember the starting point?

Page 22: Continuous Deployment at Spreaker

Easy, Fast, Robust

few good reasons

Page 23: Continuous Deployment at Spreaker

Easy, Fast, Robust

few good reasons

Warning: an attacker can easier get your instances IPs

(use an unguessable DNS zone name)

Page 24: Continuous Deployment at Spreaker

Thank you

www.spreaker.com/marco

@pracucci