82
02/01/11 Presented to JClouds Meetup @ Twitter’s HQ Toni Batchelli, Consultant and Entrepreneur wannabe [email protected] , @tbatchelli, @disclojure February 2, 2011 Complex Infrastructure Made Easy™ Agile Development at GoGrid with Pallet and JClouds

Agile Development at GoGrid with Pallet and JClouds

Embed Size (px)

DESCRIPTION

This is a presentation to JClouds Meetup @ Twitter's HQ. Presented by Toni Batchelli. It discusses the methodologies that the GoGrid engineering team is employing to quickly and accurately produce timely builds.

Citation preview

Page 1: Agile Development at GoGrid with Pallet and JClouds

02/01/11

Presented to JClouds Meetup @ Twitter’s HQToni Batchelli, Consultant and Entrepreneur wannabe

[email protected], @tbatchelli, @disclojureFebruary 2, 2011

Complex Infrastructure Made Easy™

Agile Development at GoGrid with Pallet and JClouds

Page 2: Agile Development at GoGrid with Pallet and JClouds

GoGrid’s Challenges

GoGrid is a cloud provider, building their own software

Developing and testing their cloud management software is complex. They need to create and maintain realistic environments in order to load them with their latest software builds

~10 different servers types~20 different services

Page 3: Agile Development at GoGrid with Pallet and JClouds

The problem?

Current time to setup a development/QA environment is 2 days• Mostly manual work

Building the environments manually is very error prone

A high level of interconnectivity between services

Page 4: Agile Development at GoGrid with Pallet and JClouds

Goal

To be able to create development and testing environments dynamically, in a

customizable way, and on cloud infrastructure

A Cloud in a Cloud

Page 5: Agile Development at GoGrid with Pallet and JClouds

Additional ChallengesEnvironments need to be verified as fully functional before deploying software on them

Must support multiple locations

Must be able to scale dynamically

Must support concurrent development• Different feature branches

Must manage/version non-software components in a lockstep with the software:• Network configuration• System-level configurations• Application-level configurations

Page 6: Agile Development at GoGrid with Pallet and JClouds

02/01/11

tools

Page 7: Agile Development at GoGrid with Pallet and JClouds

Abstraction layer on resource management

If you code your infrastructure management code to the jclouds API, you can port your code to all cloud providers

JVM-based

Provides access to GoGrid’s infrastructure by abstracting the communication GoGrid’s Cloud API

Page 8: Agile Development at GoGrid with Pallet and JClouds

Uses JClouds to create and manage nodes

Provisions nodes with software and configuration

Verifies node and service correct operation

Operates the services in the nodes

Nodes are grouped by groups (formerly known as ‘tags’). All nodes in a group are equivalent

Page 9: Agile Development at GoGrid with Pallet and JClouds

Clojure

Pallet is built on ClojureClojure is a JVM-based lisp with superb integration with Java and concurrency

Can use any existing Java library (Tomcat, jdbc, etc...)

Provides a high level of abstraction, which is what is needed in this case

Growing community: there are 7 books on Clojure either published or in preparation

Page 10: Agile Development at GoGrid with Pallet and JClouds

02/01/11

how?

Page 11: Agile Development at GoGrid with Pallet and JClouds

GoGrid Cloud Infrastructure

GoG

rid

Clo

ud A

PI

ServiceServiceService

ServiceService

Service

Service Service

Service ServiceService

Page 12: Agile Development at GoGrid with Pallet and JClouds

GoGrid Cloud Infrastructure

GoG

rid

Clo

ud A

PI

ServiceServiceService

ServiceService

Service

Service Service

Service ServiceService

jclouds

Page 13: Agile Development at GoGrid with Pallet and JClouds

GoGrid Cloud Infrastructure

GoG

rid

Clo

ud A

PI

ServiceServiceService

ServiceService

Service

Service Service

Service ServiceService

gimmenodes!

jclouds

Page 14: Agile Development at GoGrid with Pallet and JClouds

