the power of buildpacks in a platform as-a-service (paas)

28
The Power of Buildpacks in PaaS The Platform for the Agile Enterprise John Wetherill Technology Evangelist Ho Ming Li Cloud Engineer

Upload: activestate

Post on 06-May-2015

633 views

Category:

Technology


5 download

DESCRIPTION

uildpacks are the primary method for deploying applications in Stackato. In essence a buildpack is a network-available directory containing a handful of configuration scripts used to set up containers to provision cloud applications. Developed by Heroku, buildpacks are part of the Cloud Foundry v2 architecture. Understanding their use and power in a private PaaS is important in order give you the flexibility you need to deploy almost any applications, regardless of its complexity, technology stack, or dependencies. Buildpacks will help your users tremendously by setting up the exact environment according to their application needs. In this webinar, Technology Evangelist, John Wetherill, and Cloud Engineer, Ho Ming Li, will discuss the power of buildpacks in more detail. You will learn: - What a buildpack is - The history/origins of buildpacks - Which sites and services support buildpacks today - Who uses buildpacks and why they are important - How buildpacks work - How custom buildpacks are used and created - Buildpack alternatives / alternate approaches - Buildpack limitations and gotchas - The future of buildpacks http://www.activestate.com/webinars/power-buildpacks-paas

TRANSCRIPT

Page 1: The Power of Buildpacks in a Platform as-a-Service (PaaS)

The Power of Buildpacks in PaaSThe Platform for the Agile EnterpriseJohn WetherillTechnology Evangelist

Ho Ming LiCloud Engineer

Page 2: The Power of Buildpacks in a Platform as-a-Service (PaaS)

activestate.com/stackato | @activestate | #stackato | activestate.com/blog | Copyright 2014

Recent Events

Page 3: The Power of Buildpacks in a Platform as-a-Service (PaaS)

activestate.com/stackato | @activestate | #stackato | activestate.com/blog | Copyright 2014

Recent Events

Page 4: The Power of Buildpacks in a Platform as-a-Service (PaaS)

activestate.com/stackato | @activestate | #stackato | activestate.com/blog | Copyright 2014

What is Stackato?

A secure, stable, and commercially supported Platform-as-a-Service (PaaS) built with open source components such as Cloud Foundry and Docker

Page 5: The Power of Buildpacks in a Platform as-a-Service (PaaS)

activestate.com/stackato | @activestate | #stackato | activestate.com/blog | Copyright 2014

Buildpacks Defined

“Cloud Foundry uses buildpacks to transform user-provided artifacts into runnable applications”

Buildpacks can be used to:

• examine user-provided artifacts• download dependencies• configure application properties• specify the application entry point and runtime options

Page 6: The Power of Buildpacks in a Platform as-a-Service (PaaS)

activestate.com/stackato | @activestate | #stackato | activestate.com/blog | Copyright 2014

Anatomy of a Buildpack

bin/detect

bin/release

bin/compile

• a buildpack is a network-accessible git repository• repo must contain a bin directory with three scripts

Page 7: The Power of Buildpacks in a Platform as-a-Service (PaaS)

activestate.com/stackato | @activestate | #stackato | activestate.com/blog | Copyright 2014

detect script

• determine whether to apply a buildpack• single parameter: BUILD_DIR• script examines this directoryIf buildpack can service this app: • print framework name to stdout • exit 0

Page 8: The Power of Buildpacks in a Platform as-a-Service (PaaS)

activestate.com/stackato | @activestate | #stackato | activestate.com/blog | Copyright 2014

sample detect script

#!/bin/sh

if [-f $1/*.js]; then# looks like a node application echo “nodejs” exit 0else exit 1fi

Page 9: The Power of Buildpacks in a Platform as-a-Service (PaaS)

activestate.com/stackato | @activestate | #stackato | activestate.com/blog | Copyright 2014

compile script

• perform the buildpack transformation• three parameters: BUILD_DIR CACHE_DIR ENV_DIR

• anything goes here: download dependencies, configure environment, tweak files

Page 10: The Power of Buildpacks in a Platform as-a-Service (PaaS)

activestate.com/stackato | @activestate | #stackato | activestate.com/blog | Copyright 2014

sample compile script

#!/bin/shif [ ! -s $1/hello.txt ]; then echo "hello.txt was empty" exit 1fi

cat $1/hello.txt | sed -e "s/[Hh]ello/Goodbye/g" > $1/goodbye.txt

Page 11: The Power of Buildpacks in a Platform as-a-Service (PaaS)

activestate.com/stackato | @activestate | #stackato | activestate.com/blog | Copyright 2014

sample compile script

#!/bin/sh

wget something

apt-get install something-else

echo “some: config” > config-file.yml

Page 12: The Power of Buildpacks in a Platform as-a-Service (PaaS)

activestate.com/stackato | @activestate | #stackato | activestate.com/blog | Copyright 2014

release script

• release script must output yaml

• specify “addons” • specify Procfile entries (app entrypoint)

(config_vars from Heroku deprecated - use shell-script in app instead)

Page 13: The Power of Buildpacks in a Platform as-a-Service (PaaS)

activestate.com/stackato | @activestate | #stackato | activestate.com/blog | Copyright 2014

sample release script

#!/usr/bin/env bash

cat <<EOF---web: java $JAVA_OPT jetty-runner --port $PORTaddons: mysql:devEOF

Page 14: The Power of Buildpacks in a Platform as-a-Service (PaaS)

activestate.com/stackato | @activestate | #stackato | activestate.com/blog | Copyright 2014

Procfile

• Not part of buildpack• Specifies app entrypoint• Procfile must be present in app build dir

Sample procfile for Java app:

web: java $JAVA_OPTS jetty-runner --port $PORT

Page 15: The Power of Buildpacks in a Platform as-a-Service (PaaS)

activestate.com/stackato | @activestate | #stackato | activestate.com/blog | Copyright 2014

CloudFoundry / Stackato built-in buildpacks

• https://github.com/cloudfoundry/java-buildpack

• https://github.com/cloudfoundry/heroku-buildpack-ruby

• https://github.com/cloudfoundry/heroku-buildpack-nodejs

For Java, Ruby, NodeJS

Page 16: The Power of Buildpacks in a Platform as-a-Service (PaaS)

activestate.com/stackato | @activestate | #stackato | activestate.com/blog | Copyright 2014

CloudFoundry Community Buildpacks

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

Page 17: The Power of Buildpacks in a Platform as-a-Service (PaaS)

activestate.com/stackato | @activestate | #stackato | activestate.com/blog | Copyright 2014

Summary

Procfile

Application source

Buildpack

Page 18: The Power of Buildpacks in a Platform as-a-Service (PaaS)

activestate.com/stackato | @activestate | #stackato | activestate.com/blog | Copyright 2014

Minimal buildpack

https://github.com/heroku/heroku-buildpack-hello

Page 19: The Power of Buildpacks in a Platform as-a-Service (PaaS)

activestate.com/stackato | @activestate | #stackato | activestate.com/blog | Copyright 2014

Buildpacks and stackato.yml

stackato.yml is used in conjunction with buildpack to:

• specify buildpack location• configure environment• specify staging and runtime hooks• request services• request resources• specify app properties

Page 20: The Power of Buildpacks in a Platform as-a-Service (PaaS)

activestate.com/stackato | @activestate | #stackato | activestate.com/blog | Copyright 2014

Specifying Buildpacks

• Buildpack can be selected in stackato.yml:

buildpack: https://github.com/user/mybuildpack.git

• Or as option to stackato command:

stackato push --buildpack ssh://git/buildpack.git

Page 21: The Power of Buildpacks in a Platform as-a-Service (PaaS)

activestate.com/stackato | @activestate | #stackato | activestate.com/blog | Copyright 2014

Legacy Buildpack

• special bundled buildpack for “legacy” Stackato apps• provides all frameworks from pre 3.0 Stackato• specify framework and runtime in stackato.yml

name: bottle-py3framework: type: python runtime: python32

Page 22: The Power of Buildpacks in a Platform as-a-Service (PaaS)

activestate.com/stackato | @activestate | #stackato | activestate.com/blog | Copyright 2014

Buildpack Catalog

http://buildpack-catalog.stacka.to/buildpacks/

Page 23: The Power of Buildpacks in a Platform as-a-Service (PaaS)

activestate.com/stackato | @activestate | #stackato | activestate.com/blog | Copyright 2014

Customizing a buildpack

Why customize?

• alternate versions of runtimes, frameworks, services

• new (or old) runtimes (FORTRAN anyone?)

• complete control of app provisioning process

Page 24: The Power of Buildpacks in a Platform as-a-Service (PaaS)

activestate.com/stackato | @activestate | #stackato | activestate.com/blog | Copyright 2014

Customizing a buildpack

Three simple steps:

1. fork an existing buildpack

2. tweak the scripts in bin, add assets

3. specify location of new buildpack in stackato.yml or as parameter to “stackato push --buildpack https://…”

Page 25: The Power of Buildpacks in a Platform as-a-Service (PaaS)

activestate.com/stackato | @activestate | #stackato | activestate.com/blog | Copyright 2014

Buildpacks and Licenses

EULAsSoftware license stringsAPI keysCommercial Software

Example:

https://github.com/cloudfoundry/ibm-websphere-liberty-buildpack.git

Page 26: The Power of Buildpacks in a Platform as-a-Service (PaaS)

activestate.com/stackato | @activestate | #stackato | activestate.com/blog | Copyright 2014

Buildpack Futures

Better Asset Caching

More services and frameworks

Docker Integration?

Page 27: The Power of Buildpacks in a Platform as-a-Service (PaaS)

activestate.com/stackato | @activestate | #stackato | activestate.com/blog | Copyright 2014

Why Enterprises Use Stackato

Faster Time to MarketWith Stackato, developers can get apps to the cloud in minutes, not weeks.

Greater SecurityStackato has been extended and hardened to provide enterprises with tighter security, better compliance, and more control over secure, sensitive data.

Agility and ScalabilityAs usage grows, Stackato scales applications to deliver performance for end-users demand.

Productivity and InnovationStackato automates the configuration, deployment, and management of applications.

FlexibilityStackato gives developers and IT managers the freedom they need. The polyglot nature of Stackato means you can give your developers the flexibility to work with the best choice of language for any task.

Page 28: The Power of Buildpacks in a Platform as-a-Service (PaaS)

Download your own Stackato micro cloud at: http://www.activestate.com/stackato