Forked from solidsnack/getting-started-with-deimos
Last active
August 29, 2015 14:01
-
-
Save grampelberg/8f1918c14206ac72244d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
To get started with Docker/Marathon/Mesos, you need to install a | |
new Mesos, a new Marathon, and Deimos, the bridge to Docker. | |
You'll also need Docker and the JVM. These instructions are for | |
Fedora 20. | |
## Install Mesos prerequisites | |
:; sudo yum install zookeeper-server java-1.7.0-openjdk python-setuptools curl python-pip python-devel | |
:; sudo cp /etc/zookeeper/zoo_sample.cfg /etc/zookeeper/zoo.cfg | |
:; echo 1 | sudo dd of=/var/lib/zookeeper/data/myid | |
## Install Mesos | |
:; curl -fL http://downloads.mesosphere.io/master/fedora/20/mesos_0.19.0-rc2_amd64.rpm -o /tmp/mesos.rpm | |
:; sudo yum install /tmp/mesos.rpm | |
:; sudo mkdir -p /etc/mesos-master | |
:; echo in_memory | sudo dd of=/etc/mesos-master/registry | |
## Install the updated Mesos Python egg, for use in authoring frameworks | |
:; curl -fL http://downloads.mesosphere.io/master/fedora/20/mesos_0.19.0_rc2-py2.7-linux-x86_64.egg -o /tmp/mesos.egg | |
:; sudo easy_install /tmp/mesos.egg | |
## Install the Marathon RPM package, built from this branch: | |
## https://github.com/mesosphere/marathon/tree/wip-container-info | |
:; curl -fL http://downloads.mesosphere.io/marathon/geard/marathon-0.5.0_SNAPSHOT.rpm -o /tmp/marathon.rpm | |
:; sudo yum install /tmp/marathon.rpm | |
## Get Docker installed and running | |
:; sudo yum install docker-io | |
:; sudo systemctl start docker | |
## Install the geard RPM and start it: | |
:; sudo yum install --enablerepo=updates-testing geard | |
:; sudo systemctl start geard | |
## Note that if you'd like to compile geard yourself, install these dependencies: | |
:; sudo yum install gcc git libselinux-devel mercurial | |
To configure Mesos to use Deimos, you need to set the contents | |
of two files: | |
:; sudo mkdir -p /etc/mesos-slave | |
:; sudo mkdir -p /etc/mesos-master | |
:; echo /usr/bin/deimos | sudo dd of=/etc/mesos-slave/containerizer_path | |
:; echo external | sudo dd of=/etc/mesos-slave/isolation | |
Deimos must be configured to use the geard containerizer. If you skip this step, it will use the default docker containerizer. | |
:; printf "[containerizer]\ntype=geard\n" | sudo dd of=/etc/deimos.cfg | |
Fetch the image that we'll be testing with: | |
:; sudo docker pull zaiste/postgresql | |
At this point, you should take measures to ensure all services | |
have started (or restarted). | |
:; sudo systemctl start zookeeper mesos-master mesos-slave docker | |
To test that it seems to be working, try the Deimos integration | |
tests: | |
:; git clone https://github.com/mesosphere/deimos.git | |
:; cd deimos | |
:; git checkout geard | |
:; touch deimos/VERSION | |
:; sudo python setup.py develop | |
:; ./integration-test/deimos-test.py --master localhost:5050 --test pg --test.trials 1 | |
To start something with marathon, from the deimos checkout: | |
:; sudo systemctl enable marathon && sudo systemctl start marathon | |
:; curl -X POST -H "Content-Type: application/json" localhost:8080/v2/apps -d@marathon/pg.json | |
You can use the marathon UI to look at your newly created, running task. Point your browser to http://localhost:8080. There will be a `postgresql` app that you can click on. It will then show you all the details of the task that was just started. | |
Also, you should see what it looks like in geard. Take a look at the units via. `gear list-units`. You'll see your container in the list. | |
How about linking two containers together via. marathon? | |
:; sudo yum install jq | |
:; sudo systemctl stop firewalld | |
:; sudo docker pull mrunalp/fedora-redis | |
:; sudo docker pull mrunalp/redis-todo | |
:; curl -X POST -H "Content-Type: application/json" localhost:8080/v2/apps -d@marathon/redis.json | |
:; curl localhost:8080/v2/apps/redis | \ | |
jq .app.tasks[0].ports[0] | \ | |
xargs -Iport sed 's/REPLACE/port/' marathon/redis-todo.json | \ | |
curl -X POST -H "Content-Type: application/json" localhost:8080/v2/apps -d@- | |
The magic here is via. container options. You can actually pass whatever command line arguments you'd like to `gear`. Take a look at how it is done in `redis-todo.json` to get a feel for what's going on. | |
Now, you probably want to test out these newly running and linked containers. There are two ways to go about this: | |
1. Marathon UI | |
- Point your browser at http://localhost:8080 | |
- Click into the `redis-todo` task | |
- There should be one task running, underneath the task name (which looks like redis-todo_0-timestamp), you should see `localhost:PORT`. That is the external port this is running on. | |
- Send your browser to http://localhost:redis-todo-port/tasks | |
2. Command Line | |
- Run this command: | |
curl localhost:8080/v2/apps/redis-todo | jq .app.tasks[0].ports[0] | |
- Point your browser at http://localhost:output-from-previous-command/tasks | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here are the new links:
http://downloads.mesosphere.io/master/fedora/20/mesos_0.19.0-rc2_x86_64.rpm
http://downloads.mesosphere.io/master/fedora/20/mesos-0.19.0_rc2-py2.6.egg
http://downloads.mesosphere.io/marathon/geard/marathon-0.5.0_SNAPSHOT.rpm