GoGrid Cloud Infrastructure

GoG

rid

Clo

ud A

PI

ServiceServiceService

ServiceService

Service

Service Service

Service ServiceService

gimmenodes!

jclouds

Page 15: Agile Development at GoGrid with Pallet and JClouds

GoGrid Cloud Infrastructure

GoG

rid

Clo

ud A

PI

ServiceServiceService

ServiceService

Service

Service Service

Service ServiceService

Page 16: Agile Development at GoGrid with Pallet and JClouds

GoGrid Cloud Infrastructure

GoG

rid

Clo

ud A

PI

ServiceServiceService

ServiceService

Service

Service Service

Service ServiceService

pallet

pallet

Page 17: Agile Development at GoGrid with Pallet and JClouds

GoGrid Cloud Infrastructure

GoG

rid

Clo

ud A

PI

ServiceServiceService

ServiceService

Service

Service Service

Service ServiceService

do stuff!

pallet

pallet

Page 18: Agile Development at GoGrid with Pallet and JClouds

GoGrid Cloud Infrastructure

GoG

rid

Clo

ud A

PI

ServiceServiceService

ServiceService

Service

Service Service

Service ServiceService

do stuff!

pallet

pallet

Page 19: Agile Development at GoGrid with Pallet and JClouds

GoGrid Cloud Infrastructure

GoG

rid

Clo

ud A

PI

Page 20: Agile Development at GoGrid with Pallet and JClouds

GoGrid Cloud Infrastructure

GoG

rid

Clo

ud A

PI

jclouds

Page 21: Agile Development at GoGrid with Pallet and JClouds

GoGrid Cloud Infrastructure

GoG

rid

Clo

ud A

PI

make mea dev cloud!

jclouds

Page 22: Agile Development at GoGrid with Pallet and JClouds

GoGrid Cloud Infrastructure

GoG

rid

Clo

ud A

PI

make mea dev cloud!

jclouds

ServiceService

Service

ServiceServiceService

ServiceServiceService

Service Service

Page 23: Agile Development at GoGrid with Pallet and JClouds

GoGrid Cloud Infrastructure

GoG

rid

Clo

ud A

PI

ServiceService

Service

ServiceServiceService

ServiceServiceService

Service Service

pallet

pallet

Page 24: Agile Development at GoGrid with Pallet and JClouds

GoGrid Cloud Infrastructure

GoG

rid

Clo

ud A

PI

install cloudinfrastructure!

ServiceService

Service

ServiceServiceService

ServiceServiceService

Service Service

pallet

pallet

Page 25: Agile Development at GoGrid with Pallet and JClouds

GoGrid Cloud Infrastructure

GoG

rid

Clo

ud A

PI

install cloudinfrastructure!

ServiceService

Service

ServiceServiceService

ServiceServiceService

Service Service

pallet

pallet

Page 26: Agile Development at GoGrid with Pallet and JClouds

GoGrid Cloud Infrastructure

GoG

rid

Clo

ud A

PI

ServiceService

Service

ServiceServiceService

ServiceServiceService

Service Service

pallet

pallet

Page 27: Agile Development at GoGrid with Pallet and JClouds

GoGrid Cloud Infrastructure

GoG

rid

Clo

ud A

PI

is all workingfine?

ServiceService

Service

ServiceServiceService

ServiceServiceService

Service Service

pallet

pallet

Page 28: Agile Development at GoGrid with Pallet and JClouds

GoGrid Cloud Infrastructure

GoG

rid

Clo

ud A

PI

is all workingfine?

ServiceService

Service

ServiceServiceService

ServiceServiceService

Service Service

pallet

pallet

OK!

Page 29: Agile Development at GoGrid with Pallet and JClouds

GoGrid Cloud Infrastructure

GoG

rid

Clo

ud A

PI

ServiceService

Service

ServiceServiceService

ServiceServiceService

Service Service

pallet

pallet

Page 30: Agile Development at GoGrid with Pallet and JClouds

