Just Enough Openstack for Docker

OpenStack is a large collection of complicated projects that join together to form a hard to deploy and harder to run distributed system. This talk will show you how you can harness the concepts of bimodal IT to increase agility in your IT organization by utilizing a minimal Openstack install and various Docker based tools to build a platform that will increase developer productivity.

Openstack is a large collection of complicated projects that join together to form a hard to deploy and harder to run distributed system. This talk will show you how you can harness the concepts of bimodal IT to increase agility in your IT organization by utilizing a minimal Openstack install and various Docker based tools to build a platform that will increase developer productivity.

Just Enough Openstack for Docker

  • Docker Docker Docker
  • Hard to deploy
  • Harder to run
  • distributed system
  • bimodal IT
  • increase agility in your IT organization
  • Minimal Openstack install
  • Docker based tools
  • build a platform
  • increase developer productivity

Just Enough Openstack for Docker

  • Bimodal IT
  • Just Enough Openstack [for Docker]
  • Docker on Openstack

Let's get to know eachother

Let's get to know eachother

Bimodal IT

Traditional IT

Pets

Forward Thinking

Cattle

Forward Thinking

Cattle


Docker and the Three Ways of DevOps by John Willis


Openstack is...

  • Hard to Install
  • Harder to Operate

Which Operating System ?

  • Redhat - RHEL, CentOS
  • Debian - Debian, Ubuntu

Which Openstack distro ?

  • OS native - Ubuntu, RHEL
  • from Source ... git://
  • Helion, Mirantis, ...
  • Roll your own packages

http://github.com/blueboxgroup/giftwrap


http://docs.openstack.org/admin-guide-cloud/content/logical-architecture.html

Openstack Big Tent
Configuration Management

Ursula

  • http://github.com/blueboxgroup/ursula
  • Curated and opinionated
  • Used to manage a lot of openstack clouds by a small team
  • Feature flags to enable/disable optional items
  • Kick the tires with Vagrant.
  • ~ 1200 ansible tasks to do a simple openstack install

Shameless Plug

<Bluebox Logo goes here>

WTF is Docker ?

https://www.docker.com/whatisdocker/

Docker vs VM

Dockerfile


# Base docker image
FROM paulczar/chrome

