Continuous Delivery with Grails and CloudBees

Post on 13-May-2015

1.512 views 3 download

Tags:

description

A presentation given at the 2011 Grails Exchange on Continuous Delivery in the Cloud with Grails using CloudBees PaaS.

Transcript of Continuous Delivery with Grails and CloudBees

Continuous Delivery in the Cloud with Grails and CloudBees®

09/12/11

©2011 Cloud Bees, Inc. All Rights Reserved

About Marco

©2011 CloudBees, Inc. All Rights Reserved

Enterprise Java developer.Now working primarily with Groovy & Grails.Advocate of using G&G on Linux!

Previously: Shazam, Associated NewspapersCurrently: Burberry

Maintainer:Groovy, Grails and Griffon PPA for Ubuntu Grails plugins: cloud-bees, itunes-service, jmock

@marcoVermeulen

About Nicolas

©2011 CloudBees, Inc. All Rights Reserved

Senior Engineer Cloudbees● customer support● conferences & evangelism● DEV@Cloud contributor

Jenkins contributorMaven committerJUG-Leader

Overview

©2011 CloudBees, Inc. All Rights Reserved

● All things Continuous: some terminology● The Deployment Pipeline● Our Quest in taking it to the Cloud● The Matrix● About CloudBees● The Grails cloud-bees plugin● Demo 1: grails cloud-bees● Demo 2: Continuous Deployment● The Web Console

All Things Continuous...

©2011 CloudBees, Inc. All Rights Reserved

Continuous Integration (CI):

What is it?

All Things Continuous...

©2011 CloudBees, Inc. All Rights Reserved

Continuous Integration (CI):

Coined by Kent Beck as part of eXtreme Programming.

● integrate work frequently into mainline● multiple integrations per day● integration verified by automated tests● results in subsequent build● detect integration errors early!● results in cohesive software more rapidly

-Martin Fowlerhttp://martinfowler.com/articles/continuousIntegration.html

All Things Continuous...

©2011 CloudBees, Inc. All Rights Reserved

Continuous Deployment:

"...is actually deploying every change into production, every day or more frequently."

-Martin Fowler

http://martinfowler.com/delivery.html

All Things Continuous...

©2011 CloudBees, Inc. All Rights Reserved

Continuous Delivery:

"...is about keeping your application in a statewhere it is always able to deploy into production."

-Martin Fowler

http://martinfowler.com/delivery.html

The Deployment Pipeline

©2011 CloudBees, Inc. All Rights Reserved

The Deployment Pipeline

©2011 CloudBees, Inc. All Rights Reserved

DEV

Integ.

Staging

PROD

build, test, analyse,...

● smaller jobs● parallelism● build promotion

Implementing efficient build pipeline

The Quest

©2011 CloudBees, Inc. All Rights Reserved

● PaaS not IaaS● Groovy & Grails support● Robust Developer Tooling● Hosted Continuous Integration (CI) solution● Support for Continuous Deployment● Cloud based● Holistic Solution● Runtime monitoring and tooling

The Matrix

©2011 CloudBees, Inc. All Rights Reserved

Vendor PaaS/IaaS Deployment Availability Tooling Hosted CI Database

EC2 Iaas Deploy any WAR

Fully Available Eclipse None, may be provisioned

Amazon RDS: MySQL,Oracle

Elastic Beanstalk

PaaS Fully Available None

CloudBees PaaS Deploy and WAR

Fully Available Eclipse Plugin Jenkins & Nectar

MySQL,3rd party DS

CloudFoundry PaaS Any Spring or Grails app.

Still in Beta Spring Source Tool Suite +CLI

None MySQL, Mongo, Redis

Google App Engine

PaaS Java + Servlet environment

Fully Available Eclipse + CLI None BigTable, MySQL with JPA or JDO

Gaelyk PaaS Java + Servlet env + Groovy!

Fully Available Eclipse + CLI None BigTable, MySQL with JPA or JDO

Heroku PaaS Not JEE compliant! No WARs!

Fully Available CLI None Postgres,3rd party SaS

Side-by-side comparison of Cloud Vendors

About CloudBeesOur Mission Become the leading Java™ Platform

as a Service (PaaS)

Strategy

● CloudBees services the complete lifecycle of Cloud application development and deployment.

● Focus on Applications● Transparent management of

servers, VMs and IT.

Why we're differentDEV@cloud: Cloud Services for DevelopersRUN@cloud: Frictionless runtime PaaS for Java apps

