Home

Awesome

mesomatic-examples

Build StatusClojars ProjectClojure version

Clojure and Mesos: Mesos Examples Using Mesomatic

Contents

About

This project started as a port of the standard Mesos Java examples to Clojure and Mesomatic. Since then, other examples have begun making their way into the codebase, and the repo is now home to several Mesomatic examples.

So far, these include:

We plan on adding the multi-executor framework as well a few other examples.

Note that these examples, for the most part, attempt to demonstrate creating Mesos frameworks using bare-bones Clojure (the exception to this is the example which will demonstrate the use of the Component library, allosing one to treat the framework like a system). Also, unlike the Java examples, none of these Mesomatic examples create bash scripts to kick off executors and frameworks from the command-line. Instead, they use lein mesomatic aliases (defined in project.clj).

Dependencies

Mesomatic depends upon having the following installed and, where applicable, running on your machine (or cluster):

The latest version of these examples is built against Mesos 0.28.2 and a mesomatic 0.28.0-r0. However, since there are Mesomatic features missing and bugs fixed which haven't yet been merged upstream, you will need to clone the fork that has these (from the mesomatic-examples clone directory):

$ mkdir checkouts
$ cd checkouts
$ git clone https://github.com/clojusc/mesomatic

Note that the default branch, deploy, has merged all of the feature and bug fix branches.

All other dependencies (including the Java bindings) are downloaded automatically by lein when you run the examples.

Set Up

You'll need to have mesos running in order to see these examples in action. If you've built your own Mesos, you can switch to the build directory, and after running make check (which run tests and generates necessary files/dirs for you), you can start up a local mesos:

$ ./bin/mesos-local.sh

Alternatively, you may download and run one of our docker images:

$ docker run -d -p 5050:5050 clojusc/mesos:1.0.1

If you're using docker, you'll want to set the LIBPROCESS_IP environment variable, using the IP address of Docker host interface, e.g. docker0:

$ export LIBPROCESS_IP=172.17.0.1

In both cases, you'll need to set the MESOS_NATIVE_JAVA_LIBRARY environment variable, e.g.:

$ export MESOS_NATIVE_JAVA_LIBRARY=/opt/mesos/1.0.1/build/src/.libs/libmesos.so

Usage

With the necessary set up complete and after having changed directory to the the mesomatic-examples clone directory, you can run the various example as shown below. Note that lein mesomatic is an alias defined in this repo's project.clj file.

For convenience, we'll set a MASTER environment variable for these examples, e.g.:

export MASTER=127.0.0.1:5050

Or, if using Docker, the IP address of the Mesos container. This can be obtained suchly:

$ docker inspect <container-id> | jq .[0].NetworkSettings.IPAddress

Then:

export MASTER=172.17.0.3:5050

Scheduler-Only Framework

$ lein mesomatic $MASTER scheduler-only-framework

Simple Bash Scheduler Framework

$ lein mesomatic $MASTER bash-scheduler-framework

Java Framework Port

$ lein mesomatic $MASTER framework

Java Exception Framework Port

$ lein mesomatic $MASTER exception-framework

Java Multiple-Executors Framework Port

TBD

'Hello, World!' Framework

$ lein mesomatic $MASTER hello-framework

'Hello, World!' Docker Framework

$ lein mesomatic $MASTER container-framework

'Hello, World!' + Component Framework

TBD

Documentation

The project's auto-generated documentation (such that it is) is available here:

License

Copyright © 2016-2017 Duncan McGreggor Copyright © 2017 Clojure-Aided Enrichment Center

Apache License, Version 2.0.

<!-- Named page links below: /-->