Friday, December 29, 2017

Buildpacks

04 What are buildpacks?

This content is copyright of CloudCredo. © CloudCredo 2015. All rights reserved.

Feature

As a CF hero
I want a simple static website
So that I can focus on building my product

What are buildpacks?

A Cloud Foundry component that 
resolves your app's runtime dependencies

Why buildpacks?

  • Simplify app deployment - focus on your code
  • Fewer files, quicker app deploys
  • Produce self-contained, runnable app artefacts

What does a buildpack do?

  • Input is the application code
  • Examines application and fulfils dependencies
  • Output is a droplet
  • Metadata output defines ENV vars and start command
Each buildpack participates in election

How does a buildpack work?

  1. bin/detect
  2. bin/compile
  3. bin/release

Where does the buildpack run?

  • Uses the host kernel with a rootfs (jeos)
  • Default rootfs is cflinuxfs2 (based on Ubuntu 14.04 Trusty)
  • Buildpack execution and app runtime are in containers
  • Cloud Foundry uses Garden for containerisation

Cloud Foundry 
deployment flow 
revisited

  1. Developer pushes application
  2. Ordered list of buildpacks detect app compatibility
  3. Winning buildpack runs compile and release (staging)
  4. Resulting droplet is store in blobstore
  5. Droplets are deployed in containers for running apps

How many types of buildpacks?

  1. Default buildpacks
  2. Community buildpacks
  3. Heroku buildpacks
  4. Custom buildpacks
Online and Offline

1. Default buildpacks

$ cf buildpacks

buildpack position filename
ruby_buildpack 1 ruby_buildpack-cached-v1.6.7
nodejs_buildpack 2 nodejs_buildpack-cached-v1.5.0
java_buildpack 3 java-buildpack-v3.2
go_buildpack 4 go_buildpack-cached-v1.6.2
liberty_buildpack 5 liberty_buildpack
python_buildpack 6 python_buildpack-cached-v1.5.1
php_buildpack 7 php_buildpack-cached-v4.1.4
staticfile_buildpack 8 staticfile_buildpack-cached-v1.2..
binary_buildpack 9 binary_buildpack-cached-v1.0.1

2. Community buildpacks


3. Heroku buildpacks

  • CF buildpacks are based on them
  • They are interchangeable* (mostly)

4. Custom buildpacks

  • Your own language deserves its own buildpack
  • As simple or as complicated as you want

Static buildpack

# From the training home directory:
$ cd 04-buildpacks/static-app
$ cf push
$ cf app static-app

state since cpu memory disk
#0 running 2015-11-02 0.0% 6.5M of 16M 33.6M of 64M

Scale app with ease

$ cf scale static-app -i 32
$ cf app static-app

state since cpu memory disk
#0 running 2015-11-02 0.0% 6.5M of 16M 33.6M of 64M
#1 starting 2015-11-02 0.0% 0 of 16M 0 of 64M
#2 running 2015-11-02 0.0% 6.9M of 16M 33.5M of 64M
...
#30 running 2015-11-02 0.0% 6.8M of 16M 33.5M of 64M
#31 running 2015-11-02 0.0% 7M of 16M 33.6M of 64M

DELIVERED

As a CF hero
I want a simple static website
So that I can focus on building my product

No comments:

Post a Comment

உப்பு மாங்காய்

சுருக்குப்பை கிழவி. சுருக்கங்கள் சூழ் கிழவி. பார்க்கும் போதெல்லாம் கூடையுடனே குடியிருப்பாள். கூடை நிறைய குட்டி குட்டி மாங்காய்கள். வெட்டிக்க...