Quantcast
Channel: pureVirtual » Installation
Viewing all articles
Browse latest Browse all 24

How to create a Panamax template for really cool Docker management

$
0
0

My last post about Panamax showed how to get started quickly with it in OS X, now let’s go ahead and look at why Panamax is an awesome tool and showcase one of it’s main strengths; Templates!

If you look at the really long list of all Docker images that exist out there, you will see that many are one of two things:

  1. Multi-app images where everything needed to run a service is baked in
  2. One-app images that aren’t connected to anything else

There are problems and benefits with both. The multi-app images are usually full of all needed dependencies and configurations for an app and don’t adhere to the “12 Factor App” rules, but they’re great if you just want to try out a new tool or app without having to invest too much time.

The one-app images are usually adhering to the “12 Factor App” rules when looking at isolating code, but they usually lack in the documentation of how to actually connect this specific containerized app to another app. Think of it as having a database in a container without any documentation on how to connect a web server app to it. Not really useful.

This is where Panamax really shines. The templates within Panamax actually connect regular one-app images with a really easy to read and use fig-like construct, to make sure we can have a system of isolated apps where the parts can be exchanged, modified, increased and decreased (think web scale HA environments for instance). Pretty awesome!

So, how do you use it? I’ll try to explain using an app template I created for the Panamax App Template challenge, “Sensu with separate Redis, RabbitMQ and Uchiwa” consisting of the following containers:

  1. redis
  2. Uchiwa
  3. Sensu
  4. RabbitMQ

When creating this new application template within Panamax, do the following:

Search for redis which will be used as the key-value store for Sensu:

Screen Shot 2014-09-08 at 7.52.58 PM

Choose to run the redis image:

Screen Shot 2014-09-08 at 7.53.12 PM

Verify that redis starts running in your new application under “application services”. You can change the name of you application from “redis:latest_image” to something more useful if you’d like, same with the category from “Uncategorized” to something else:

Screen Shot 2014-09-08 at 7.54.47 PM

And to make sure we have an easy to understand application, let’s use the awesome “categories” function. Create a new category for the “GUI” where we’ll add the Uchiwa image in just a bit:

Screen Shot 2014-09-08 at 7.56.46 PM

Click to add a service to it, search for the correct Uchiwa image and add it to the app:

Screen Shot 2014-09-08 at 7.58.44 PM

Repeat these steps to create categories and services for Sensu and RabbitMQ, and you’ll end up with something like this:

Screen Shot 2014-09-08 at 8.04.44 PM

Cool! Now we have a bunch of containers running in one application construct, but we’re not done yet. Now we can start connecting them together :)

Click the magnify glass icon on the RabbitMQ image to enter another dimension of what Panamax can do:

Screen Shot 2014-09-08 at 8.06.53 PM

What you’ll now be presented with is a vast array of configuration options available for this image, especially which ports we want to publish to other containers and how we can actually connect them together:

Screen Shot 2014-09-08 at 8.09.28 PM

Make sure you expose the correct ports for each image:

  1. RabbitMQ: 5672, 15672
  2. Redis: 6379
  3. Sensu: 4567 (I’m not making this one up :))
  4. Uchiwa: 3000

Ok, nice, now you’ve opened up the ports so that the apps can actually talk to each other. But they don’t, yet. Let’s get to that now!

On the Sensu service, add the redis and rabbitmq images as two “linked services” like this:

Screen Shot 2014-09-08 at 8.15.45 PM

On the Uchiwa image, do the same but this time link it to the Sensu image:

Screen Shot 2014-09-08 at 8.17.45 PM

When you’re finished, go back to the application screen and click the little link icon on the right corner. You should see something like this:

Screen Shot 2014-09-08 at 8.20.00 PM

Whoho! You have now created an application template! You’ve added 4 Docker images that each perform an important task, you’ve exposed ports on some of them and you have linked them together. You’re pretty great, you know that?

Now let’s actually access this application, add a port binding for Uchiwa and link it to the already exposed container port:

Screen Shot 2014-09-08 at 8.48.05 PM

After that, run the following command in your preferred terminal:

VBoxManage controlvm panamax-vm natpf1 rule1,tcp,,8997,,8080

Now you can point your browser to http://localhost:8997 and you’ll be able to to see the Uchiwa GUI, connected to the Sensu API, storing information in Redis and RabbitMQ. Awesome work, dear reader!

Now this template can be saved into Github so you can share them with your fellow colleagues, partners, customers etc, just follow the instructions outlined here. Have fun!



Viewing all articles
Browse latest Browse all 24

Trending Articles