Panamax — Or how I got my mom running her ruby cms … on a cluster!

grégory horion
4 min readSep 4, 2014

--

First things first: If you know the pain to get your mom running her own cluster please show me some love here by clicking on the star button!

Pana what?

Panamax is not the new trendy word for yet another icebucket challenge, but the new open source tool for humans to help you manage your docker architecture, that made some noise lately.

So what’s the most famous ruby cms?

Locomotive CMS of couse!

Locomotive CMS is an open source ruby cms brought to you by Didier Lafforgue, that has been around for some times now, i’ve use it a lot for friends and small projects… and now my mom uses it ☺

Why the best?

  • It’s a gem, so you can code any app on top of it!
  • You can do Multi-Site (you get blog.iLoveMyself.me, mom.IamFinallyOnline.com on the same server)
  • Multi-Language (yep, you can translate your all site!)
  • Inline editing (that’s a killer feature for my mom)
  • You get custom content (pretty cool to bring some logic in your site)
  • YOU GET AN API FOR FREE!

But wait, to get locomotive cms she’d have to install rails, imagemagick, ruby and so on, and that’s not an option right?

Docker to the rescue

This is where comes Docker:

Docker is an open platform for developers and sysadmins to build, ship, and run distributed applications

Yep, so all i had to do was to create an image with all those things so that she wont have to install all those stuffs.

That’s not all. To get locomotive working, you’ll need to store your data into a DB. Locomotive uses mongodb by default, so that means that she’d need a docker image for mongodb and link the containers together…hmmm not an option for her.

You don’t have any excuse!

Here comes Panamax:

An open-source project that makes deploying complex containerized apps as easy as Drag-and-Drop

Oh F***ing yeah! (said my mom)

Panamax will run on top of CoreOs, on VM or not, depends your OS.

So either you are on OSX, Linux or Windows (and i know that you guys have plenty of excuses), it will just work!
You’ll just need to install Virtualbox 4.2 and Vagrant 1.6 prior to that, again, regarding your OS.

Nb: make sure to allocate enough memory since some templates are pretty consuming. You should be fine with 2core and 4096Mb Ram.

What it if i don’t have a computer?

Run it in the cloud!

Yep, in fact “you could run panamax “theoretically anywhere CoreOs can run”, and that’s pretty cool!

Ok, so what’s next?

Man, next thing she saw was this:

So basically she was able to run any panamax template or run any docker image that is on docker hub.
Only thing she had to do was to search for “locomotive_cms” template and click install.

You might have to wait for it to pull all the images from docker hub. The waiting time will depend on your connection speed.

Once installed, don’t forget to click on the link on the top left to read the doc! It’ll give you the pre and post install instructions. In this case, i’ll guide you to set up the Environment Variables and things to do for your template to work.

For locomotiveCMS you’ll need to create:

You can go and set those variables up by clicking on the docker containers (the small icons) and the Environment Variables should be on the top right:

So where is the cluster?

As you’ll notice in the locomotive_cms_cluster_gregory template, there is 6 images involved vs 3 for the locomotive_cms_gregory (the simple one), so here it is.

This template will setup HAProxy to load balance your 2 instances of locomotive_cms. Those will share the same mongodb and memcached (to make sure all the sessions is shared by the n instances as well as the cache).

From a high level this is how it looks like:

NOTE:

If you have any trouble with any template, you could download the images by hand, this would have been more tricky for my mom, but here are the steps from a terminal:

  • panamax ssh (yep, you get direct ssh access to your vm)
  • docker pull mongo:latest
  • docker pull metakungfu/locomotive_cms:2.4.1
  • docker pull wizardapps/ngrok:latest

For the cluster version, you’ll need to add those:

  • docker pull tutum/memcached:latest
  • docker pull tutum/haproxy:latest

Then rebuild the template by clicking in the button in the UI.

The END!

Now you get everything you need to get your mom on docker with panamax to run the app she was dreaming about!

And this is how my mom has finally been able to play with my tools. She’s now proud of me.

The great points of panamax for me is the fact to be able to share and manage templates.

PS:

If you liked this post please LIKE IT HERE and become a member of the prestigious club of the stargazers!

If you disliked it though, please Click on the little star HERE and i’ll get back to you!

--

--