CloudBees PaaS

©2011 CloudBees, Inc. All Rights Reserved

Continuous Development - Continuous Deployment

JenkinsRepositories

DEV@cloud

MySQL Java EE 6 WP

Code Build ManageStage DeployTest

Scalability Availability Reliability

Monitoring Alerting Billing

Core Services

Deployment Manager

CloudBees founding team

Grails cloud-bees Plugin

©2011 CloudBees, Inc. All Rights Reserved

● Provides CloudBees SDK with no installation● Handy CLI scripts from within Grails project● Allow for interaction with Apps and DBs● All provided scripts can be called from within

a Jenkins build!

Grails cloud-bees Plugin

©2011 CloudBees, Inc. All Rights Reserved

Applications can be Deployed and Deleted:

grails bees-app-deploygrails bees-app-delete

Applications can be Interrogated:

grails bees-app-infograils bees-app-list

Applications can be Controlled:

grails bees-app-startgrails bees-app-stopgrails bees-app-restart

Grails cloud-bees Plugin

©2011 CloudBees, Inc. All Rights Reserved

Application logs tailed in real time!

grails bees-app-tail

Dec 5, 2011 3:30:42 PM com.staxnet.appserver.utils.AppServerConfiguration readAppServerConfigINFO: loading app config: /var/staxapps/8995/appserver.xmlDec 5, 2011 3:30:42 PM com.staxnet.appserver.TomcatServerBase initConfigurationINFO: Creating Tomcat server configuration at /var/staxapps/8995/staxcat/workDec 5, 2011 3:30:42 PM net.stax.appserver.admin.AdminEngine createAdminHttpConnectorINFO: Initializing admin-http-connector protocol: org.apache.coyote.http11.Http11ProtocolDec 5, 2011 3:30:43 PM net.stax.appserver.webapp.WebAppEngine createWebContextsINFO: loading app [] from /var/staxapps/8995/staxcat/install/webapp.warDec 5, 2011 3:30:43 PM net.stax.appserver.webapp.WebAppEngine...

Grails cloud-bees Plugin

©2011 CloudBees, Inc. All Rights Reserved

Databases can be Provisioned and Deleted:

grails bees-db-creategrails bees-db-delete

Databases can be Interrogated:

grails bees-db-infograils bees-db-list

Grails cloud-bees Plugin

©2011 CloudBees, Inc. All Rights Reserved

Demo!

Deploying the Beeline

©2011 CloudBees, Inc. All Rights Reserved

Setup● Open your CloudBees account.● Add config to: $HOME/.grails/settings.groovy

cloudbees.account = 'ACCOUNT'cloudbees.api.key = 'KEY'cloudbees.api.secret = 'SECRET'

The ProjectClone the project from GitHub:

git clone git@github.com:marcoVermeulen/beeline.git

Deploying the Beeline

©2011 CloudBees, Inc. All Rights Reserved

The Plugingrails install-plugin cloud-beesResolving plugin cloud-bees. Please wait......Plugin cloud-bees-0.5 installedPlugin provides the following new scripts:------------------------------------------grails bees-app-stopgrails bees-app-listgrails bees-app-restartgrails bees-app-deletegrails bees-db-infograils bees-app-startgrails bees-test-appgrails bees-app-checksumsgrails bees-db-creategrails bees-app-tailgrails bees-db-deletegrails bees-app-deploygrails bees-app-infograils bees-db-list

Deploying the Beeline

©2011 CloudBees, Inc. All Rights Reserved

Create a Database in the Cloud!

grails bees-db-createDatabase created successfully.Database ID : beelinez

grails bees-db-infoDatabase Name : beelinez created : Wed Dec 07 23:10:57 GMT 2011 owner : hashcode username : beelinez password : changeme! master : ec2-174-129-9-255.compute-1.amazonaws.com port : 3306 slaves : [] status : active

Also gives a handy datasource definition to copy and pasteinto your DataSource.groovy file!!!

Deploying the Beeline

©2011 CloudBees, Inc. All Rights Reserved

To the Cloud we go!

grails bees-app-deployPreparing the BeesClient ...Deploying hashcode/beeline tagged at version 0.1........................uploaded 25%........................uploaded 50%........................uploaded 75%........................upload completeddeploying application to server(s)...Application uploaded successfully to: http://beeline.hashcode.cloudbees.net

That's all there is to it!

Grails cloud-bees Plugin

©2011 CloudBees, Inc. All Rights Reserved

Q & A