GoGrid Cloud Infrastructure

GoG

rid

Clo

ud A

PI

deploynew build!

ServiceService

Service

ServiceServiceService

ServiceServiceService

Service Service

pallet

pallet

Page 31: Agile Development at GoGrid with Pallet and JClouds

GoGrid Cloud Infrastructure

GoG

rid

Clo

ud A

PI

ServiceService

Service

ServiceServiceService

ServiceServiceService

Service Service

pallet

pallet

deploynew build!

Page 32: Agile Development at GoGrid with Pallet and JClouds

GoGrid Cloud Infrastructure

GoG

rid

Clo

ud A

PI

ServiceService

Service

ServiceServiceService

ServiceServiceService

Service Service

pallet

pallet

GoGrid Cloud Infrastructure

GoG

rid

Clo

ud A

PI

deploynew build!

Page 33: Agile Development at GoGrid with Pallet and JClouds

GoGrid Cloud Infrastructure

GoG

rid

Clo

ud A

PI

ServiceService

Service

ServiceServiceService

ServiceServiceService

Service ServiceGoGrid Cloud Infrastructure

GoG

rid

Clo

ud A

PI

Page 34: Agile Development at GoGrid with Pallet and JClouds

GoGrid Cloud Infrastructure

GoG

rid

Clo

ud A

PI

awesome!

ServiceService

Service

ServiceServiceService

ServiceServiceService

Service ServiceGoGrid Cloud Infrastructure

GoG

rid

Clo

ud A

PI

Page 35: Agile Development at GoGrid with Pallet and JClouds

GoGrid Cloud Infrastructure

GoG

rid

Clo

ud A

PI

ServiceService

Service

ServiceServiceService

ServiceServiceService

Service ServiceGoGrid Cloud Infrastructure

GoG

rid

Clo

ud A

PI

Page 36: Agile Development at GoGrid with Pallet and JClouds

GoGrid Cloud Infrastructure

GoG

rid

Clo

ud A

PI

ServiceService

Service

ServiceServiceService

ServiceServiceService

Service ServiceGoGrid Cloud Infrastructure

GoG

rid

Clo

ud A

PIjclouds

Page 37: Agile Development at GoGrid with Pallet and JClouds

GoGrid Cloud Infrastructure

GoG

rid

Clo

ud A

PI

let’s test:gimme nodes!

ServiceService

Service

ServiceServiceService

ServiceServiceService

Service ServiceGoGrid Cloud Infrastructure

GoG

rid

Clo

ud A

PIjclouds

Page 38: Agile Development at GoGrid with Pallet and JClouds

GoGrid Cloud Infrastructure

GoG

rid

Clo

ud A

PI

let’s test:gimme nodes!

ServiceService

Service

ServiceServiceService

ServiceServiceService

Service ServiceGoGrid Cloud Infrastructure

GoG

rid

Clo

ud A

PIjclouds

Page 39: Agile Development at GoGrid with Pallet and JClouds

GoGrid Cloud Infrastructure

GoG

rid

Clo

ud A

PI

ServiceService

Service

ServiceServiceService

ServiceServiceService

Service ServiceGoGrid Cloud Infrastructure

GoG

rid

Clo

ud A

PI

Page 40: Agile Development at GoGrid with Pallet and JClouds

GoGrid Cloud Infrastructure

GoG

rid

Clo

ud A

PI

jclouds

ServiceService

Service

ServiceServiceService

ServiceServiceService

Service ServiceGoGrid Cloud Infrastructure

GoG

rid

Clo

ud A

PI

Page 41: Agile Development at GoGrid with Pallet and JClouds

GoGrid Cloud Infrastructure

GoG

rid

Clo

ud A

PI

I’m done,thanks!

jclouds

ServiceService

Service

ServiceServiceService

ServiceServiceService

Service ServiceGoGrid Cloud Infrastructure

GoG

rid

Clo

ud A

PI

Page 42: Agile Development at GoGrid with Pallet and JClouds

