Skip to content

Instantly share code, notes, and snippets.

@rheinwein
Last active August 29, 2015 14:14
Show Gist options
  • Save rheinwein/dcef753a0b4327caf63c to your computer and use it in GitHub Desktop.
Save rheinwein/dcef753a0b4327caf63c to your computer and use it in GitHub Desktop.
Marathon Blog

#Deploying to Your Mesosphere Cluster with CenturyLink’s Panamax

Panamax is a powerful Docker workflow tool that makes creating containerized applications easy, and deploying them even easier. An open source project from CenturyLink Labs, Panamax allows you to create application templates, configure your containers, test them on your local machine, and deploy your application to remote hosting targets. The Panamax team is happy to announce that a Marathon remote deployment adapter is now available, making it possible to deploy to your Mesosphere cluster with Panamax, right from your browser.

###How Panamax Works Panamax runs locally on your development machine. When you install Panamax, a small virtual machine running CoreOS is booted to hold three Docker containers -- the UI, API, and cAdvisor (for monitoring). When you introduce remote deployments, this local Panamax client will talk to a remote agent and adapter -- running in the target environment -- via SSL.

Starting with local examples, you'll learn how to install Panamax, create your first application, and then deploy that template to a Mesosphere cluster.

###Installing Panamax Panamax runs directly on your local workspace, and can be installed on a variety of operating systems. To run Panamax, simply download the installer package and run it on your host.

On a Mac, you can use Homebrew to install by running brew install http://download.panamax.io/installer/brew/panamax.rb. After the install is complete, run panamax init. A browser window will open automatically with the Panamax UI.

For Ubuntu, run curl http://download.panamax.io/installer/ubuntu.sh | bash. You’ll see Panamax open automatically here as well.

You can access a full list of Panamax options and commands by typing panamax into your terminal. For a comprehensive guide to installing and running Panamax, check out the documentation on the GitHub wiki.

###Creating Applications with Panamax After you’re up and running, you’re ready to start searching for and running Docker applications. The Panamax search bar is fully integrated with the Docker Hub, so any image you see on the Hub can also be pulled down and run via Panamax. Additionally, you can opt to give Panamax access to a GitHub repository that stores application template files — more on those later — or a private registry you or your company has created. When you search in Panamax, your results will be drawn from all available resources.

Search for “grafana” will bring up two different kinds of results: images and templates. Panamax templates include all necessary images and configuration options needed to run an application. The Panamax core team has vetted several templates and made them available in a panamax-public-templates repository, and these templates are available by default when you install Panamax. Clicking “Run Template” and then “Run Locally” will run this application on your local machine.

If you’d like to roll your own application, you can start with the images themselves. Click “Run Image” and then “Run Locally” to run the image on your machine. From there, you can add additional images to your application.

###Managing your Applications and Resources Your applications live on the Applications page, accessed via the Manage button on the top nav. On each application’s page, you can see all of the services that comprise the app, add additional ones, group them into categories, and see the application’s log output. Drilling down into each of the services, you will be able to customize port mappings, volume mounts, and environment variables, which are all expressed in the service’s docker run string.

Check out the documentation related to creating and managing Panamax applications for a more in-depth look at the features available to you.

When your application is configured, you must save it as a template in order to be able to deploy it to a remote target. On the application page, click “Save as Template.” You will need to generate a GitHub token in order for Panamax to save the template file to the repository of your choice. By saving to this repo, it will automatically be added as a source when you search.

###Deploying with Panamax Before you run your application on your Mesosphere cluster, you’ll need to set up a Panamax remote agent and the Marathon adapter on the cluster. In order to install and utilize the Panamax Remote Agent, Panamax uses a dedicated installer node. The Panamax remote agent can run on Linux with docker installed. However, we recommend using CoreOS for simplicity.

Following the normal methods of adding VM with your cloud provider. Ensure that the node resides on the same VPN as your deployment node or cluster and the node has a publicly accessible IP.

Docker must be installed on the node where you agent will reside. After Docker is installed successfully, follow these steps to install the Panamax Remote Agent:

  1. SSH into the Panamax remote agent node created above
  2. Run $ sudo su to ensure your docker commands will run with correct privileges
  3. Run $ sudo bash -c "$(curl http://download.panamax.io/agent/pmx-agent-install)"
  4. Execute $ cd /root/pmx-agent && ./pmx-agent to invoke agent setup script.
  5. Select (1) - init to begin the installation process
  6. Follow the prompts, selecting option 3 for Marathon Adapter, adding your Marathon endpoint (typically a private IP, don’t forget the http://) 7. and Panamax Remote Agent endpoint (typically a public IP)
  7. Copy the displayed token (needed when adding the deployment endpoint to the client)

Next, use this token to add a remote deployment target to your Panamax client. From the Manage nav button, go to the Remote Deployment Targets page. Click on Add a new Remote Deployment Target, enter a friendly name and your copied token from the Remote Agent. Click Create Remote Deployment Target to save. The deploy target is now available to deploy applications.

Next, back on the search page, enter the term for the application you want to deploy. Click “Run Template” but now select “Deploy to Target.” On the modal window, select your Marathon target. From here, you’ll have the option to specify scaling information.

After you’ve deployed, you’ll see the deployment jobs and applications in your Marathon UI.

###Best Practices for using the Marathon Adapter Using Docker and Marathon together necessitates some workarounds, depending on how you’ve chosen to architect your application.

First, Marathon does not support Docker links. Panamax has translated these dependency declarations into pre- and post-deployment conditions that must be satisfied for a successful deployment. For example, if your web service depends on a database service, the Marathon adapter will wait for the database to finish deployment before firing off the web service. In this example, the database has a post-condition that it must have an available port. The web service has a pre-condition that expects to access environment variables indicating the database’s available host and port. If the database service were to fail deploying, or if any of these conditions were not met, the application deployment job would time out. Instead of Docker links, the dependency relationship is defined via these pre- and post-conditions, and through environment variables and port forwarding rules.

Additionally, dependent services must either be fronted by a proxy that you have set up, or they are limited to one instance, regardless of scaling information given at the time of deployment. If an application asks for 3 web services and 3 databases, the database service will be limited to one instance.

###Additional Resources Installing a Mesosphere cluster Panamax Remote Agent Installation

@mtrifiro
Copy link

mtrifiro commented Feb 5, 2015

Don't love the positioning of "workarounds" in last section. Suggest, instead, something like:

Using Docker and Marathon requires some unique considerations, depending on how you've chosen to architect your application.

@mtrifiro
Copy link

mtrifiro commented Feb 5, 2015

Please revise paragraph 1:

Panamax is a powerful Docker workflow tool that makes creating containerized applications easy, and deploying them even easier. An open source project from CenturyLink Labs, Panamax allows you to create application templates, configure your containers, test them on your local machine, and deploy your application to remote hosting targets. Mesosphere[link to mesosphere.com], creators of the Mesosphere Datacenter Operating System (DCOS) for managing datacenter and cloud resources at Web scale, provides a tool, Marathon[link to https://github.com/mesosphere/marathon], for launching long-running services on a Mesosphere DCOS cluster. The Panamax team is happy to announce that a Marathon remote deployment adapter is now available, making it possible to deploy to your Mesosphere DCOS cluster with Panamax, right from your browser.

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