Cisco UK & Ireland Blog

Cracking superhero code with containers in a Cloud & DevOps World

June 22, 2016

Almost anyone writing a modern application (or even blogging about one) will tell you containers are great stuff. They let developers focus on what they’re good at – writing code.

However, operations teams are not so blessed with an easier life. Production container stacks typically involve a whole raft of layers with complex integration.

Each time someone builds all this, they’re creating a snowflake out of glue – a ‘glueflake’ if you will.

I was speaking about the various layers yesterday at Cloud & DevOps World in London Olympia and thought it would be helpful to run through the various elements again here.


OpenStack Cloud

Building a hybrid cloud is key for a successful DevOps strategy. Whilst opinion still differs slightly, OpenStack is emerging as the premier choice for on-premise cloud.

OpenStack is a joy to use – the APIs are attractive, it has near universal tool support and the community is taking the lead with many innovative projects.

Consuming OpenStack is very different from operating it. Keeping it functional, upgrading, patching and maintaining it requires ‘linux ninja’ skills, patience and sometimes luck. It’s one heck of a gauntlet to throw down to your operations team.

Cisco Metapod provides a perfect foundation for building a container infrastructure on-premise without the misery of DIY.

In other words, it’s a service providing the cloud your developers want without upsetting your operations team – boasting a 99.99% SLA and running your data centre on your hardware.

Container Stack

Container stacks are complicated. A lot of individual components need to be setup, configured and managed. Enter Mantl, an open source project designed to make setting up your end-to-end container stack a breeze.

In less than an hour you can have the full stack running on any cloud you want. Whether it’s an OpenStack cloud like Metapod, a public cloud or even your laptop via Vagrant. Once it’s up and running you have a simple platform from which to run your containers.

Check out this Mantl video for more information.

My (Super) Hero

For those that attended my technical clinic demonstration at London Olympia yesterday, you will already know that My Hero is a microservices based application that lets you vote for your favourite super hero. It comprises of three major tiers: presentation, app and data.

Click to zoom for details

Click to zoom for details

Hank has done a great job documenting this application and how it works. What I want to focus on is how easy it is to deploy.

As you may recall, Mantl makes it easy for me to deploy modern applications. Using the Mantl API it really is as simple as this:

source myhero_setup


After less than a minute I have a fully working portal! Unfortunately, the popular vote from the audience seems to reveal a poor taste in super heroes:


Click to zoom for details

Surely Star Lord is the best?

Rigging the vote

I wanted to show how easy it is to write a small, trivial microservices application to rig the vote.

Step 1 is a small python application:

Screen Shot 2016-06-22 at 16.53.12

This is a simple multi-threaded python script with 4 threads continually voting for whichever hero is passed as the first argument. On a computer it could be run like this:

python “Star Lord”

But then I’d have no scaling and be limited by my single computer. Why not live life to the full?

Let’s put it in a container. The Dockerfile to do it is just two lines:

FROM python:2-onbuild

CMD [ “python”, “./”, “Star Lord” ]

Now build & push the container:

touch requirements.txt

docker build -t mattsday/myhero_voter . && docker push mattsday/myhero_voter

Now the container is safely on DockerHub, my next step is to deploy it on Mantl. This is super easy, as I can use a simple DCOS file called voter.json:


“container”: {

“type”: “DOCKER”,

“docker”: {

“forcePullImage”: true,

“network”: “BRIDGE”,

“image”: “mattsday/myhero_voter:latest”



“id”: “myherovoter”,

“instances”: 5,

“cpus”: 0.01,

“mem”: 32


In 5 minutes I have written everything I need to rig the vote. I’ll push this to Mantl:

curl -k -X POST -H “Content-Type: application/json” \

https://$MANTL_USER_NAME:$MANTL_USER_PASSWORD@$MANTL_SERVER:8080/v2/apps -d@voter.json

Winning isn’t everything – but it helps


Click to zoom for details

Star Lord has won!

Someone described this approach as ‘lasers from space’. But it works!

In five minutes I have written a microservices application that I can scale up and down to vote as many times as I like for my personal super hero.

The neat thing is though I haven’t had to worry about setting up the infrastructure – I can focus on what matters: code.

For those of you that attended my sessions, don’t forget to enter the prize draw to win dev time on a Cisco partner cloud stack. Please also provide feedback on my sessions and tell us what you’d like to see more of via the comments box below.


Leave a comment