Skip to content

Instantly share code, notes, and snippets.

@matzew matzew/gist:c9b1c2c3b04f2a7cc761 Secret
Last active Aug 29, 2015

Embed
What would you like to do?
Apache Mesos and Marathon for UnifiedPush Server and WildFly 8.1

After reading a bit about Apache Mesos I wanted to play a bit with it. If you don't know what Mesos is, it's a cluster manager that provides efficient resource isolation and sharing across distributed applications, or frameworks.

During reading up on Apache Mesos I ran into the Marathon framework, developed by the folks at Mesosphere. Marathon is a nice tool to manage tasks on Apache Mesos. The Github repo says:

Marathon is an Apache Mesos framework for long-running applications. Given that you have Mesos running as the kernel for your datacenter, Marathon is the init or upstart daemon.

Installation of Apache Mesos

The folks at Mesosphere did a great job writing up different installation guides. As a Mac user, I did follow this installation. The guide helps on installing the required components of the setup:

  • Apache Zookeeper
  • Apache Mesos
  • Mesosphere's Marathon

Running WildFly and the AeroGear UnifiedPush Server on Apache Mesos

Once the above setup is done and your Apache Mesos system is running, it's pretty simple to launch a WildFly server and deploy the UnifiedPush Server to it.

Download the following bundles and place them into a folder on your disk:

Now you need to save this JSON:

{
  "id": "ups1.0.0",
  "cmd": "mv aerogear-unifiedpush-server-1.0.0.Final/databases/unifiedpush-h2-ds.xml wildfly-8.1.0.Final/standalone/deployments && mv aerogear-unifiedpush-server-1.0.0.Final/servers/unifiedpush-auth-server.war wildfly-8.1.0.Final/standalone/deployments && mv aerogear-unifiedpush-server-1.0.0.Final/servers/unifiedpush-server-wildfly.war wildfly-8.1.0.Final/standalone/deployments && cd wildfly-8.1.0.Final && sed \"s/8080/$PORT/g\" < ./standalone/configuration/standalone.xml > ./standalone/configuration/standalone-mesos.xml && ./bin/standalone.sh -b 0.0.0.0 -c standalone-mesos.xml",
  "mem": 1024,
  "cpus": 1.0,
  "instances": 1,
  "uris": [
      "file:///PATH/TO/DOWNLOAD/OF/wildfly-8.1.0.Final.zip",
      "file:///PATH/TO/DOWNLOAD/OF/aerogear-unifiedpush-server-1.0.0.Final-dist.zip"
  ]
}

to a file and submit it to the Marathon server, using curl:

curl -i -H 'Content-Type: application/json' -d @unifiedpush-server.json localhost:8080/v2/apps

After Apache Mesos is done with downloading the artifacts from the uris section, it performs the steps chained in the cmd section. This is basically a set of shell commands that copy the UnfiedPush Server and its database file to a WildFly, which uses a PORT provided by the custer manager instead of the default 8080 http port.

You are done - that's all you need. On the Marathon UI you now see the URL and the PORT of the WildFly, containing the UnifiedPush Server:

XXXXX

Have fun with WildFly and the UnifiedPushServer on Apache Mesos!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.