continuously serving the oss community with continuous integration and delivery, by akshay karle and...

82
Continuously serving the OSS community with Continuous Integration and Delivery Akshay Karle Fernando Júnior

Upload: thoughtworks

Post on 25-Jun-2015

504 views

Category:

Technology


1 download

DESCRIPTION

Snap CI now enables public GitHub repositories to do Continuous Integration(CI) and Continuous Delivery(CD) for free. When doing CD, the goal is to automate the process of deployment and build software in a way that can be deployed to production anytime. To achieve this, we need to figure out a way to deploy the application that doesn't interrupt the users using the system. Learning about this process will allow you to reduce the frictions and delays for deploying new features and bug fixes to production. Your application needs to change in a way that understands this process. You will learn about application and deployment pipelines and the different ways to deploy. In this talk we will touch upon some common deployment pipelines. We will cover in detail about how we changed Snap to do deployments that didn't affect our customers, the challenges we faced and some patterns that helped us overcome them. What made this challenging was the data migrations and long running builds of our customers that made it difficult to figure out when to cut over.

TRANSCRIPT

Page 1: Continuously serving the OSS community with Continuous Integration and Delivery, by Akshay Karle and Fernando Jr

Continuously serving the OSS community with

Continuous Integration and Delivery

Akshay Karle !Fernando Júnior

Page 2: Continuously serving the OSS community with Continuous Integration and Delivery, by Akshay Karle and Fernando Jr

“How long would it take your organization to deploy a change that involves just one single line of code?”

Mary and Tom Poppendieck

Page 3: Continuously serving the OSS community with Continuous Integration and Delivery, by Akshay Karle and Fernando Jr

“(…) build software in such a way that the software can be released to

production at any time.” Martin Fowler

Page 4: Continuously serving the OSS community with Continuous Integration and Delivery, by Akshay Karle and Fernando Jr

CONTINUOUS INTEGRATION

Page 5: Continuously serving the OSS community with Continuous Integration and Delivery, by Akshay Karle and Fernando Jr

CONTINUOUS INTEGRATION

Page 6: Continuously serving the OSS community with Continuous Integration and Delivery, by Akshay Karle and Fernando Jr

CONTINUOUS INTEGRATION

Page 7: Continuously serving the OSS community with Continuous Integration and Delivery, by Akshay Karle and Fernando Jr

CONTINUOUS DELIVERY

Page 8: Continuously serving the OSS community with Continuous Integration and Delivery, by Akshay Karle and Fernando Jr

CONTINUOUS DELIVERY

!

!

▫︎ Continuous Integration

!

▫︎ Automated tasks

!

▫︎ Repeatable/reliable process

Page 9: Continuously serving the OSS community with Continuous Integration and Delivery, by Akshay Karle and Fernando Jr

THERE’S MORE…

Page 10: Continuously serving the OSS community with Continuous Integration and Delivery, by Akshay Karle and Fernando Jr

CONTINUOUS DELIVERY

Page 11: Continuously serving the OSS community with Continuous Integration and Delivery, by Akshay Karle and Fernando Jr

CONTINUOUS DELIVERY

Page 12: Continuously serving the OSS community with Continuous Integration and Delivery, by Akshay Karle and Fernando Jr

DEPLOYING YOUR APPLICATION

!

!

▫︎ Database migrations

!

▫︎ Infrastructure update

!

▫︎ Restarting services

Page 13: Continuously serving the OSS community with Continuous Integration and Delivery, by Akshay Karle and Fernando Jr

ZERO DOWNTIME DEPLOYMENTS

Deployment process of your application has got to be transparent for end users

Page 14: Continuously serving the OSS community with Continuous Integration and Delivery, by Akshay Karle and Fernando Jr

WHO WE ARE?

Developer, Snap CI

/nandopaf

/fernando-alves

/nand0paf

Developer, Snap CI

/akshay_karle

/akshaykarle

/akshay_ka

Page 15: Continuously serving the OSS community with Continuous Integration and Delivery, by Akshay Karle and Fernando Jr

WHAT WE DO?

!

!

!

!

▫︎Continuous Integration for repositories on GitHub

▫︎ SaaS

▫︎Helps you do Continuous Delivery

▫︎ Free for open source projects

Page 16: Continuously serving the OSS community with Continuous Integration and Delivery, by Akshay Karle and Fernando Jr

SNAP INSIDE-OUT

Page 17: Continuously serving the OSS community with Continuous Integration and Delivery, by Akshay Karle and Fernando Jr

