Vending Machine Kata
Clone or download
Pull request Compare This branch is 57 commits behind McCallTech:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Build Status Gh-Pages Kanban Board codenvy chromebook

Dev | DevOps: CM | DevOps: CI

This kata utilizes containerized environments to run a development environment locally, on your own cloud hosted VPS, or with a service like codenvy / koding.

  • The docker container is bootstrapped with node v4.4.5 and mounts the node repo to /vendingMachineKata.
  • Committing and pushing to master triggers a travis-ci build task that tests your app.
    • On success, travis-ci deploys to github pages.
    • On success, travis-ci pushes to docker hub.
  • Build status shield from travis-ci can be seen on your github repo.
  • Developer is notified via email on success / failure of buildTravis-ci.

The repo also contains the configuration management needed to (re)build a linode vps.

  • On boot the Linode VPS will take a base Ubuntu 14.04 image
    • set up the dependencies needed (with bash, makefiles, salt and docker)
    • automatically run the Eclipse Che container s(port 8080)
    • automatically run the node app container ( on port 80)

Linode can then be used as a development environment, a host for Eclipse Che (development environment manager) or can host the deployed app which can be connected to via ssh for development inside the docker container. Auto deploy scripts that update the docker containers with minimal down time.

This project also includes:

  • ScrumBan board: Kanban Board

  • codenvy factory link: codenvy

    • note: you will need a codeny account (OAuth signup available


Dev Option 1: Vending Machine Kata

DevOps Option 1:Configuration Management

  • a: Install/configure the CM tool of your choice.

    • Bash / Makefiles / Salt / Docker
  • b: Automate the provisioning of a web application stack. An example stack might be, but is in no way limited to, redis/passenger/nginx.

    • Linode (VPS host) / Docker (serves app/webserver)
  • c: Automate the deployment of a simple 'ping' page that establishes that each of the 3 layers in the stack are available.

    • Deployment of Linode triggers auto CM, pulls latest docker and serves it over port 80
  • d: Provide us with access to your RCS and identify a few issues that represent the next configurations to be managed in your environment; don't be surprised if someone proposes a change that addresses one of the issues... Your project should be complete as delivered, but every project has a 'next step' and we'd like to know what you think your next steps are.

    • Next steps:
      • DevOps CI: Working cron job triggering a docker pull / stop / remove / run. This has minimal downtime but I would like to flush out blue green deploy strategy that does not rely on a service (aws/dockerhub/digital Ocean).
      • DevOps CI: Travis CI currently builds after every push. Limiting to only code files and tagged commits would better optimize resources.
      • DevOps CI: Local or containerized travis-ci
      • DevOps CM: utilize salt for scaling beyond one node.
      • DevOps CM: docker swarm for scaling
      • DevOps CM: run CaptianHooks for api endpoints to trigger deployment lifecycles

DevOps Option 2: Continuous Integration/Deployment

  • a: Build a simple application with reasonable unit and/or integration tests; there really aren't any constraints here, but it should do something that we can see the results of.

    • Node app with few simple test to be used in ping test.
  • b: Configure a Continuous Integration solution to monitor a Version Control System and execute the unit and/or integration tests when new commits are made.

    • git push master triggers travis-ci that builds and runs test. After success travis-ci runs github pages deploy, docker hub push.
  • c: Provide us with access to your RCS and identify a few issues that represent the next features to be delivered in your application; don't be surprised if someone commits a change that addresses one of the issues... Your project should be complete as delivered, but every project has a 'next step' and we'd like to know what you think your next steps are.

  • d: Configure a Continuous Deployment solution to automatically deploy the application when CI is successful and notify the Software Engineer when CI fails.

    • Push to master triggers travis-ci job and docker build, both of which run test.


Dev Option 1: vendingMachineKata (node/react/webpack)

note: current state, only starter version for use in CM/CI (to be continued ...)

DevOps Option 1: CM

Linode Ubuntu 14.04

Specs (linode 1024 or lindoe 4096):

StackScripts / Bash
  • Linodes custom scripts are run when server is (re)built
apt-get update && \
apt-get install make curl -y && \
cd ~ && \
curl -o- > ~/Makefile && make init

  • make init && make start_kataDocker
    • Spins up eclipse che and pulls joshmccall221/vendingMachineDocker to server on port 80
    • Eclipse Che : ${linode.ip}:8080
    • vendingMachineKata : ${linode.ip}
	- curl -o- >> salt && bash salt 
	- git clone  ~/dotfiles && cd ~/dotfiles &&  make eclipse_che && make start_kataDocker 

#Add key   
wget -O - | sudo apt-key add -
echo 'deb trusty main ' >> /etc/apt/sources.list.d/salt.list
#Install salt
sudo apt-get update -y
sudo apt-get install salt-minion -y
#use salt to bootstrap system
salt-call --local pkg.install git make vim tmux ack-grep 

#Use salt formula to install docker
mkdir /srv/salt
cd /srv/salt/
git clone
cp -R ./docker-formula/docker/ .
salt-call --local state.sls docker
Development Environment:
Eclipse Che
  • container based (docker) cloud ide
  • Open source version of codenvy more info
  • Swagger api for creating users/workspaces/projects
Docker (joshmccall221/vendingmachinekata)
  • can be run:
    • locally
    • codenvy
    • Any VPS
  • All cloud based means laptop / chromebook / ipad development :)

DevOps Option 2: CI

- push to master triggers travis-ci build
  • runs npm test
  • builds dockerfile
  • after_success
    • deploys to github pages
    • push to docker hub
  • Notifies via email either success or failure
language: node_js

- '4.4.3'
  - docker
  - npm install
  - npm test
  - docker login -e="$DOCKER_EMAIL" -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
  - docker build -t joshmccall221/vendingmachinekata .
  - docker tag joshmccall221/vendingmachinekata joshmccall221/vendingmachinekata:$TRAVIS_BUILD_NUMBER
  - docker run -d -p --name vendingmachinekata joshmccall221/vendingmachinekata:$TRAVIS_BUILD_NUMBER
  - docker ps | grep -q vendingmachinekata 
  - webpack
  - chmod a+x
  - npm run-script deploy
  - docker push joshmccall221/vendingmachinekata
  - docker push joshmccall221/vendingmachinekata:$TRAVIS_BUILD_NUMBER

Sources, reading list and credits:

Agile Board:



Linode peformance with low tier memory


Docker Blue/Green





dockerSwarm generic driver (docker-machine create on linux)

[docker deep dive (generic driver)] (


Docker hub deployment: github, travis, dockerhub (blue/green with depcon)

Docker formulas with Salt

Docker Cheat Sheet

[Docker exec] (


Awesome Sheilds


I swapped my MacBook for an iPad+Linode

Screen shots:

Docker pulled from joshmccall221/vendingmachinekata running in codenvy with passing test and serving from web-pack-dev-server:




Travis-CI deployed to gh-pages and docker:


Github, Travis-CI, Docker hub: