Building and Managing Software Applications — Anywhere, Anytime
Our company, Concept Reply, was asked to develop an IoT platform that allows managing smart streetlights to make cities and places more attractive. Our client is a manufacturer of parts for industrial automation, interconnection and interface solutions. Concept Reply implemented an innovative solution by using a standard for wireless communication that allows IoT devices to communicate over a large distance with minimal battery usage (LoRaWAN). This cloud-based platform is targeting small and medium-sized cities that cannot afford expensive street lighting solutions.
We would like to share our experiences on how we successfully solved the above needs of our customer, by implementing a cost-effective solution with high availability, in addition to how to build and manage your applications anywhere, anytime.
1. The Problems
Some problems with the building, deploying and managing software applications can be listed as follows.
a. Problem-1
Software companies would like to develop their software applications fast and reliably without spending too much time for setup and deployment. Also, their customers expect to receive their products as soon as possible. Moreover, customers would like to run their software applications easily in their environments for many reasons. Sometimes a software application runs in one environment but doesn’t run in another one.
How can we fulfill those two groups’ needs?
b. Problem-2
Think about having two software developers and these developers have been developing a software application for 3 years. After completing the software application, they give it to their customer. Then, a few years later, they leave the company.
After the software has been running very well for 2 years, the customer wants a new feature or a bug to be fixed. You have a new developer for this issue. The new developer needs to reconfigure the environment to run the software application by using the same tools that the former developers used.
c. Problem-3
You have a software team and they have been developing a software application together. Sometimes they even have the same source code but some of them say “The application works on my machine but does not work on my colleague’s machine”.
How can we solve this problem?
d. Problem-4
You have a software application in the production environment, and it receives high number requests only 30 days per year and you need to handle them. It means that for 335 days you do not need extra infrastructure to fulfill this requirement.
How can you solve this problem by taking the cost into consideration?
2. The Solution
There are many solutions for the problems mentioned in the ‘Problems’ section. Therefore, we would like to explain one of the best solutions based on our hands-on experience.
The short answer to all problems is creating microservice based software applications then containerize them by using Docker and finally deploy them to the Amazon Cloud by using AWS Fargate Task service as depicted below:
Let`s explain this three-step solution and match each of them to the problems.
First, we can start to design microservice based software applications. Microservice architecture breaks down your software applications into manageable and independent small components to develop software applications more easily.
Containerization is a term which has been used for the shipping industry for a while. It means that cargo in containers can be traded between ships, trucks and trains with standardized handling equipment.
The Software industry has also used the same analogy. They would like to ship their applications to different environments (e.g. development, testing, staging, production, etc.) with standardized handling tools without dealing with too much environment configurations.
In technical terms, containerization is an Operating System (OS) level virtualization method. Virtual Machine virtualizes your hardware level and containerization virtualizes your OS level.
A container is an atomic and contained package of software that includes everything it needs to run (code, binaries, libraries, packages, etc.). You can use different platform types as a container engine. Docker is one of them.
Docker is a platform that allows you to build, test and deploy containers quickly. It is open-source which is widely used. These containers can be easily shipped to other machines and it can be run there without any problems.
A docker container is launched by running an image. An image is an executable package that includes everything needed to run a software application.
After containerizing your software application with Docker, the first problem (Problem-1) can be easily solved by utilizing “Docker Compose”. “Docker Compose” is a tool for defining and running multi container docker applications. You just need to create a docker-compose file related to each environment and run the “docker-compose up” command.
The second problem (Problem-2) can be solved in many ways. For example, by using Virtual Machines or Vagrant etc. However, by utilizing Docker is much easier. One needs to download the source code and one just needs to run “docker-compose up” command to have the former’s developer environment.
The third problem (Problem-3) can be solved by utilizing docker images. If you have the same source code as your teammate, the problem may be that you and your teammate have different versions of the tools, software, and operating systems. If your teammate wants to run the code, they can download the image along with the code and dependencies and it can easily run without having any problems.
If you have a lot of containers, then you need to deploy and scale containers independently. That is, you need to have an orchestration tool. Amazon Elastic Container Service (ECS) is one of the best options. It allows you to run your containers on a managed cluster of Amazon EC2 instances in a highly scalable way. Amazon ECS has two launch types. One of them is “Fargate Launch Type” and another one is “EC2 Launch Type”. The advantage of Fargate Launch Type is that you don’t need to manage EC2 instances under the containers, Amazon will do it for you. We can think Fargate as a “Container as a Service”. The disadvantage of this launch type is that it is more expensive than EC2 launch type.
Resource: https://aws.amazon.com/blogs/aws/aws-fargate/
The fourth problem (Problem-4) can be solved by Amazon ECS Fargate Launch Type. It can be used to scale up when traffic is high and scale down when traffic is low. You can pay extra money when the traffic is high and don’t need to pay extra money for other days as well.
3. The Benefit
We have had the following benefits after containerizing our software application and using Amazon ECS to manage docker containers:
In addition to the benefits above we also list customer satisfaction.
* In AWS ECS Fargate launch type billing is based on the gigabytes of memory and the CPU cores required per second by your task. Therefore, you pay for only the usage of your task without having to pay for unused EC2 capacity.
According to the Amazon document, Amazon’s Compute SLA guarantees Monthly Runtime Percentage of at least 99.99% for Amazon ECS. (https://aws.amazon.com/ecs/faqs/). We have been using AWS ECS Fargate tasks for more than a year without any problems of availability.
4. Resources
· Amazon Elastic Container Service Documentation, https://docs.aws.amazon.com/ecs/index.html
· Docker Enterprise Container Platform, https://www.docker.com/
· Introducing AWS Fargate — https://aws.amazon.com/blogs/aws/aws-fargate/