GoGrid Cloud Infrastructure

GoG

rid

Clo

ud A

PI

I’m done,thanks!

jclouds

Page 43: Agile Development at GoGrid with Pallet and JClouds

GoGrid Cloud Infrastructure

GoG

rid

Clo

ud A

PI

Page 44: Agile Development at GoGrid with Pallet and JClouds

GoGrid Cloud Infrastructure

GoG

rid

Clo

ud A

PI

environmentfor branch A?

Page 45: Agile Development at GoGrid with Pallet and JClouds

GoGrid Cloud Infrastructure

GoG

rid

Clo

ud A

PI

GoGrid Cloud Infrastructure

GoG

rid

Clo

ud A

PI

branch A

environmentfor branch A?

Page 46: Agile Development at GoGrid with Pallet and JClouds

GoGrid Cloud Infrastructure

GoG

rid

Clo

ud A

PI

GoGrid Cloud Infrastructure

GoG

rid

Clo

ud A

PI

branch A

environmentfor branch A?

environmentfor branch B?

Page 47: Agile Development at GoGrid with Pallet and JClouds

GoGrid Cloud Infrastructure

GoG

rid

Clo

ud A

PI

GoGrid Cloud Infrastructure

GoG

rid

Clo

ud A

PI

branch A

environmentfor branch A?

GoGrid Cloud Infrastructure

GoG

rid

Clo

ud A

PI

branch B

environmentfor branch B?

Page 48: Agile Development at GoGrid with Pallet and JClouds

GoGrid Cloud Infrastructure

GoG

rid

Clo

ud A

PI

GoGrid Cloud Infrastructure

GoG

rid

Clo

ud A

PI

branch A

environmentfor branch A?

GoGrid Cloud Infrastructure

GoG

rid

Clo

ud A

PI

branch B

environmentfor branch B?

environmentfor QA please?

Page 49: Agile Development at GoGrid with Pallet and JClouds

GoGrid Cloud Infrastructure

GoG

rid

Clo

ud A

PI

GoGrid Cloud Infrastructure

GoG

rid

Clo

ud A

PI

branch A

environmentfor branch A?

GoGrid Cloud Infrastructure

GoG

rid

Clo

ud A

PI

branch B

environmentfor branch B?

GoGrid Cloud Infrastructure

GoG

rid

Clo

ud A

PI

QA

environmentfor QA please?

Page 50: Agile Development at GoGrid with Pallet and JClouds

02/01/11

development

Page 51: Agile Development at GoGrid with Pallet and JClouds

GoGrid’s Development Process

Create a feature branch

Create an environment (cloud infrastructure) for this branch

Verify new environment (end-to-end tests)

Automatically build and deploy the new software every time new code is committed to the branch.

Destroy environment and free resources when done

Page 52: Agile Development at GoGrid with Pallet and JClouds

An Environment

Usually one environment for active development branch

Each environment is specified by:• The development branch it tracks• Service types and node count for each service type• Network configuration• External services/DB provisioning

Page 53: Agile Development at GoGrid with Pallet and JClouds

Development Environments

Each development environment tracks a development feature branch

Each environment has a node with Hudson CI, configured to track the environment’s branch

When new code is pushed to the development branch, the environment’s Hudson server builds the software and updates the environment with it.

Page 54: Agile Development at GoGrid with Pallet and JClouds

02/01/11

more on pallet

Page 55: Agile Development at GoGrid with Pallet and JClouds

Why Pallet?

There are well known solutions for node provisioning in the cloud, why pallet?• It integrates with infrastructure management• Service interconnections are first class entities in

the framework• Scalable programming model• Integrates well with SCM and with other OPS tools• Comprehensive support for all development cycles

Page 56: Agile Development at GoGrid with Pallet and JClouds

✓No central server

✓No agents on nodes

✓Works with standard and custom images

✓First-class support for complex multi-service configurations

✓All node configuration done remotely via generated scripts over SSH

✓DSL for generating scripts, resources

✓Testable

Page 57: Agile Development at GoGrid with Pallet and JClouds

crates

Pallet’s basic configuration unit

A crate is a grouping of functions around a service

Functions usually:• manipulate/create internal representations• result in resources deployed or scripts being run in

the target nodes

Page 58: Agile Development at GoGrid with Pallet and JClouds

proxied

bootstrap

automatedadmin user

tomcat

java tomcat

tomcatdeploy

reverse proxy

haproxy

Custom Crates

Standard Crates

Page 59: Agile Development at GoGrid with Pallet and JClouds

A Node(core/defnode  proxied    "Basic  web  app,  served  by  tomcat"    {:os-­‐family  :ubuntu        :os-­‐description-­‐matches  "10.04"      :inbound-­‐ports  [8080  22]}      :bootstrap  (resource/phase  (crates/bootstrap))    :configure  (resource/phase  (crates/tomcat))    :deploy  (resource/phase  

(crates/tomcat-­‐deploy  "webapp.war"))    :restart-­‐tomcat  (resource/phase                                      (service/service  

"tomcat6":action  :restart)))

Page 60: Agile Development at GoGrid with Pallet and JClouds

jclouds section of a node(core/defnode  proxied    "Basic  web  app,  served  by  tomcat"    {:os-­‐family  :ubuntu        :os-­‐description-­‐matches  "10.04"      :inbound-­‐ports  [8080  22]}      :bootstrap  (resource/phase  (crates/bootstrap))    :configure  (resource/phase  (crates/tomcat))    :deploy  (resource/phase  

(crates/tomcat-­‐deploy  "webapp.war"))    :restart-­‐tomcat  (resource/phase                                      (service/service  

"tomcat6":action  :restart)))

Page 61: Agile Development at GoGrid with Pallet and JClouds

Execution Phases(core/defnode  proxied    "Basic  web  app,  served  by  tomcat"    {:os-­‐family  :ubuntu        :os-­‐description-­‐matches  "10.04"      :inbound-­‐ports  [8080  22]}      :bootstrap  (resource/phase  (crates/bootstrap))    :configure  (resource/phase  (crates/tomcat))    :deploy  (resource/phase  

(crates/tomcat-­‐deploy  "webapp.war"))    :restart-­‐tomcat  (resource/phase                                      (service/service

"tomcat6"  :action  :restart)))

Page 62: Agile Development at GoGrid with Pallet and JClouds

Cloud Infrastructure

Pallet

Crates

Node definitions

Clo

ud A

PI

webapp webapp webapp

proxy proxy

DB DB

Page 63: Agile Development at GoGrid with Pallet and JClouds

Cloud Infrastructure

Pallet

Crates

Node definitions

Clo

ud A

PI

webapp webapp webapp

proxy proxy

DB DB

Page 64: Agile Development at GoGrid with Pallet and JClouds

Cloud Infrastructure

Pallet

Crates

Node definitions

Clo

ud A

PI

webapp webapp webapp

proxy proxy

DB DB

Page 65: Agile Development at GoGrid with Pallet and JClouds

Cloud Infrastructure

Pallet

Crates

Node definitions

Clo

ud A

PI

webapp webapp webapp

proxy proxy

DB DB

jclouds

Page 66: Agile Development at GoGrid with Pallet and JClouds

Cloud Infrastructure

Pallet

Crates

Node definitions

Clo

ud A

PI

webapp webapp webapp

proxy proxy

DB DB

proxy proxy

jclouds

Page 67: Agile Development at GoGrid with Pallet and JClouds

Cloud Infrastructure

Pallet

Crates

Node definitions

Clo

ud A

PI

webapp webapp webapp

proxy proxy

DB DB

proxy proxy

webapp webapp webappjclouds

Page 68: Agile Development at GoGrid with Pallet and JClouds

Cloud Infrastructure

Pallet

Crates

Node definitions

Clo

ud A

PI

webapp webapp webapp

proxy proxy

DB DB

proxy proxy

webapp webapp webapp

DB DB

jclouds

Page 69: Agile Development at GoGrid with Pallet and JClouds

Cloud Infrastructure

Pallet

Crates

Node definitions

Clo

ud A

PI

webapp webapp webapp

proxy proxy

DB DB

proxy proxy

webapp webapp webapp

DB DB

Page 70: Agile Development at GoGrid with Pallet and JClouds

Cloud Infrastructure

Pallet

Crates

Node definitions

Clo

ud A

PI

webapp webapp webapp

proxy proxy

DB DB

proxy proxy

webapp webapp webapp

DB DB

squid squid

Page 71: Agile Development at GoGrid with Pallet and JClouds

Cloud Infrastructure

Pallet

Crates

Node definitions

Clo

ud A

PI

webapp webapp webapp

proxy proxy

DB DB

proxy proxy

webapp webapp webapp

DB DB

squid squid

Page 72: Agile Development at GoGrid with Pallet and JClouds

Cloud Infrastructure

Pallet

Crates

Node definitions

Clo

ud A

PI

webapp webapp webapp

proxy proxy

DB DB

proxy proxy

webapp webapp webapp

DB DB

squid squid

tomcat tomcattomcat

Page 73: Agile Development at GoGrid with Pallet and JClouds

Cloud Infrastructure

Pallet

Crates

Node definitions

Clo

ud A

PI

webapp webapp webapp

proxy proxy

DB DB

proxy proxy

webapp webapp webapp

DB DB

squid squid

tomcat tomcattomcat

Page 74: Agile Development at GoGrid with Pallet and JClouds

Cloud Infrastructure

Pallet

Crates

Node definitions

Clo

ud A

PI

webapp webapp webapp

proxy proxy

DB DB

proxy proxy

webapp webapp webapp

DB DB

squid squid

tomcat tomcattomcat

mysql mysql

Page 75: Agile Development at GoGrid with Pallet and JClouds

How are systems interconnected?

Phase 1• Retrieve and/or create needed nodes• For each node in each group: run phases for crates

anda) Collect configuration infob) Schedule configuration actions to be performed

on node

Phase 2• Generate and execute scripts and resources

Page 76: Agile Development at GoGrid with Pallet and JClouds

02/01/11

how does this look today?

Page 77: Agile Development at GoGrid with Pallet and JClouds

(def branch-1-environment {:branch "http://svn....../branches/branch-1" :compute-service {:provider "gogrid" :identity "<username>" :credential "<password>" :endpoint "http://10...:8080/api/"} :db-name "branch-1-db" :db-properties env-network-properties :pre-bootstrap-fn #'setup-environment-db :bootstrap-tags {com.gogrid.nodes.services/LDAP 1 com.gogrid.nodes.services/Cache 1} :bootstrap-phases [:restart-cache :restart-LDAP] :verify-phases [:verify]})

Environment Definition

Page 78: Agile Development at GoGrid with Pallet and JClouds

user => (start branch-1-environment)

user => (verify branch-1-environment)

user => (destroy branch-1-environment)

Operation

Page 79: Agile Development at GoGrid with Pallet and JClouds

It’s a newcomer in the field.• Documentation needs work• Untested support for some combinations of flavors

and versions of Linux

Steep learning curve, a new language

OMG! It’s A Lisp!

Challenge with Pallet

Page 80: Agile Development at GoGrid with Pallet and JClouds
Page 81: Agile Development at GoGrid with Pallet and JClouds

Some pointers...

http://jclouds.org Adrian Cole et al.

http://palletops.com Hugo Duncan et al.

http://gogrid.com For more info on GoGrid services please contact:

Paul LappasVP Engineering & Co-Founder of [email protected]

GoGrid is hiring devops and SW engineers for their SF office (contact Paul too)

Page 82: Agile Development at GoGrid with Pallet and JClouds

02/01/11

Toni [email protected]

@tbatchelli@disclojure

Questions?