A vagrant configuration to set up a cluster of mesos master, slaves and zookeepers through ansible
Clone the repository, and run:
vagrant up
This will provision a mini Mesos cluster with one master, one slave, and one HAProxy instance. The Mesos master server also contains Zookeeper and the Marathon framework. The slave will come with Docker installed.
After provisioning the servers you can access Marathon here: http://10.0.10.11:8080/ and the master itself here: http://10.0.10.11:5050/
Submitting a Docker container to run on the cluster is done by making a call to Marathon's REST API:
First create a file, ubuntu.json
, with the details of the Docker container that you want to run:
{
"container": {
"type": "DOCKER",
"docker": {
"image": "libmesos/ubuntu"
}
},
"id": "ubuntu",
"instances": "1",
"cpus": "0.5",
"mem": "128",
"uris": [],
"cmd": "while sleep 10; do date -u +%T; done"
}
And second, submit this container to Marathon by using curl:
curl -X POST -H "Content-Type: application/json" http://10.0.10.11:8080/v2/apps [email protected]
You can monitor and scale the instance by going to the Marathon web interface linked above.