Docking with Unicorns


http://lady-cybercat.deviantart.com

tech.paulcz.net/presentation-cloud-austin-deis Created by Paul Czarkowski / @pczarkowski

Platform as a Service

The Holy Grail of Cloud

  • Step 1: Write Code
  • Step 2: ...
  • Step 3: Application!


http://www.youtube.com/watch?v=n7e5N6goLpQ
^ My Little Pony Monty Python & Holy Grail Mashup

PAAS is nothing new

  • Heroku
  • Elastic Beanstalk
  • Azure


but it is newly hot.

Docker is part of the reason why.

Platform as a Service

no longer the unicorn in the room


Docker based PAAS platforms

  • DotCloudDocker
  • Dokku < 100 lines of code!
  • flynn.io
  • deis.io
  • tsuru.io
  • Stackato*
  • Openshift*


* not docker based, but moving in that direction?

DEIS.IO

What even is DEIS ?

opensource PAAS

pronounced DAY-iss

  • Docker
  • Chef
  • Nginx
  • Git
  • IaaS (ec2,rackspace,digitalocean)

What even is Deis ?

deploys [12 factor] applications

  • Heroku Buildpacks
  • Chef Recipes
  • Docker Images

WTF 12 factor ?

http://12factor.net/

Best practices for building SAAS / SOA apps

Summary: Don't be wordpress.

Heroku Buildpacks

Tooling to build and deploy polyglot web applications.

Example: minimal NodeJS app


example-nodejs-express
├── package.json
├── Procfile
└── server.js

Deis Architecture

Deis Architecture

Chef Server

  • bootstraps nodes ( inc Controller )
  • Databags* for Application state


* functionality moving to etcd + confd

Deis Architecture

Deis Controller

  • Management Endpoint - Web/API
  • Talks to Chef / IAAS to provision/decom nodes
  • git service
  • Builds, Scales, and Destroys:
    • Formations
    • Layers
    • Applications

Deis Architecture

Deis Controller

Deis Architecture

Layers

  • worker nodes for Formation
  • sets of heterogeneous nodes
  • scale easily
  • Proxy Layers - handles URL routing to app
  • Runtime Layer - apps run here.

Deis Architecture

Formations

  • groupings of Layers
  • arbitrary seperation of workloads:
    • could be regions: US,EU,AU,etc
    • could be environment: dev, test, prod

Deis Architecture

Applications

  • Abstraction layer for your Application, not your actual app.
  • tied to a specific Formation
  • uses Containers to process requests and run jobs for deployed git repo.
  • Developer interface to push code, change config, scale, view logs, etc.

Application Deployment

http://twentypercentcooler.net/post/show/23858/2012-cannon-duo-earth_pony-eeveetachi-equine-eyewe

Supported Languages



  • Ruby, Python, Node.js, Java, Clojure, Scala,
  • Play, PHP, Perl, Dart and Go.
  • Heroku Buildpacks, Docker images, Chef recipes.

Application Deployment

Stage 1 - Create

  • Dev pulls app git repo from github
  • Dev invokes `deis create` command
  • deis controller creates a git repo for app
  • deis client adds git repo as remove to local git

Application Deployment

Stage 2 - Build

  • Dev pushes code via 'git push deis master'
  • git push triggers app build
  • uses slugbuilder to process buildpack into a tarball
  • injects tarball into slugrunner container

Application Deployment

Stage 3 - Release

  • triggered when Build is created or config changed
  • Build is combined with config
  • tags result with release #
  • pushes resulting container to private registry

Application Deployment

Stage 4 - Run

  • Updates Chef databags and converges all nodes in Formation
  • Specifies:
    • app releases, container placement, proxy layer configs
  • Performed in specific order to reduce downtime (to zero?)

Backing Services

database, message queue, etc.

  • decoupled -> environment variables
    • Deis Applications
    • provided by existing database / MQ
    • provided by third party services ( Cloud Databases, RDS, etc)
  • Swap backing services by changing env variables.

Live Demo!

http://insanekitteh.deviantart.com

Create/Deploy Application


$ cd ~/paas/apps/nodejs
$ deis create --formation=demo --id=cloudaustin
Creating application... done, created cloudaustin
Warning: Permanently added the ECDSA host key for IP address '23.253.89.126' to the list of known hosts.
Git remote deis added
$ git push deis master
Counting objects: 181, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (86/86), done.
Writing objects: 100% (181/181), 28.53 KiB | 0 bytes/s, done.
Total 181 (delta 101), reused 165 (delta 92)
-----> Node.js app detected
-----> Requested node range: 0.10.x
-----> Resolved node version: 0.10.24
-----> Downloading and installing node
-----> Installing dependencies
       Launching... done, v2
<< SNIP >>
-----> cloudaustin deployed to Deis
       http://cloudaustin.deis.paulcz.net
$
					

Modify/Redeploy Application


$ cd ~/paas/apps/nodejs
$ vim server.js
...
...
$ git commit -am 'cloud austin'
$ git push origin deis
<< SNIP >>
-----> Node.js app detected
<< SNIP >>
-----> cloudaustin deployed to Deis
       http://cloudaustin.deis.paulcz.net
$
					

Application Info


$ deis  info
=== cloudaustin Application
{
  "updated": "2014-01-19T20:48:09.187Z",
  "uuid": "a871873f-36cd-439f-a4cd-c84db752d598",
  "created": "2014-01-19T20:48:09.187Z",
  "formation": "demo",
  "owner": "admin",
  "id": "cloudaustin",
  "containers": "{}"
}

=== cloudaustin Containers

--- web: `node server.js`
web.1 up 2014-01-19T20:50:02.125Z (demo-nodes-1)
$
					

Application Logs


$ deis logs
Jan 19 20:33:37 deis-controller cloudaustin: Config cloudaustin-v1 updated
Jan 19 20:33:37 deis-controller cloudaustin: Build cloudaustin- created
Jan 19 20:33:37 deis-controller cloudaustin: Release cloudaustin-v1 created
Jan 19 20:45:20 deis-controller cloudaustin: Config cloudaustin-v1 updated
Jan 19 20:45:20 deis-controller cloudaustin: Build cloudaustin- created
Jan 19 20:45:20 deis-controller cloudaustin: Release cloudaustin-v1 created
Jan 19 20:48:09 deis-controller cloudaustin: Config cloudaustin-v1 updated
Jan 19 20:48:09 deis-controller cloudaustin: Build cloudaustin- created
Jan 19 20:48:09 deis-controller cloudaustin: Release cloudaustin-v1 created
Jan 19 20:50:02 deis-controller cloudaustin: Build cloudaustin-7fb1163 created
Jan 19 20:50:02 deis-controller cloudaustin: Release cloudaustin-v2 created
Jan 19 20:50:02 deis-controller cloudaustin: Containers scaled web=1
Jan 19 20:50:14 demo-nodes cloudaustin[web.1]: Server listening on port 10001 in development mode
Jan 19 20:56:19 deis-controller cloudaustin: Build cloudaustin-f7e94ab created
Jan 19 20:56:19 deis-controller cloudaustin: Release cloudaustin-v3 created
Jan 19 20:56:39 demo-nodes cloudaustin[web.1]: Server listening on port 10001 in development mode
$
					

Expecting Visitors? Scale App


$ deis scale web=6
Scaling containers... but first, coffee!
done in 21s

=== cloudaustin Containers

--- web: `node server.js`
web.1 up 2014-01-19T20:50:02.125Z (demo-nodes-1)
web.2 up 2014-01-19T21:04:25.013Z (demo-nodes-2)
web.3 up 2014-01-19T21:04:25.023Z (demo-nodes-2)
web.4 up 2014-01-19T21:04:25.031Z (demo-nodes-1)
web.5 up 2014-01-19T21:04:25.040Z (demo-nodes-2)
web.6 up 2014-01-19T21:04:25.050Z (demo-nodes-1)
$
					

Destroy your app when done.


$ deis destroy --app=cloudaustin --confirm=cloudaustin
Destroying cloudaustin... done in 40s
Git remote deis removed
$
					

Live Demo Finished!


http://www.youtube.com/watch?v=R9oRrXX82vI

Install your own PAAS?

http://deis.io/get-deis/

Install guide for Rackspace Public Cloud

http://www.thinkgeek.com/product/e5a7/

Thanks!

BY Paul Czarkowski / @pczarkowski