Microservices, Miscellaneous

minimesos 0.13.0 - Support for Marathon application groups

Apache Mesos


Today we released minimesos 0.13.0. In this version we have added support for Marathon group deployments. With this change you can quickly deploy application groups using the minimesos install command.

Deploying an application group

In minimesos the install command is used to deploy applications on the cluster. With this version you can install entire groups using the --group flag. See the following JSON file with two application definitions of netcat.

 
{
  "id": "/hello",
  "groups": [
    {
      "id": "/hello/group",
      "apps": [
                {
                        "id": "/hello/group/app1",
                        "cmd": "while true ; do echo \"Hello from app1\" | nc -l -p $PORT0; done",
                        "cpus": 0.1,
                        "mem": 16.0,
                        "instances": 1
                },
                {
                        "id": "/hello/group/app2",
                        "cmd": "while true ; do  echo \"Hello from app2\" | nc -l -p $PORT0; done",
                        "cpus": 0.1,
                        "mem": 16.0,
                        "instances": 1
                }               
      ]
    }
  ]
}
	
	

Let's deploy the group:

  
minimesos install --group hello.json 

We can now use the minimesos ps command to list the tasks.

  
minimesos ps
(out) FRAMEWORK            TASK                 STATE                PORT
(out) marathon app2.group.hello TASK_RUNNING 31600
(out) marathon app1.group.hello TASK_RUNNING 31545
(out) marathon weave-scope TASK_RUNNING 31266

We have also added a new column PORT with the port that was offered by Mesos. We can now easily connect to the applications using the .mm domain name and the port number.

  
curl -v app1.group.hello.marathon.mm:31545
(out) Hello from app1
$ curl -v app2.group.hello.marathon.mm:31600
(out) Hello from app2

If you didn't know about this DNS feature check out my previous blog on Mesos DNS support that was added in minimesos 0.12.0. You can also add a group block inside the marathon block to install groups on startup like this:

 
marathon {
  // BEWARE: this option customize the marathon starting command, changing it can break the cluster
  cmd = "--master zk://minimesos-zookeeper:2181/mesos --zk zk://minimesos-zookeeper:2181/marathon"
  imageName = "mesosphere/marathon"
  imageTag = "v1.3.5"

  // Add 'app { marathonJson = "" }' for every task you want to execute
  app {
    marathonJson = "https://raw.githubusercontent.com/ContainerSolutions/minimesos/master/opt/apps/weave-scope.json"
  }

  group {
    marathonJson = "hello.json"
  }
}

What happened to the --marathonFile flag?

The --marathonFile flag of the install command is now deprecated since we now have two flags: --app and --group for app and group deployments respectively. See the help documentation:

 
minimesos install
Install a Marathon application or application group
Usage: install [options]
  Options:
    --app
       Relative path or URL to a JSON file with a Marathon app definition. See
       https://mesosphere.github.io/marathon/docs/application-basics.html.
    --group
       Relative path or URL to a JSON file with a group of Marathon apps. See
       https://mesosphere.github.io/marathon/docs/application-groups.html.
    --marathonFile
       [Deprecated - Please use --marathonApp] Relative path or URL to a JSON
       file with a Marathon app definition.
    --stdin
       Read JSON file with Marathon app or group definition from stdin.
       Default: false
    --update
       Update a running application instead of attempting to deploy a new
       application
       Default: false

Keep in touch

Thanks for reading! Keep in touch by commenting on the blog, talking to us at @minimesos and @ContainerSoluti or ask a question on the mailing list. 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!

Comments
Leave your Comment