Best Practice

Global at the click of a button...!?

The Scenario

It's 4pm on a Friday afternoon. One of our Sales team has an amazing potential customer who wants to try out our Pi Dashboard. The problem is they're based in Sydney, Australia, and they need it RIGHT NOW.

Our demo system currently runs locally in the UK. When that demo is to someone in Australia over a conference call, those 10,000 miles between us and the potential customer become a problem. It would make our demo sluggish and not show off how stunning and quick our software is!

However, thanks to the cloud, and a few tools, the customer's location is no longer an issue. Within 15 minutes we can have a full dashboard environment up and running in Australia. The potential customer is free to try out our dashboard in their own time and the experience is super-fast because the system is in their country.

Whether the potential customer was in India, USA, Brazil, Japan, or London, we can create an environment for them in the same time it takes me to walk from our office to Morrisons.

AWS - The cloud bit

Amazon Web Services (AWS) is a cloud provider. They provide a huge array of services based on being able to quickly and easily deploy servers (called 'instances' in AWS language) anywhere in the world. There's lots of other services too, like being able to communicate with your satellite using AWS Ground Station, but that's for another blog post!

Using AWS means we only pay for what we use. Once the customer has finished their evaluation, we can delete all the infrastructure in a few minutes. That's one of the reasons we use the cloud, it gives us much more flexibility compared to a traditional data centre; plus, we don't have to look after any hardware!

These are a few of the AWS services we use:

• EC2 - lets us create a Linux instance that we can deploy our dashboard application onto

• RDS - provides a database where data is stored for our dashboard to report on. Our dashboard can connect to lots of different databases, but for this environment we use Microsoft SQL Server

• CodeDeploy – deploys our dashboard application to the EC2 instance

• Auto-Scaling group – the health of the instance is constantly monitored. If there is a problem with the instance, it is automatically replaced with a new and working instance via an Auto-Scaling group

This all results in an amazed potential customer!

Terraform - Making it repeatable

We've got our environment in the cloud, that's great! Our potential customer can get on with evaluating our product.

But setting up all that infrastructure over and over again is boring. Every Panintelligence demo environment will be the we need to set up each one manually? Of course not!

Step in, Terraform!

Instead of manually carrying out each step in AWS to create the infrastructure, I can create a template which defines each bit of AWS I want to use, what it should look like and how it should connect together. Terraform takes that template and creates all the infrastructure for you. It can be used repeatedly, meaning we know each environment will be the same.

Jenkins - Making it easy

Running the Terraform template will create a brand spanking new environment, but it still involves typing in some commands which is easy to get wrong. Can we make it any easier? Can we make it so simple that even my boss Steve could build an environment? Of course we can!

We use the automation server Jenkins to get AWS and Terraform working together and hide the whole process behind this form:

You type in an environment name and the subdomain name. You select the part of the world to deploy to and how big the instance should be (bigger = more expensive but more processing power to do things quicker). Finally, you click Build and go do something for 15 minutes. Come back and you'll have a fully working dashboard at the URL you specified. Almost like black magic. :O

What's next?

There's plenty I'll be doing to improve this process. Here are a few things:

• Improve the Jenkins form - ap-southeast-2 is AWS's code for Sydney, but is not so user friendly
• Implement Packer – allows us to create a 'gold' image of the operating system with our dashboard pre-installed. This will speed up the process and remove the need to deploy our dashboard application. It'll already be installed and ready to go!
• Implement Docker - this packages up the application and everything it needs into a single file. You can then run that file, along with lots of other files that are completely isolated from each other, on one instance. That'll save some money!

Next time - deploying without anyone noticing. How we use AWS to deploy our application with zero downtime.

About this blog

Why are we blogging? There's a lot of technology out there and it's often overwhelming. Showing how we do things here at Panintelligence might help others on their cloud journey. 

Read more


How we test our dashboard

01 September
Best Practice

Behaviour Driven Development

23 January