RUN apt-get install -y pepperflashplugin-nonfree \
    && rm -rf /var/lib/apt/lists/*

COPY local.conf /etc/fonts/local.conf


COPY . /slides

# Autorun chrome
ENTRYPOINT [ "/usr/bin/google-chrome-stable" ]
CMD [ "--user-data-dir=/data", "--no-sandbox", "file:///slides/index.html" ]
					

Docker Compose


nginx:
  build: .
  command: /app/bin/boot nginx
  volumes: [ .:/app ]
  links: [ mysql, hhvm ]
  ports: [ 8081:8080 ]
hhvm:
  build: .
  command: /app/bin/boot hhvm
  volumes: [ .:/app ]
  links: [ mysql ]
  ports: [ 9000 ]
mysql:
  image: orchardup/mysql
  ports: [ 3306:3306 ]
					

Factorish

http://factorish.github.io/factorish/#/

  • Run legacy apps in a container
  • Make the container 12 factor, not the app
  • Demo apps from simple python to full ELK stack
    • http://github.com/factorish/factorish
    • http://github.com/factorish/factorish-elk

Openstack Images for Docker

  • Ubuntu Trusty / Fedora
  • CoreOS / RancherOS
  • Atomic / Snappy

How to Docker with Openstack ?

  • Just plain old Docker.
  • Docker Machine
  • Deis
  • CoreOS + Fleet
  • Kubernetes
  • Rancher Labs

Docker Machine

https://github.com/docker/machine/releases

Docker Machine


$ docker-machine create -d openstack \
  --openstack-image-id 1525c3f3-1224-4958-bd07-da9feaedf18b \
  --openstack-flavor-id 2  --openstack-net-id ba0fdd03-72b5-41eb-bb67-fef437fd6cb4 \
  --openstack-floatingip-pool external \
  --openstack-ssh-user ubuntu --openstack-sec-groups docker \
    testenv
Creating machine...
To see how to connect Docker to this machine, run: docker-machine env testenv
$

Docker Machine


$ docker-machine env testenv
export DOCKER_TLS_VERIFY="1"
export DOCKER_HOST="tcp://x.x.x.x:2376"
export DOCKER_CERT_PATH="/home/pczarkowski/.docker/machine/machines/testenv"
export DOCKER_MACHINE_NAME="testenv"
$ eval "$(docker-machine env testenv)"
$ docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS

Docker Machine


$ docker run -p 80 --name nginx -d nginx
$ docker inspect nginx| grep HostPort
                    "HostPort": "32769"
$ curl x.x.x.x:32769
...
...
Welcome to nginx!

Docker Machine

  • Supports Docker-Swarm
  • Support Docker-Compose
  • No host volumes
  • Good for test/staging/demo
  • Not great for dev

DEIS

  • Most mature Opensource [docker] PAAS*
  • Heroku inspired workflow
  • distributed stateless applications
  • seperation of responsibilities
  • Solid docs for running on Openstack

DEIS


$ git clone https://github.com/deis/example-ruby-sinatra.git
$ cd example-ruby-sinatra
$ deis create && git push deis master
Creating application... done, created nimbus-insignia
Git remote deis added
...
-----> Launching...
       done, nimbus-insignia:v2 deployed to Deis
       http://nimbus-insignia.x.x.x.x.xip.io

$ curl http://nimbus-insignia.x.x.x.x.xip.io
Powered by Deis!
Running on container ID 88384adc62d4

DEIS


$ deis config:set POWERED_BY=openstack
Creating config... done, v3

=== nimbus-insignia
DEIS_APP: nimbus-insignia
POWERED_BY: openstack

$ curl http://nimbus-insignia.x.x.x.x.xip.io
Powered by openstack
Running on container ID 6440f619dcfc

DEIS


$ deis scale web=3
Scaling processes... but first, coffee!
...
$ curl http://nimbus-insignia.173.247.105.17.xip.io
Running on container ID 6440f619dcfc
$ curl http://nimbus-insignia.173.247.105.17.xip.io
Running on container ID cbcf905b8b34
$ curl http://nimbus-insignia.173.247.105.17.xip.io
Running on container ID 676cb76cb562

CoreOS + Fleet

  • CoreOS - minimal OS for running Containers
  • etcd - distrubuted Key/Value store
  • flannel - network overlay
  • fleet - Container Orchestration
  • fleet takes systemd units with special section
  • We actually just saw it in action with DEIS

CoreOS + Fleet


[Unit]
Description=deis-router

[Service]
EnvironmentFile=/etc/environment
ExecStartPre=/bin/sh -c "IMAGE=`/run/deis/bin/get_image /deis/router` && docker history $IMAGE >/dev/null 2>&1 || docker pull $IMAGE"
ExecStartPre=/bin/sh -c "docker inspect deis-router >/dev/null 2>&1 && docker rm -f deis-router || true"
ExecStart=/bin/sh -c "IMAGE=`/run/deis/bin/get_image /deis/router` && docker run --name deis-router --rm -p 80:80 -p 2222:2222 -p 443:443 -e EXTERNAL_PORT=80 -e HOST=$COREOS_PRIVATE_IPV4 $IMAGE"
ExecStopPost=-/usr/bin/docker rm -f deis-router

[Install]
WantedBy=multi-user.target

[X-Fleet]
Conflicts=deis-router@*.service

Kubernetes

  • Came from Google...but is not Google.
  • IAAS but for containers.
  • You still need to tell it what to run and where.
  • Magnum!

Docker Registry

  • Use private repos on Docker Hub ( $$$ )
  • run Docker Registry locally ( OS )
  • run Docker Trusted Registry ( $$$ )
  • run CoreOS Enterprise Registry ( $$$ )

Docker Workflow #1

  • Development on laptop (docker-compose)
  • Testing/QA on "Cloud" ( docker-compose + docker-machine )
  • Jenkins to build docker image, store in registry.
  • Staging / Production on "Cloud" ( Ansible or Chef )

Docker Workflow #2

  • Development on laptop (docker-compose)
  • Create PR on github
  • Jenkins runs unit tests on PR ( in docker )
  • Jenkins deploys test app of PR ( in DEIS )
  • Jenkins/Human performs Integration tests against PR
  • Jenkins/Human merges PR to master
  • Jenkins deploys Staging App ( in DEIS )
  • Human approves and cuts release in Github
  • Jenkins deploys Prod App ( in DEIS )

Finish

Questions?