This repository contains demo materials for the ContainerCon 2015 talk Managing Mesos, Docker, and Chronos with Puppet, co-presented with Niklas Quarfot Nielsen.
A solid configuration management solution is key to any well-run, well-documented environment. Fortunately, Puppet can do more than just host-bound configuration. In this presentation, Roger and Niklas will demonstrate how to build Docker images, deploy Apache Mesos clusters, and create scheduled jobs in Chronos, all without leaving the Puppet DSL.
This presentation will demonstrate how you can use Puppet for
- Deploying Mesos clusters on-premise and in the cloud
- Building Docker containers declaratively
- Creating Chronos jobs that make use of Docker containers
This repository contains a Vagrant environment that will provision a single Mesos master running ZooKeeper and Chronos, and three Mesos slaves running Docker.
It will stage an example Docker image on the Mesos slaves, to reduce the start-up time of Chronos tasks.
It will then create a Chronos job that runs a command within the Docker container.
This demo makes use of the roles and profiles pattern in Puppet. Essentially, this breaks down to:
- Each machine is assigned a single "role" (via Hiera)
- Each role is made up of multiple "profiles"
- Each profile contains resources and calls to other Puppet modules, and are responsible for actually configuring the machine
The roles and profiles are located in the modules/
directory.
This demo was developed and tested using
- Mac OS X 10.10.3
- Vagrant 1.7.2
- Ruby 2.1.5 with Bundler 1.7.6
Install the required Ruby gems
$ bundle install
Download the Puppet modules
$ bundle exec librarian-puppet install
Bring up the environment
$ vagrant up --provider virtualbox
Note: each of the VMs are assigned 1 CPU core and 1 GB memory, so you should
have (at a minimum) 2 CPUs and 4 GB memory to run the full demo. Alternately,
you may have Vagrant bring up just the mesos-master
machine, and then one
or more mesos-slave-N
machines.
Mesos will now be available at http://192.168.248.10:5050 and Chronos will be available at http://192.168.248.10:4400. If all is well, a Chronos job named "query_mesos" will have been created and be visible in the Chronos UI.
If the Chronos job wasn't created, it's possible that Puppet attempted to
apply the chronos_job
resource before all the dependent resources were
applied. If this is the case, simply run the Puppet provisioner once more:
$ vagrant provision mesos-master