Cloud Native Blog - Container Solutions

minimesos 0.4.0 - Marathon Support

Written by Frank Scholten | Oct 15, 2015 3:57:08 PM

MiniMesos 0.4.0 has been released today and is available via Jitpack. MiniMesos is part of our work on Mantl, the Microservices Infrastructure platform from Cisco Cloud. The goal of minimesos is to make it really easy to test Mesos frameworks and Mesos in general.

The main new feature in this release is Marathon support. When starting minimesos a separate Marathon container is started which connects to the existing Zookeeper container. This blog shows how this feature is used and how it's implemented.

The Marathon container

To try out the new release run the install script through curl. It installs the minimesos jar into /usr/local/share/minimesos and minimesos cli interface into /usr/local/bin.

  
sudo curl https://raw.githubusercontent.com/ContainerSolutions/minimesos/master/bin/install | bash

https://raw.githubusercontent.com/ContainerSolutions/minimesos/master/bin/install | bash

Now launch a new minimesos cluster with

  
minimesos up
(out) http://172.17.1.65:5050

When you list the running containers you can see all containers in the cluster, including the new Marathon container. Note that the container name always has a minimesos prefix, the name of the role, the cluster ID and finally a random ID that is assigned to each container before start.

  
minimesos up
docker ps
(out) CONTAINER ID        IMAGE                                           COMMAND                CREATED             STATUS              PORTS                          NAMES
(out) 5e59dce1dc1b        mesosphere/marathon:v0.8.1                      "./bin/start --maste   8 minutes ago       Up 8 minutes                                       minimesos-marathon-4167781031-239566274     
(out) ed153377e3ff        mesosphere/mesos-slave:0.22.1-1.0.ubuntu1404    "mesos-slave"          8 minutes ago       Up 8 minutes        5051/tcp, 9200/tcp, 9300/tcp   minimesos-agent-4167781031-2797405641       
(out) 9b2562ea8518        mesosphere/mesos-master:0.22.1-1.0.ubuntu1404   "mesos-master --regi   8 minutes ago       Up 8 minutes        5050/tcp                       minimesos-master-4167781031-3857686719      
(out) 50af12b5c274        jplock/zookeeper:latest                         "/opt/zookeeper/bin/   8 minutes ago       Up 8 minutes        2181/tcp, 2888/tcp, 3888/tcp   minimesos-zookeeper-4167781031-1783494468 

The Marathon container is connected to the existing Zookeeper instance in the minimesos cluster.

  
docker inspect 5e59
(out) ...
(out)        "Cmd": [
(out)             "--master",
(out)             "zk://minimesos-zookeeper:2181/mesos",
(out)             "--zk",
(out)             "zk://minimesos-zookeeper:2181/marathon"
(out)         ],
(out) ...

Running a task on Marathon

From here we can navigate to the Marathon endpoint. First we have to determine Marathon's IP

  
docker inspect --format '{{ .NetworkSettings.IPAddress }}' 5e59
(out) 172.17.1.74

and then we can open http://172.17.1.74 in the browser. Let's add an app called 'testapp' which echoes hello world.

 

Once it is running we can inspect the Marathon logs to see it is being run continuously.

 
[2015-10-15 13:27:54,661] INFO Need to scale /testapp from 0 up to 1 instances (mesosphere.marathon.SchedulerActions:530)
[2015-10-15 13:27:54,662] INFO Queueing 1 new tasks for /testapp (0 queued) (mesosphere.marathon.SchedulerActions:536)
[2015-10-15 13:27:55,509] INFO Received status update for task testapp.8b2c37a8-7340-11e5-b30e-0242ac11014a: TASK_RUNNING () (mesosphere.marathon.MarathonScheduler:149)
[2015-10-15 13:27:55,521] INFO Sending event notification. (mesosphere.marathon.MarathonScheduler:263)
[2015-10-15 13:27:55,609] INFO Received status update for task testapp.8b2c37a8-7340-11e5-b30e-0242ac11014a: TASK_FINISHED (Command exited with status 0) (mesosphere.marathon.MarathonScheduler:149)
[2015-10-15 13:27:55,611] INFO Task testapp.8b2c37a8-7340-11e5-b30e-0242ac11014a expunged and removed from TaskTracker (mesosphere.marathon.tasks.TaskTracker:107)

As you can see it's quite easy to try out Marathon from minimesos.

Minor changes in 0.4.0

Usage and help feature

If you don't have a cluster running minimesos prints the help feature showing the up and destroy commands. We have used the excellent JCommander library to implement the cli commands and help feature.

  
minimesos help
(out) Usage: minimesos [options] [command] [command options]
(out)   Commands:
(out)     up      Create a mini mesos cluster
(out)       Usage: up [options]
(out)         Options:
(out)           --mesosImageTag
(out)              The tag of the Mesos master and agent Docker images.
(out)              Default: 0.22.1-1.0.ubuntu1404
(out)     destroy      Destroy a mini mesos cluster
(out)       Usage: destroy [options]
(out)     help      Display help
(out)       Usage: help [options]

Testing different Mesos versions

Mesos has a frequent release cycle and it is useful to be able to test newer version. To support this we made the image tag
configurable by specifying one of the Mesosphere Docker hub tags to the --mesosImageTag flag.

What's next?

  • Testing Mesos versions will be made more user friendly
  • More minimesos cli commands
  • Config refactoring. A few parameters should be merged into MesosClusterConfig

Keep in touch

Thanks for reading! Keep in touch by commenting on the blog or talk to us on @minimesos and @ContainerSoluti. Check out the open issues on Github. Do you have an idea on how to improve minimesos? Please open an issue or add a PR at the minimesos Github repo. We hope you find minimesos useful. See you next time!