A simple POC of a Vagrant-based Mesos cluster
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


A Vagrant based Mesos cluster

This project is about setting up a full-stack Mesos cluster inside a farm of Vagrant virtual machines. It includes the following technologies:

  • Zookeeper
  • Mesos (+ MesosDns)
  • Marathon (+ HaProxy based LoadBalancer)
  • Docker
  • ELK (ElasticSearch + LogStash + Kibana)

Also there is a little SpringBoot based distributed service ("fibonacci-service") which can be Dockerized and deployed into the cluster to illustrate its work and produce some logs.

More information about this project in the related article in my blog.


Note, you have to install

  • vagrant (>= 1.7.4, tested on Virtualbox=5.0-5.0.10 as a provider)
  • ansible (>= 1.9.4)
  • gradle, java and docker (optional, to build the service)

on your local machine before you can start.

Getting started


First of all, open the "Vagrantfile" and study it :) As you can see, we are going to create 3 groups of servers:

  • Mesos masters
  • Mesos nodes/slaves
  • Logs storages

Each group is provided by its own Ansible playbook (see "ansible" folder). The most intersting part here is "role" folder, where you can find all the installation logic for the specific components.

Anyway, all you need to do to start the party is

vagrant up

It takes some time to download and install all the stuff... so be patient :)

Web UIs

After the job is done you can try to check the following UIs:

Update your /etc/hosts file according to what you see in the head of the Vagrantfile, if you want to use short names like master1.


So, you have a cluster! Now, it's time to test it. For that we have a little SpringBoot REST service which calculates the value of N-th Fibonacci number. The point is it does it in a dynamic programming manner, i.e. by invocation of another instances of itself (which are deployed into the cluster). So, that is a quite interesting example for testing.

A Docker image with the service is already published into DockerHub as krestjaninoff/fibonacci-service. However, you can fix something and build your own image. For that make your changes in the code, update buildDocker task in build.gradle file and run

gradle buildDocker

Running on the cluster

To run the image on the cluster you have to perform two steps:

For that we have a special ansible playbook (deploy.yml). If you are too lazy to run it manually, consider deploy.sh script in the root folder :)

Remember, you can use Marathon UI (the link is above) to observer the deployment progress.

Once the app is deployed you can easily invoke it through HaProxy:

where 5 is number of position in the Fibonacci sequence. Have fun and don't forget to check the logs (the link is above) :)



If you need a proxy support, perform the following:

sudo yum install libvirt-devel
vagrant plugin install vagrant-proxyconf

Then update $HOME/.vagrant.d/Vagrantfile to apply your settings for all VMs:

Vagrant.configure("2") do |config|
  if Vagrant.has_plugin?("vagrant-proxyconf")
    config.proxy.http     = ""
    config.proxy.https    = ""
    config.proxy.no_proxy = "localhost,"

Virtualization issues