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

FISL 15: Continuously serving the OSS community with Continuous Integration and Delivery

Embed Size (px)

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.

Citation preview

Page 1: FISL 15: Continuously serving the OSS community with Continuous Integration and Delivery

Continuously serving the OSS community with

Continuous Integration and Delivery

Akshay Karle !Fernando Júnior

Page 2: FISL 15: Continuously serving the OSS community with Continuous Integration and Delivery

“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: FISL 15: Continuously serving the OSS community with Continuous Integration and Delivery

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

production at any time.” Martin Fowler

Page 4: FISL 15: Continuously serving the OSS community with Continuous Integration and Delivery

CONTINUOUS INTEGRATION

Page 5: FISL 15: Continuously serving the OSS community with Continuous Integration and Delivery

CONTINUOUS INTEGRATION

Page 6: FISL 15: Continuously serving the OSS community with Continuous Integration and Delivery

CONTINUOUS INTEGRATION

Page 7: FISL 15: Continuously serving the OSS community with Continuous Integration and Delivery

CONTINUOUS DELIVERY

Page 8: FISL 15: Continuously serving the OSS community with Continuous Integration and Delivery

CONTINUOUS DELIVERY

!

!

▫︎ Continuous Integration

!

▫︎ Automated tasks

!

▫︎ Repeatable/reliable process

Page 9: FISL 15: Continuously serving the OSS community with Continuous Integration and Delivery

THERE’S MORE…

Page 10: FISL 15: Continuously serving the OSS community with Continuous Integration and Delivery

CONTINUOUS DELIVERY

Page 11: FISL 15: Continuously serving the OSS community with Continuous Integration and Delivery

CONTINUOUS DELIVERY

Page 12: FISL 15: Continuously serving the OSS community with Continuous Integration and Delivery

DEPLOYING YOUR APPLICATION

!

!

▫︎ Database migrations

!

▫︎ Infrastructure update

!

▫︎ Restarting services

Page 13: FISL 15: Continuously serving the OSS community with Continuous Integration and Delivery

ZERO DOWNTIME DEPLOYMENTS

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

Page 14: FISL 15: Continuously serving the OSS community with Continuous Integration and Delivery

WHO WE ARE?

Developer, Snap CI

/nandopaf

/fernando-alves

/nand0paf

Developer, Snap CI

/akshay_karle

/akshaykarle

/akshay_ka

Page 15: FISL 15: Continuously serving the OSS community with Continuous Integration and Delivery

WHAT WE DO?

!

!

!

!

▫︎Continuous Integration for repositories on GitHub

▫︎ SaaS

▫︎Helps you do Continuous Delivery

▫︎ Free for open source projects

Page 16: FISL 15: Continuously serving the OSS community with Continuous Integration and Delivery

SNAP INSIDE-OUT

Page 17: FISL 15: Continuously serving the OSS community with Continuous Integration and Delivery

LIFECYCLE OF A BUILD

Page 18: FISL 15: Continuously serving the OSS community with Continuous Integration and Delivery

LIFECYCLE OF A BUILD

Page 19: FISL 15: Continuously serving the OSS community with Continuous Integration and Delivery

LIFECYCLE OF A BUILD

Page 20: FISL 15: Continuously serving the OSS community with Continuous Integration and Delivery

LIFECYCLE OF A BUILD

head repository commit

Page 21: FISL 15: Continuously serving the OSS community with Continuous Integration and Delivery

LIFECYCLE OF A BUILD

head repository commit

Page 22: FISL 15: Continuously serving the OSS community with Continuous Integration and Delivery

LIFECYCLE OF A BUILD

head repository commit

DATABASE

Page 23: FISL 15: Continuously serving the OSS community with Continuous Integration and Delivery

LIFECYCLE OF A BUILD

head repository commit

DATABASE

Page 24: FISL 15: Continuously serving the OSS community with Continuous Integration and Delivery

LIFECYCLE OF A BUILD

head repository commit

DATABASE

Page 25: FISL 15: Continuously serving the OSS community with Continuous Integration and Delivery

Babysitters

LIFECYCLE OF A BUILD

head repository commit

DATABASE

Page 26: FISL 15: Continuously serving the OSS community with Continuous Integration and Delivery

Babysitters

LIFECYCLE OF A BUILD

head repository commit

DATABASE

Page 27: FISL 15: Continuously serving the OSS community with Continuous Integration and Delivery

Babysitters

LIFECYCLE OF A BUILD

head repository commit

DATABASE

Page 28: FISL 15: Continuously serving the OSS community with Continuous Integration and Delivery

LIFE CYCLE

!

▫︎ Prepare the container

▫︎ Starts database

▫︎ Sets PATH

▫︎ Download artifacts

▫︎ Git clone

▫︎ Runs each pipeline stage

▫︎ Upload artifacts

DATABASE

Page 29: FISL 15: Continuously serving the OSS community with Continuous Integration and Delivery

Babysitters

LIFECYCLE OF A BUILD

head repository commit

DATABASE

Page 30: FISL 15: Continuously serving the OSS community with Continuous Integration and Delivery

Babysitters

LIFECYCLE OF A BUILD

head repository commit

DATABASE

Page 31: FISL 15: Continuously serving the OSS community with Continuous Integration and Delivery

ARCHITECTURE OVERVIEW

L B

Page 32: FISL 15: Continuously serving the OSS community with Continuous Integration and Delivery

ARCHITECTURE OVERVIEW

L B

Database

web server

Page 33: FISL 15: Continuously serving the OSS community with Continuous Integration and Delivery

ARCHITECTURE OVERVIEW

!

!

▫︎ Rails app fronted by apache

!

▫︎ Receives the hooks from GitHub

Database

web server

Page 34: FISL 15: Continuously serving the OSS community with Continuous Integration and Delivery

ARCHITECTURE OVERVIEW

L B

web server

Database

Page 35: FISL 15: Continuously serving the OSS community with Continuous Integration and Delivery

ARCHITECTURE OVERVIEW

L B

Build Server

web server

Database

Page 36: FISL 15: Continuously serving the OSS community with Continuous Integration and Delivery

ARCHITECTURE OVERVIEW

!

▫︎ Background jobs

▫︎ Babysitters

▫︎ Build Queue

▫︎ Artifacts

!

▫︎ OpenVZ Containers

▫︎ Virtual machines where the pipeline runs

Build Server

Page 37: FISL 15: Continuously serving the OSS community with Continuous Integration and Delivery

ARCHITECTURE OVERVIEW

L B

Build Server

web server

Database

Page 38: FISL 15: Continuously serving the OSS community with Continuous Integration and Delivery

OUR DEPLOYMENT

!

▫︎ Do have automated scripts

!

▫︎ Deployment pipeline

!

▫︎ 1-click deploy

▫︎ Sort of…

Babysitters

DATABASE

L B

Build Server

Database

web server

Page 39: FISL 15: Continuously serving the OSS community with Continuous Integration and Delivery

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: FISL 15: Continuously serving the OSS community with Continuous Integration and Delivery

ZERO DOWNTIME DEPLOYMENTS

Page 41: FISL 15: Continuously serving the OSS community with Continuous Integration and Delivery

BLUE-GREEN DEPLOYMENT

Web Server App Server Database

Page 42: FISL 15: Continuously serving the OSS community with Continuous Integration and Delivery

BLUE-GREEN DEPLOYMENT

Web Server App Server Database

App ServerApp ServerWeb Server Database

Page 43: FISL 15: Continuously serving the OSS community with Continuous Integration and Delivery

BLUE-GREEN DEPLOYMENT

Web Server App Server Database

App ServerApp ServerWeb Server Database

Page 44: FISL 15: Continuously serving the OSS community with Continuous Integration and Delivery

BLUE-GREEN DEPLOYMENT

App ServerApp ServerWeb Server Database

Page 45: FISL 15: Continuously serving the OSS community with Continuous Integration and Delivery

BLUE-GREEN DEPLOYMENTS FOR SNAP

VZHOSTBuild Server

web server

VZHOSTBuild Server

web server

L B DATABASE

Page 46: FISL 15: Continuously serving the OSS community with Continuous Integration and Delivery

BLUE-GREEN DEPLOYMENTS FOR SNAP

VZHOSTBuild Server

web server

VZHOSTBuild Server

web server

L B DATABASE

Page 47: FISL 15: Continuously serving the OSS community with Continuous Integration and Delivery

CHALLENGES IN SNAP

Long running builds

Database migrations

Page 48: FISL 15: Continuously serving the OSS community with Continuous Integration and Delivery

CHALLENGES IN SNAP

Long running builds

Page 49: FISL 15: Continuously serving the OSS community with Continuous Integration and Delivery

LONG RUNNING BUILDS

VZHOSTBuild Server

web server

VZHOSTBuild Server

web server

L B DATABASE

Page 50: FISL 15: Continuously serving the OSS community with Continuous Integration and Delivery

LONG RUNNING BUILDS

VZHOSTBuild Server

web server

VZHOSTBuild Server

web server

L B DATABASE

Page 51: FISL 15: Continuously serving the OSS community with Continuous Integration and Delivery

LONG RUNNING BUILDS

!

▫︎ Builds should continue to run

!

▫︎ Artifacts should continue to be served

Page 52: FISL 15: Continuously serving the OSS community with Continuous Integration and Delivery

COLOR AWARE BABYSITTERS

Build Server

Green Stack

Build Server

Blue Stack

Page 53: FISL 15: Continuously serving the OSS community with Continuous Integration and Delivery

COLOR AWARE BABYSITTERS

Build Server

Green Stack

Build Server

Blue Stack

web server

Page 54: FISL 15: Continuously serving the OSS community with Continuous Integration and Delivery

BUILD LIFECYCLE

head repository commit

DATABASEDATABASE

L B

Page 55: FISL 15: Continuously serving the OSS community with Continuous Integration and Delivery

BUILD LIFECYCLE

head repository commit

DATABASEDATABASE

L B

Page 56: FISL 15: Continuously serving the OSS community with Continuous Integration and Delivery

BUILD LIFECYCLE

head repository commit

DATABASEDATABASE

L B

Page 57: FISL 15: Continuously serving the OSS community with Continuous Integration and Delivery

THE SWITCH

L B

Page 58: FISL 15: Continuously serving the OSS community with Continuous Integration and Delivery

THE SWITCH

L B

Page 59: FISL 15: Continuously serving the OSS community with Continuous Integration and Delivery

THE SWITCH

L B

Page 60: FISL 15: Continuously serving the OSS community with Continuous Integration and Delivery

THE SWITCH

L B

Page 61: FISL 15: Continuously serving the OSS community with Continuous Integration and Delivery

THE SWITCH

L B

Page 62: FISL 15: Continuously serving the OSS community with Continuous Integration and Delivery

THE SWITCH

L B

Page 63: FISL 15: Continuously serving the OSS community with Continuous Integration and Delivery

THE SWITCH

L B

Page 64: FISL 15: Continuously serving the OSS community with Continuous Integration and Delivery

CHALLENGES IN SNAP

Long running builds

Database migrations

Page 65: FISL 15: Continuously serving the OSS community with Continuous Integration and Delivery

CHALLENGES IN SNAP

Database migrations

Page 66: FISL 15: Continuously serving the OSS community with Continuous Integration and Delivery

DATABASE MIGRATIONS

PipelinesCounterDuration

App v1.0

App v1.0

L B

Page 67: FISL 15: Continuously serving the OSS community with Continuous Integration and Delivery

DATABASE MIGRATIONS

PipelinesCounterDuration

App v1.0

App v1.0

L B

Upgrading to v2.0, migrating

Page 68: FISL 15: Continuously serving the OSS community with Continuous Integration and Delivery

DATABASE MIGRATIONS

PipelinesCounter

App v2.0

App v1.0

L B

Page 69: FISL 15: Continuously serving the OSS community with Continuous Integration and Delivery

Cannot have destructive migrations

Page 70: FISL 15: Continuously serving the OSS community with Continuous Integration and Delivery

MIGRATIONS IN PHASES

PipelinesCounterDuration

App v1.0

App v1.0

L B

Page 71: FISL 15: Continuously serving the OSS community with Continuous Integration and Delivery

MIGRATIONS IN PHASES

PipelinesCounterDuration

App v1.0

App v1.0

Upgrading to v2.0

L B

Page 72: FISL 15: Continuously serving the OSS community with Continuous Integration and Delivery

MIGRATIONS IN PHASES

PipelinesCounterDuration

App v2.0

App v1.0

L B

Page 73: FISL 15: Continuously serving the OSS community with Continuous Integration and Delivery

MIGRATIONS IN PHASES

PipelinesCounterDuration

App v2.0

App v1.0

L B

Page 74: FISL 15: Continuously serving the OSS community with Continuous Integration and Delivery

MIGRATIONS IN PHASES

PipelinesCounterDuration

App v2.0

App v1.0

L B

Page 75: FISL 15: Continuously serving the OSS community with Continuous Integration and Delivery

MIGRATIONS IN PHASES

PipelinesCounterDuration

App v2.0

App v1.0Upgrading to v3.0

L B

Page 76: FISL 15: Continuously serving the OSS community with Continuous Integration and Delivery

MIGRATIONS IN PHASES

App v2.0

App v3.0

PipelinesCounter

L B

Page 77: FISL 15: Continuously serving the OSS community with Continuous Integration and Delivery

MIGRATIONS IN PHASES

App v2.0

App v3.0

PipelinesCounter

L B

Page 78: FISL 15: Continuously serving the OSS community with Continuous Integration and Delivery

LESSONS LEARNT

Page 79: FISL 15: Continuously serving the OSS community with Continuous Integration and Delivery

Automation is beauty

Page 80: FISL 15: Continuously serving the OSS community with Continuous Integration and Delivery

Watch out your data

Page 81: FISL 15: Continuously serving the OSS community with Continuous Integration and Delivery

Things will go wrong

Page 82: FISL 15: Continuously serving the OSS community with Continuous Integration and Delivery

THANK YOUQuestions?

https://snap-ci.com