You are on page 1of 16

CI&D w/Docker @ SpareFoot

!
From Development to Production w/Docker
!

!Steve Woodruff @sjwoodr


swoodruff@sparefoot.com
Meet Steve
Originally from Chicago

BS Comp Sci 92 - IL State University

MS Info Sys Mgmt 08 - Keller

System Admin for IBM, 1996-2000

Development & CM for Motorola, 2000-2011

CI&D on SPAWAR Project for the VA, 2011-2014

DevOps / CI&D / Automation @ SpareFoot, 2014


SpareFoot Info

SpareFoot is the worlds largest, simplest and best


marketplace for self-storage.

Founded 2008

Were establishing ourselves as the technology and


thought leaders of self-storage.

Located downtown Austin


SpareFoot Environment Overview
Load Balancer

Static
DB Workers Servers /
Cache
App
Servers

Primarily a PHP environment + mysql


Types of Environments

DEV STG PROD

Every Commit
Reviewed Changes
Production Code
GateKeeper Workflow
Bamboo for CI & Stash for Source Control

Devs work on feature branches for each Jira story

Each commit & push of a branch to Stash results in Bamboo


building that code, deploying it to DEV and executing tests. If the
tests pass, that code is pushed to master. Master is our dirty
mainline branch.

Devs submit Pull-Requests in Stash for when they want their code to
actually be deployed to production - the code is merged to the
release branch, which gets built by Bamboo and deployed to our
Staging Environment (STG) and tested again.
Why Docker?
Primarily a PHP shop

Suddenly doing nodejs development

Our DevOps team is so small, wed have trouble keeping


up with the constantly changing requirements for the app
servers

We use SaltStack to rapidly deploy new servers but if


the requirements change over the course of a single
sprint its hard to keep up.
Docker

Dockers Build, Ship, & Run philosophy allows us to


build Docker App Servers, let the developers focus on
the software in the container, and we take care of
deploying it.

Docker lets us abstract away any system level


differences between the developers environment and
the dev, staging, & production environments.
Docker -vs- Virtual Machines
Docker -vs- Virtual Machines
A Typical Dockerfile
FROM ubuntu:14.04!
!
RUN apt-get update ; apt-get -y install
nodejs npm git supervisor wget!
!
RUN ln -sf /usr/bin/nodejs /usr/bin/node!
!
ADD supervisord.conf /etc/supervisor/
conf.d/supervisord.conf!
!
RUN npm install -g mocha!
!
EXPOSE 3000!
!
CMD ["/usr/bin/supervisord"]
Typical Docker Commands
Build the docker image and push to the registry

# docker build --rm=true --force-rm=true -t


docker.sparefoot.com:5000/yim:${bamboo.buildNumber} .

# docker push docker.sparefoot.com:5000/yim:$


{bamboo.buildNumber}

Run the docker image

# docker run --dns=8.8.8.8 -e NODE_ENV=dev -v /opt/


sparefoot/apps/yim/live:/yim -p 3000:3000 -d
docker.sparefoot.com:5000/yim:${bamboo.buildNumber}
The Docker Registry

Docker Hub is a PUBLIC registry of docker images that


people create and share with each other

If you need a PRIVATE registry, you can run the docker


registry app, which we do. in a Docker container!

The registry lets you have a data store outside of the


container itself so we save images in Amazon S3.
Docker and CI&D
Bamboo plan configuration

If the Dockerfile has changed we need to rebuild the


docker image, push it to the registry, pull it down on the
target deploy servers, then restart the container for that app.

We also rsync the apps nodejs code directory to the target


deploy servers and that directory is mounted in the Docker
container at run time.

This allows us to quickly deploy a new version of the app and


only build/deploy new docker images when required.
Docker Pros and Cons
What Works Well What Doesnt Work Well

Rapid deployment Container Restarts -


sometimes port bind
Abstract away the OS errors occur
and Application
dependencies Registry Cleanup - very
manual process
Run ubuntu pkgs on
Amazon Linux AMIs if Registry push/pull
we need to speed is very slow
Questions?
???

You might also like