LIFECYCLE OF A BUILD

Page 18: Continuously serving the OSS community with Continuous Integration and Delivery, by Akshay Karle and Fernando Jr

LIFECYCLE OF A BUILD

Page 19: Continuously serving the OSS community with Continuous Integration and Delivery, by Akshay Karle and Fernando Jr

LIFECYCLE OF A BUILD

Page 20: Continuously serving the OSS community with Continuous Integration and Delivery, by Akshay Karle and Fernando Jr

LIFECYCLE OF A BUILD

head repository commit

Page 21: Continuously serving the OSS community with Continuous Integration and Delivery, by Akshay Karle and Fernando Jr

LIFECYCLE OF A BUILD

head repository commit

Page 22: Continuously serving the OSS community with Continuous Integration and Delivery, by Akshay Karle and Fernando Jr

LIFECYCLE OF A BUILD

head repository commit

DATABASE

Page 23: Continuously serving the OSS community with Continuous Integration and Delivery, by Akshay Karle and Fernando Jr

LIFECYCLE OF A BUILD

head repository commit

DATABASE

Page 24: Continuously serving the OSS community with Continuous Integration and Delivery, by Akshay Karle and Fernando Jr

LIFECYCLE OF A BUILD

head repository commit

DATABASE

Page 25: Continuously serving the OSS community with Continuous Integration and Delivery, by Akshay Karle and Fernando Jr

Babysitters

LIFECYCLE OF A BUILD

head repository commit

DATABASE

Page 26: Continuously serving the OSS community with Continuous Integration and Delivery, by Akshay Karle and Fernando Jr

Babysitters

LIFECYCLE OF A BUILD

head repository commit

DATABASE

Page 27: Continuously serving the OSS community with Continuous Integration and Delivery, by Akshay Karle and Fernando Jr

Babysitters

LIFECYCLE OF A BUILD

head repository commit

DATABASE

Page 28: Continuously serving the OSS community with Continuous Integration and Delivery, by Akshay Karle and Fernando Jr

LIFE CYCLE

!

▫︎ Prepare the container

▫︎ Starts database

▫︎ Sets PATH

▫︎ Download artifacts

▫︎ Git clone

▫︎ Runs each pipeline stage

▫︎ Upload artifacts

DATABASE

Page 29: Continuously serving the OSS community with Continuous Integration and Delivery, by Akshay Karle and Fernando Jr

Babysitters

LIFECYCLE OF A BUILD

head repository commit

DATABASE

Page 30: Continuously serving the OSS community with Continuous Integration and Delivery, by Akshay Karle and Fernando Jr

Babysitters

LIFECYCLE OF A BUILD

head repository commit

DATABASE

Page 31: Continuously serving the OSS community with Continuous Integration and Delivery, by Akshay Karle and Fernando Jr

ARCHITECTURE OVERVIEW

L B

Page 32: Continuously serving the OSS community with Continuous Integration and Delivery, by Akshay Karle and Fernando Jr

ARCHITECTURE OVERVIEW

L B

Database

web server

Page 33: Continuously serving the OSS community with Continuous Integration and Delivery, by Akshay Karle and Fernando Jr

ARCHITECTURE OVERVIEW

!

!

▫︎ Rails app fronted by apache

!

▫︎ Receives the hooks from GitHub

Database

web server

Page 34: Continuously serving the OSS community with Continuous Integration and Delivery, by Akshay Karle and Fernando Jr

ARCHITECTURE OVERVIEW

L B

web server

Database

Page 35: Continuously serving the OSS community with Continuous Integration and Delivery, by Akshay Karle and Fernando Jr

ARCHITECTURE OVERVIEW

L B

Build Server

web server

Database

Page 36: Continuously serving the OSS community with Continuous Integration and Delivery, by Akshay Karle and Fernando Jr

ARCHITECTURE OVERVIEW

!

▫︎ Background jobs

▫︎ Babysitters

▫︎ Build Queue

▫︎ Artifacts

!

▫︎ OpenVZ Containers

▫︎ Virtual machines where the pipeline runs

Build Server

Page 37: Continuously serving the OSS community with Continuous Integration and Delivery, by Akshay Karle and Fernando Jr

ARCHITECTURE OVERVIEW

L B

Build Server

web server

Database

Page 38: Continuously serving the OSS community with Continuous Integration and Delivery, by Akshay Karle and Fernando Jr

OUR DEPLOYMENT

!

▫︎ Do have automated scripts

!

▫︎ Deployment pipeline

!

▫︎ 1-click deploy

▫︎ Sort of…

Babysitters

DATABASE

L B

Build Server

Database

web server

Page 39: Continuously serving the OSS community with Continuous Integration and Delivery, by Akshay Karle and Fernando Jr

OUR DEPLOYMENT

!

▫︎ Wait for all builds to finish

!

▫︎ Put app on maintenance mode

▫︎ No new requests picked up

!

▫︎ Deploy and wait for migrations

Babysitters

DATABASE

L B

Database

VZHOSTBuild Server

web server

Page 40: Continuously serving the OSS community with Continuous Integration and Delivery, by Akshay Karle and Fernando Jr

ZERO DOWNTIME DEPLOYMENTS

Page 41: Continuously serving the OSS community with Continuous Integration and Delivery, by Akshay Karle and Fernando Jr

BLUE-GREEN DEPLOYMENT

Web Server App Server Database

Page 42: Continuously serving the OSS community with Continuous Integration and Delivery, by Akshay Karle and Fernando Jr

BLUE-GREEN DEPLOYMENT

Web Server App Server Database

App ServerApp ServerWeb Server Database

Page 43: Continuously serving the OSS community with Continuous Integration and Delivery, by Akshay Karle and Fernando Jr

BLUE-GREEN DEPLOYMENT

Web Server App Server Database

App ServerApp ServerWeb Server Database

Page 44: Continuously serving the OSS community with Continuous Integration and Delivery, by Akshay Karle and Fernando Jr

BLUE-GREEN DEPLOYMENT

App ServerApp ServerWeb Server Database

Page 45: Continuously serving the OSS community with Continuous Integration and Delivery, by Akshay Karle and Fernando Jr

BLUE-GREEN DEPLOYMENTS FOR SNAP

VZHOSTBuild Server

web server

VZHOSTBuild Server

web server

L B DATABASE

Page 46: Continuously serving the OSS community with Continuous Integration and Delivery, by Akshay Karle and Fernando Jr

BLUE-GREEN DEPLOYMENTS FOR SNAP

VZHOSTBuild Server

web server

VZHOSTBuild Server

web server

L B DATABASE

Page 47: Continuously serving the OSS community with Continuous Integration and Delivery, by Akshay Karle and Fernando Jr

CHALLENGES IN SNAP

Long running builds

Database migrations

Page 48: Continuously serving the OSS community with Continuous Integration and Delivery, by Akshay Karle and Fernando Jr

CHALLENGES IN SNAP

Long running builds

Page 49: Continuously serving the OSS community with Continuous Integration and Delivery, by Akshay Karle and Fernando Jr

LONG RUNNING BUILDS

VZHOSTBuild Server

web server

VZHOSTBuild Server

web server

L B DATABASE

Page 50: Continuously serving the OSS community with Continuous Integration and Delivery, by Akshay Karle and Fernando Jr

LONG RUNNING BUILDS

VZHOSTBuild Server

web server

VZHOSTBuild Server

web server

L B DATABASE

Page 51: Continuously serving the OSS community with Continuous Integration and Delivery, by Akshay Karle and Fernando Jr

LONG RUNNING BUILDS

!

▫︎ Builds should continue to run

!

▫︎ Artifacts should continue to be served

Page 52: Continuously serving the OSS community with Continuous Integration and Delivery, by Akshay Karle and Fernando Jr

COLOR AWARE BABYSITTERS

Build Server

Green Stack

Build Server

Blue Stack

Page 53: Continuously serving the OSS community with Continuous Integration and Delivery, by Akshay Karle and Fernando Jr

COLOR AWARE BABYSITTERS

Build Server

Green Stack

Build Server

Blue Stack

web server

Page 54: Continuously serving the OSS community with Continuous Integration and Delivery, by Akshay Karle and Fernando Jr

BUILD LIFECYCLE

head repository commit

DATABASEDATABASE

L B

Page 55: Continuously serving the OSS community with Continuous Integration and Delivery, by Akshay Karle and Fernando Jr

BUILD LIFECYCLE

head repository commit

DATABASEDATABASE

L B

Page 56: Continuously serving the OSS community with Continuous Integration and Delivery, by Akshay Karle and Fernando Jr

BUILD LIFECYCLE

head repository commit

DATABASEDATABASE

L B

Page 57: Continuously serving the OSS community with Continuous Integration and Delivery, by Akshay Karle and Fernando Jr

THE SWITCH

L B

Page 58: Continuously serving the OSS community with Continuous Integration and Delivery, by Akshay Karle and Fernando Jr

THE SWITCH

L B

Page 59: Continuously serving the OSS community with Continuous Integration and Delivery, by Akshay Karle and Fernando Jr

THE SWITCH

L B

Page 60: Continuously serving the OSS community with Continuous Integration and Delivery, by Akshay Karle and Fernando Jr

THE SWITCH

L B

Page 61: Continuously serving the OSS community with Continuous Integration and Delivery, by Akshay Karle and Fernando Jr

THE SWITCH

L B

Page 62: Continuously serving the OSS community with Continuous Integration and Delivery, by Akshay Karle and Fernando Jr

THE SWITCH

L B

Page 63: Continuously serving the OSS community with Continuous Integration and Delivery, by Akshay Karle and Fernando Jr

THE SWITCH

L B

Page 64: Continuously serving the OSS community with Continuous Integration and Delivery, by Akshay Karle and Fernando Jr

CHALLENGES IN SNAP

Long running builds

Database migrations

Page 65: Continuously serving the OSS community with Continuous Integration and Delivery, by Akshay Karle and Fernando Jr

CHALLENGES IN SNAP

Database migrations

Page 66: Continuously serving the OSS community with Continuous Integration and Delivery, by Akshay Karle and Fernando Jr

DATABASE MIGRATIONS

PipelinesCounterDuration

App v1.0

App v1.0

L B

Page 67: Continuously serving the OSS community with Continuous Integration and Delivery, by Akshay Karle and Fernando Jr

DATABASE MIGRATIONS

PipelinesCounterDuration

App v1.0

App v1.0

L B

Upgrading to v2.0, migrating

Page 68: Continuously serving the OSS community with Continuous Integration and Delivery, by Akshay Karle and Fernando Jr

DATABASE MIGRATIONS

PipelinesCounter

App v2.0

App v1.0

L B

Page 69: Continuously serving the OSS community with Continuous Integration and Delivery, by Akshay Karle and Fernando Jr

Cannot have destructive migrations

Page 70: Continuously serving the OSS community with Continuous Integration and Delivery, by Akshay Karle and Fernando Jr

MIGRATIONS IN PHASES

PipelinesCounterDuration

App v1.0

App v1.0

L B

Page 71: Continuously serving the OSS community with Continuous Integration and Delivery, by Akshay Karle and Fernando Jr

MIGRATIONS IN PHASES

PipelinesCounterDuration

App v1.0

App v1.0

Upgrading to v2.0

L B

Page 72: Continuously serving the OSS community with Continuous Integration and Delivery, by Akshay Karle and Fernando Jr

MIGRATIONS IN PHASES

PipelinesCounterDuration

App v2.0

App v1.0

L B

Page 73: Continuously serving the OSS community with Continuous Integration and Delivery, by Akshay Karle and Fernando Jr

MIGRATIONS IN PHASES

PipelinesCounterDuration

App v2.0

App v1.0

L B

Page 74: Continuously serving the OSS community with Continuous Integration and Delivery, by Akshay Karle and Fernando Jr

MIGRATIONS IN PHASES

PipelinesCounterDuration

App v2.0

App v1.0

L B

Page 75: Continuously serving the OSS community with Continuous Integration and Delivery, by Akshay Karle and Fernando Jr

MIGRATIONS IN PHASES

PipelinesCounterDuration

App v2.0

App v1.0Upgrading to v3.0

L B

Page 76: Continuously serving the OSS community with Continuous Integration and Delivery, by Akshay Karle and Fernando Jr

MIGRATIONS IN PHASES

App v2.0

App v3.0

PipelinesCounter

L B

Page 77: Continuously serving the OSS community with Continuous Integration and Delivery, by Akshay Karle and Fernando Jr

MIGRATIONS IN PHASES

App v2.0

App v3.0

PipelinesCounter

L B

Page 78: Continuously serving the OSS community with Continuous Integration and Delivery, by Akshay Karle and Fernando Jr

LESSONS LEARNT

Page 79: Continuously serving the OSS community with Continuous Integration and Delivery, by Akshay Karle and Fernando Jr

Automation is beauty

Page 80: Continuously serving the OSS community with Continuous Integration and Delivery, by Akshay Karle and Fernando Jr

Watch out your data

Page 81: Continuously serving the OSS community with Continuous Integration and Delivery, by Akshay Karle and Fernando Jr

Things will go wrong

Page 82: Continuously serving the OSS community with Continuous Integration and Delivery, by Akshay Karle and Fernando Jr

THANK YOUQuestions?

https://snap-ci.com