Skip to content

Instantly share code, notes, and snippets.

@solidsnack
Last active December 6, 2017 05:21
Show Gist options
  • Star 12 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save solidsnack/10944095 to your computer and use it in GitHub Desktop.
Save solidsnack/10944095 to your computer and use it in GitHub Desktop.
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
Ubuntu 13.10.
## Install Mesos prerequisites
:; sudo apt-get update
:; sudo apt-get install zookeeperd default-jre python-setuptools python-protobuf curl pip
## Install recent Mesos
:; curl -fL http://downloads.mesosphere.io/master/ubuntu/14.04/mesos_0.19.0~ubuntu14.04%2B1_amd64.deb -o /tmp/mesos.deb
:; sudo dpkg -i /tmp/mesos.deb
## Install the updated Mesos Python egg, for use in authoring frameworks
:; curl -fL http://downloads.mesosphere.io/master/ubuntu/14.04/mesos-0.19.0_rc2-py2.7-linux-x86_64.egg -o /tmp/mesos.egg
:; sudo easy_install /tmp/mesos.egg
## Install Deimos
:; sudo pip install deimos
## Install the Marathon Deb package, built from this branch:
## https://github.com/mesosphere/marathon/tree/wip-container-info
:; curl -fL http://downloads.mesosphere.io/marathon/marathon_0.5.0-xcon2_noarch.deb -o /tmp/marathon.deb
:; sudo dpkg -i /tmp/marathon.deb
To configure Mesos to use Deimos, you need to set the contents
of two files:
:; sudo mkdir -p /etc/mesos-slave
:; echo /usr/local/bin/deimos | sudo dd of=/etc/mesos-slave/containerizer_path
:; echo external | sudo dd of=/etc/mesos-slave/isolation
Installing Docker is documented on the Docker site. Here's one way:
## Install Docker
:; sudo apt-get install linux-image-extra-"$(uname -r)"
:; sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
:; echo 'deb http://get.docker.io/ubuntu docker main' | sudo dd of=/etc/apt/sources.list.d/docker.list
:; sudo apt-get update
:; sudo apt-get install lxc-docker
It might be helpful to pre-cache the `libmesos` Docker image,
used for custom executors:
:; sudo docker pull libmesos/ubuntu:13.10
At this point, you should take measures to ensure all services
have started (or restarted). A reboot would be easiest.
To test that it seems to be working, try the Deimos integration
tests:
## If "$eth0_ip" does not work, try "$(hostname)"
:; git clone https://github.com/mesosphere/deimos.git
:; ./deimos/integration-test/test-suite "$eth0_ip":5050
@sirupsen
Copy link

sirupsen commented May 6, 2014

I've built a fresh master as of today for Trusty and Precise:

http://shopify-vagrant.s3.amazonaws.com/stack/mesos-0.19.0-precise.deb
http://shopify-vagrant.s3.amazonaws.com/stack/mesos-0.19.0-precise.egg
http://shopify-vagrant.s3.amazonaws.com/stack/mesos-0.19.0-trusty.deb
http://shopify-vagrant.s3.amazonaws.com/stack/mesos-0.19.0-trusty.egg

@solidsnack
Copy link
Author

Unfortunately this master will not work with Deimos...

@jedipunkz
Copy link

I have same problem.

$ sudo  ./deimos/integration-test/test-suite "$eth0_ip":5050
08:43:11.972 deimos-test Testing: SleepScheduler(trials=2, sleep=2)
Error from Mesos: Failed to create a master detector for ':5050': Failed to parse ':5050'
08:43:11.979 deimos-test DRIVER_ABORTED
08:43:11.979 deimos-test Driver died in an anomalous state
08:43:11.979 deimos-test Aborted: SleepScheduler(trials=2, sleep=2)
**** FAILURE

I will try trusty's packages!
thanks.

@rkrzewski
Copy link

@jedipunkz the error you got means that eth0_ip variable was not set. You need to enter the address where mesos master is running. If you followed the instructions above to install mesos on your machine, it should be running at 127.0.1.1:5050 (yes that's 127.0.1.1 not 127.0.0.1) but make sure by running grep 'mesos-master.*started on' /var/log/syslog

@rkrzewski
Copy link

I've followed the tutorial at http://mesosphere.io/learn/run-docker-on-mesosphere/ which seems to be based on this gist (same package versions) and I've run into the following problem: docker containers don't start and I see the following in /var/log/syslog:

Jun 17 11:47:09 arnica mesos-master[12641]: I0617 11:47:09.483466 12659 master.hpp:491] Adding task deimos-test.498f4b8d.task-01 with resources cpus(*):0.5; mem(*):256 on slave
 20140617-112155-16842879-5050-12641-1 (arnica)
