RUN YOUR JAVA CODE ON CLOUD FOUNDRY Andy Piper - @andypiper Cloud - - PowerPoint PPT Presentation

run your java code on cloud foundry
SMART_READER_LITE
LIVE PREVIEW

RUN YOUR JAVA CODE ON CLOUD FOUNDRY Andy Piper - @andypiper Cloud - - PowerPoint PPT Presentation

RUN YOUR JAVA CODE ON CLOUD FOUNDRY Andy Piper - @andypiper Cloud Foundry Developer Advocate, Pivotal Hello Im Andy Developer Advocate @ Cloud Foundry social web enthusiast maker, educator, LEGO fan OSS contributor Eclipse Project Lead


slide-1
SLIDE 1

RUN YOUR JAVA CODE ON CLOUD FOUNDRY

Andy Piper - @andypiper Cloud Foundry Developer Advocate, Pivotal

slide-2
SLIDE 2

Hello

I’m Andy

slide-3
SLIDE 3

a few things about me Developer Advocate @ Cloud Foundry social web enthusiast maker, educator, LEGO fan OSS contributor Eclipse Project Lead (Paho / MQTT) excited by “what’s next”, Internet of Things, etc. @andypiper apiper@gopivotal.com

slide-4
SLIDE 4

Developer Advocate?

hellz to the yeah!

slide-5
SLIDE 5

@andypiper

[works on]

#cloudfoundry

[at]

@gopivotal

slide-6
SLIDE 6

3 themes

  • penness, cloud computing,

and Java

slide-7
SLIDE 7
  • 1. Why be / do / think Open?
  • 2. Why is an Open Cloud Platform important?
  • 3. Why run Java on an open cloud?
slide-8
SLIDE 8
  • 1. Why be / do / think Open?
slide-9
SLIDE 9

An important year in software

1991

Hello everybody out there using minix - I’m doing a (free)

  • perating system

(just a hobby, won’t be big and professional like gnu) for 386(486) AT clones.

From:&torvalds@klaava.Helsinki.FI Newsgroups:&comp.os.minix Date:&25&Aug&91&20:57:08&GMT Organization:&University&of&Helsinki

slide-10
SLIDE 10

~21 years later: Linux has won

slide-11
SLIDE 11

Linux runs everywhere

(even old versions, on crashy airline entertainment systems...)

#P0WN ALL TEH GADGETZ !

slide-12
SLIDE 12

The Penguin is triumphant!

(maybe not this one…)

slide-13
SLIDE 13

Linux is ubiquitous

(but often invisible)

slide-14
SLIDE 14

It works.

slide-15
SLIDE 15
  • 2. What about Cloud?
slide-16
SLIDE 16

3 layers

IaaS, PaaS, SaaS

Infrastructure Platform Software

Gmail, Salesforce, Flickr, Google Docs... Amazon EC2, Google CE, OpenStack, vSphere, Joyent, Cloud Stack, Eucalyptus... Google AppEngine, Heroku, Cloud Foundry, EngineYard, Apprenda...

slide-17
SLIDE 17

How did we get here?

slide-18
SLIDE 18

Infrastructure Clouds

  • consumer web companies built out according to

their own needs to support Software

slide-19
SLIDE 19

But - still need to build & manage Platform

slide-20
SLIDE 20

Why is it so hard...?

A real deployment flow (!)

slide-21
SLIDE 21

An alternative approach...

Cloud Foundry can make it simpler!

cf#iaas.yml provision0<my0cloud> add_capacity0<my0cloud> target0<my0cloud> push0<my0app> create0<my0services> bind0<my0services> scale0<my0app>0+100

OPERATOR DEVELOPER

Cloud Deployment: 2-4 hours App Deployment: 30-90 seconds

slide-22
SLIDE 22

C L O U D F O U N D R Y

Demo

slide-23
SLIDE 23

Cloud Foundry - the Open PaaS

Open Source

Micro& Clouds Private& Clouds Public& Clouds

CUSTOM

SERVICES CUSTOM RUNTIMES

slide-24
SLIDE 24

All the pieces to make your own!

“if you can’t open it, you don’t own it” (O’Reilly MAKE)

slide-25
SLIDE 25

Open & public from the start

Code all on Github

slide-26
SLIDE 26

Google AppEngine, Heroku, Cloud Foundry, OpenShift, Stackato, Cloudbees, AppFog, Elastic Beanstalk, anyNines, Apprenda...

slide-27
SLIDE 27

Not all PaaSes are created equal...

Run on: AWS, OpenStack, vSphere... more to come!

slide-28
SLIDE 28

All about Choice

Private Clouds Public Clouds Micro Clouds

Build your own from github.com/cloudfoundry, buy from Pivotal, or run a compatible private version Run in a local virtual machine with identical services and runtimes (MCF, Vagrant) At run.pivotal.io

  • r any Cloud Foundry-

powered PaaS

slide-29
SLIDE 29

(pause)

slide-30
SLIDE 30

44 years since Mach 1

slide-31
SLIDE 31
  • 3. What about Java and the JVM?
slide-32
SLIDE 32

From VM-centric to Application Centric

Infrastructure One JVM VM Infrastructure One Infrastructure Two App Container 1

App Server

JVM Container 2

App Server

JVM Dev Framework Dev Framework App Server Configurations Manifests, Automations Infrastructure Two JVM VM Dev Framework App Server Configurations App App App

slide-33
SLIDE 33

Buildpacks

Buildpacks are responsible for preparing the machine image for an application

Application Container Runtime Operating System Libraries

DEA Buildpack

}

Droplet

slide-34
SLIDE 34

Compatibility

Cloud Foundry buildpacks follow the Heroku buildpack design

Cloud Foundry and Heroku buildpacks are compatible (if you take care to make them compatible) Other PaaS providers are adopting the buildpack design - emerging convention

slide-35
SLIDE 35

Built-in Buildpacks

→ → →

slide-36
SLIDE 36

Tested Buildpacks

https://github.com/cloudfoundry-community/cf-docs-contrib/wiki/Buildpacks

Languages Containers

Haskell

slide-37
SLIDE 37

Java Buildpack

Supports a variety of JVM languages, containers, and frameworks with a modular, configurable, and extensible design

slide-38
SLIDE 38

Java Buildpack Concepts Containers Frameworks JREs

OpenJDK, etc.

Java main() Tomcat Groovy Spring Boot CLI Play Spring config Play config Play JPA config New Relic

slide-39
SLIDE 39

Container Detection Criteria

Java main()

META-INF/MANIFEST.MF exists with Main-class attribute set

Tomcat

WEB-INF directory exists

Groovy

.groovy file with a main() method, or .groovy file with no classes, or .groovy file with a shebang (#!) declaration

Spring Boot CLI

  • ne or more POGO .groovy files

with no main() method, and no WEB-INF directory

Play

start and lib/play.play_*.jar exist

Choose zero or one

slide-40
SLIDE 40

Framework Detection Criteria

Spring

spring-core*.jar exists

Play config

Play application detected

Play JPA config

play-java-jpa plugin exists in app

New Relic

New Relic service bound to app

Choose all that apply

slide-41
SLIDE 41

Customization

Two ways to customize the Java buildpack Configure artifacts used by standard JREs, Containers, and Frameworks Extend the buildpack with your own JREs, Containers, and Frameworks

Customization is done by forking the buildpack

slide-42
SLIDE 42

Choice!

  • IBM donated WebSphere Liberty Buildpack
  • http://blog.cloudfoundry.com/2013/09/09/ibm-

websphere-liberty-buildpack-contributed-to-cloud- foundry/

slide-43
SLIDE 43

the new Spring

spring.io

slide-44
SLIDE 44

WEB

Controllers, REST, WebSocket

INTEGRATION

Channels, Adapters, Filters, Transformers

BATCH

Jobs, Steps, Readers, Writers

BIG DATA

Ingestion, Export, Orchestration, Hadoop

DATA

NON-RELATIONAL RELATIONAL

CORE

GROOVY FRAMEWORK SECURITY REACTOR GRAILS Full-stack, Web XD Stream, Taps, Jobs BOOT Bootable, Minimal, Ops-Ready

slide-45
SLIDE 45

Groovy and Spring Boot

slide-46
SLIDE 46

Groovy and Spring Boot

slide-47
SLIDE 47

Groovy and Spring Boot

slide-48
SLIDE 48

Spring and the Cloud

  • Goal: deploy Spring apps to the cloud without

changing a single line of code

  • Cloud Foundry automatically re-configures bean

definitions to bind to cloud services

  • Works with Spring and Grails
slide-49
SLIDE 49

Portability

slide-50
SLIDE 50

S P R I N G

Demo

slide-51
SLIDE 51
  • 4. ... the end?
slide-52
SLIDE 52

Join us!

... a pull request is all it takes!

slide-53
SLIDE 53

Connect

http://twitter.com/andypiper http://andypiper.co.uk http://slideshare.net/andypiper

slide-54
SLIDE 54

Image credits

  • Cloud cover slide http://www.flickr.com/photos/sjkingo/3150155150/
  • Star Wars Cookies http://www.flickr.com/photos/betsyweber/4961703633/

(Geek Pride Day, May 25 - http://readwrite.com/2013/05/23/geek-pride-day-celebrate)

  • Happy Tux http://igloo.crystalxp.net/ZeNDaMs
  • Signpost http://www.flickr.com/photos/16002150@N08/2006266695/
  • Other images are author’s own, or royalty-free and CC-licensed works

from Wikimedia Commons

  • Build your own Heroku video http://www.youtube.com/watch?v=e0EprkBamvQ