Mesoscope is a project aimed at providing an easy-to-deploy environment for getting started with Mesos. The idea behind this project is studying how mesos works and giving a useful environment to deploy other components on top of it.
This repository contains a local setup of a Mesos cluster that runs on top of Docker. It also starts a Docker Registry server and a Marathon instance, which makes very easy to deploy and run docker images via Mesos' docker executor.
More docker images for other components are coming. For instance:
- Chronos
- Netflix OSS stack
## TL; DR
In sort, it’s as easy as following the next steps: Install docker
and docker-compose and run make
. After doing this, you
will have a local mesos cluster up and running.
IMPORTANT: docker-compose makes the mesos-slave containers to share the docker's UNIX socket with their host.
To deploy this development environment, it is needed to install and properly configure the following components before:
Depending on your environment (e.g. OSX), you might need docker-machine.
The build leverages mesos-build-helper to build and cache an RPM version of Mesos for faster re-builds of the system. This is handled automagically by Mesoscope so there is no need to clone that project manually.
#### Building time
The first time you build the docker images, Mesos needs to be compiled. This means that it can take a while, so take a cup of coffee and be patient :)
If you use docker-machine, it is recommended to assign it at least 2GB of RAM.
Execute the following command: make
(which is the same that make build && make compose
)
The following control panels will be exposed:
- Mesos:
http://dockermachine-vm:5050/
- Marathon:
http://dockermachine-vm:8080/
It is also possible to build only a group of selected images using the following make targets:
- All components:
make build
- Zookeeper:
make build-zookeeper
- Mesos Master:
make build-mesos-master
- Mesos Slave:
make build-mesos-slave
- Marathon:
make build-mesos-marathon
- Docker Registry:
make build-docker-registry
Just add to your /etc/hosts
one entry like the following one for each slave:
<docker_host_ip> d2b55aeb8b4d
Where d2b55aeb8b4d is the hostname of the mesos slave.
The docker registry included in this testing environment only allows HTTP
connections, so you will need to start the docker daemon with the
parameter --insecure-registry dockermachine-vm:5000
.
In the case of docker-machine, you can do it with the following (remember
to add the entry dockermachine-vm
IP on /etc/hosts on your machine):
docker-machine create --driver virtualbox --engine-insecure-registry dockermachine-vm --virtualbox-memory '2048' dockermachine-vm
After doing this, you can push new images to the registry using these commands:
$ docker tag image_name dockermachine-vm:5000/image_name
$ docker push dockermachine-vm:5000/image_name
Finally, use the Marathon API to deploy your app:
$ cat testapp/testapp.json
{
"id": "testapp",
"cpus": 0.1,
"mem": 16.0,
"instances": 1,
"container": {
"type": "DOCKER",
"docker": {
"image": "dockermachine-vm:5000/image_name:latest",
"network": "BRIDGE",
"portMappings": [
{ "containerPort": 8001, "hostPort": 0, "servicePort": 8001, "protocol": "tcp" }
]
}
}
}
$ curl -X POST -H "Content-Type: application/json" http://dockermachine-vm:8080/v2/apps -d@testapp.json
Execute the command make destroy
- All images are built using the source code of the different components directly from their official locations. We do it this way to avoid dependencies with 3rd-parties, etc.
- Only the installation of dependencies (wget, gcc, etc.) are distro-centric.
At the moment only the Docker containerizer is supported.
You can give a look to the file docker-compose.yml
if you want to know which
other ports are exposed, the dependencies between images, etc.
Copyright 2015 Schibsted Products and Technology
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.