Jun 17 11:47:09 arnica mesos-master[12641]: I0617 11:47:09.483611 12659 master.cpp:2737] Launching task deimos-test.498f4b8d.task-01 of framework 20140617-112155-16842879-5050-
12641-0002 with resources cpus(*):0.5; mem(*):256 on slave 20140617-112155-16842879-5050-12641-1 (arnica)
Jun 17 11:47:09 arnica mesos-master[12641]: I0617 11:47:09.484073 12659 hierarchical_allocator_process.hpp:590] Framework 20140617-112155-16842879-5050-12641-0002 filtered slav
e 20140617-112155-16842879-5050-12641-1 for 5secs
Jun 17 11:47:09 arnica mesos-slave[13336]: I0617 11:47:09.484057 13355 slave.cpp:801] Got assigned task deimos-test.498f4b8d.task-01 for framework 20140617-112155-16842879-5050
-12641-0002
Jun 17 11:47:09 arnica mesos-slave[13336]: I0617 11:47:09.484433 13355 slave.cpp:909] Launching task deimos-test.498f4b8d.task-01 for framework 20140617-112155-16842879-5050-12
641-0002
Jun 17 11:47:09 arnica mesos-slave[13336]: I0617 11:47:09.487480 13355 external_containerizer.cpp:283] No container specified in task and no default given. The external contain
erizer will have to fill in defaults.
Jun 17 11:47:09 arnica deimos[14112]: deimos.containerizer.wait() ec440960-e3c0-4531-830b-724e56a36572
Jun 17 11:47:09 arnica deimos[14109]: deimos.containerizer.launch() ec440960-e3c0-4531-830b-724e56a36572 --mesos-executor /usr/local/libexec/mesos/mesos-executor
Jun 17 11:47:09 arnica deimos[14112]: deimos.cli() Unhandled failure in wait#012Traceback (most recent call last):#012  File "/usr/local/lib/python2.7/dist-packages/deimos/__in
it__.py", line 70, in cli#012    result = containerizer(*argv[1:])#012  File "/usr/local/lib/python2.7/dist-packages/deimos/containerizer.py", line 61, in __call__#012    retur
n method(*args[1:])#012  File "/usr/local/lib/python2.7/dist-packages/deimos/containerizer.py", line 267, in wait#012    message = recordio.read(Wait)#012  File "/usr/local/lib
/python2.7/dist-packages/deimos/proto.py", line 16, in read#012    unpacked = struct.unpack('I', sys.stdin.read(4))#012error: unpack requires a string argument of length 4
Jun 17 11:47:09 arnica deimos[14109]: deimos.cli() deimos.err.Err: ('Expected %d bytes; received %d', 1701059594, 222)

Any clues?

@rkrzewski
Copy link

For the record, after upgrading mesos to 0.19.0~ubuntu14.04+1 I no longer see the error above, but the integration test suite still fails. test_sleep and test_pg complete successfully, but test_executor does not.
Relevant (AFAICT) part from syslog:

Jun 24 00:34:24 arnica deimos[11454]: deimos.containerizer.launch() exit 0 // docker run --sig-proxy --rm --cidfile /tmp/deimos/mesos/8894519c-5502-4896-91a5-e922d2bb233e/cid -w /tmp/mesos-sandbox -v /tmp/deimos/
mesos/8894519c-5502-4896-91a5-e922d2bb233e/fs:/tmp/mesos-sandbox -c 512 -m 256m -e MESOS_SLAVE_ID=20140622-220149-16842879-5050-2145-0 -e 'MESOS_SLAVE_PID=slave(1)@127.0.1.1:5051' -e MESOS_FRAMEWORK_ID=20140623-2
14413-16842879-5050-30986-0003 -e MESOS_EXECUTOR_ID=deimos-test.6d1ee724.executor -e MESOS_CHECKPOINT=0 -e MESOS_DIRECTORY=/tmp/mesos-sandbox libmesos/ubuntu sh -c 'python deimos-test.py --executor'
Jun 24 00:34:24 arnica mesos-slave[2146]: E0624 00:34:24.497194  2197 slave.cpp:2397] Termination of executor 'deimos-test.6d1ee724.executor' of framework '20140623-214413-16842879-5050-30986-0003' failed: External containerizer failed (status: 137)
Jun 24 00:34:24 arnica mesos-slave[2146]: I0624 00:34:24.500880  2197 slave.cpp:2018] Handling status update TASK_LOST (UUID: c801d07f-36f3-49fd-84ea-e2103e2694a5) for task deimos-test.6d1ee724.task-00 of framework 20140623-214413-16842879-5050-30986-0003 from @0.0.0.0:0

@solarkennedy
Copy link

Hmm, @rkrzewski I'm also getting the same struct.unpack + expectex/received bytes error.

I guess I also don't have my demios+mesos+marathon versions right?

@solarkennedy
Copy link

Wow, a year later and google pointed me here here for some other error message.

If there are any other archaeologists finding this thread, if possible you should upgrade >= mesos 0.20 which has native docker containerization and no longer requires deimos as an executor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment