I'm charmed - modeling a cloud with Juju

Modeling a cloud solution in Azure can be described as well... lacking. Don't get me wrong - we have ARM with recently updated reference(it really helps when it comes to create a custom template with many not-so-popular resources), but it is limited to components available to it. What if I want to deploy something created as a Docker container? Or use configuration prepared with Chef or Puppet? Well, it's still possible to incorporate all above into your process of delivering software, but it easily becomes a total mess. I'd like to introduce a tool to you, which could help in scenarios, where simple ARM templates and VSTS hit their limits.

What is all about?

Juju is a tool, which can help you in modeling how your infrastructure should look like and how it is connected. While Chef or Puppet help you prepare, manage and run multiple complex configurations related to all components used for your software, Juju works in a layer above - it excels in combining all scripts, containers and components into easy to understand model, which can be parameterized and reused. 

What is more, it is fully integrated with many different clouds - you can use it with AWS, Google Cloud, Azure or even create your local cloud using LXD. Its capabilities are quite impressive.

I want it!

To get started I strongly recommend you to read how to install and use Juju. Only thing you need is at least Ubuntu 16.04 LTS which you can easily obtain from the marketplace in Azure Portal. You can also use your local machine with Ubuntu installed on it - it's purpose is to have a central controller, which can be used to control our infrastructure.

When you reach Create a controller section, I'd like you to stop for a moment. In fact we don't want to focus on using Juju with LXD - I'd like to go straight to Azure bootstrap since this is what it's all about!

To configure Juju to work with your Azure subscription you will need a subscription identifier. Please go through this tutorial, which should help you add credentials to your account. When you have credentials added, just go to the terminal and enter:

kamz@blog-ubuntu:~$ juju bootstrap azure mycloud

This will take several minutes to actually configure whole bootstrap and your new environment.

The result of running a bootstrap command

Once bootstrap has completed, you can run another command:

juju gui

it will return a URL where you can access Juju and credentials to be used to sign in. Note that using GUI is optional - you can perform all tasks using CLI only. 

Juju dashboard after a bootstrap has been initialized


In this post I introduced application modeling term and presented the easiest way to get started with Juju. In the next post we'll try to get even more knowledge about other parts of it like charms and bundles and what we can do with them.

Replacing your application stack with Azure services

I've been thinking recently what would be the cost of Azure services, if I'd like to replace my VM with this particular cloud solutions. Please do have in mind, that in this post I'm not taking into account multiple third-party applications(like TeamCity or YouTrack), which I run on the VM along with my projects. Only technology stack matters.

What do we have?

My VM is a very basic machine:

  • Windows Server 2012
  • 1 Core AMD Opteron Processor 6386 SE 2,80 GHz
  • 50 GBs HDD storage
  • 4 GBs RAM

It's perfectly fine to run a simple SPA application, SQL server and EventStore to aggregate events from multiple devices. It's far from optimal solution but serves well since many months. Cost - about 18 EUR. 

If I had a chance to start from scratch, I'd select following stack on Azure:

  • EventHub for 10M events for 9,65 EUR
  • App Service shared infrastructure for 8,16 EUR
  • Table Storage with 50 GBs of storage and 100 transaction units for 3,26EUR

It gives total of 21,06 EUR.

Pros and cons?

While having a VM gives you great flexibility, it also complicates many things when it comes to update all software, deploy and configure it. It's also a bit more difficult to integrate all together. The biggest disadvantage of a VM is the lack of scalability - if an application will meet its higher requirements, it will cost us much more to migrate to the higher stack.

The downside of a stack built on Azure is having shared infrastructure for our web application which can(but doesn't have to be) problematic from time to time. What I like about this solution is having it all in once place and integrating it all with ease. What is more I can add Azure B2C for free and have a widely used access control solution for my application. Who knows, maybe I'll migrate to the cloud in the future?