CX & Design March 25, 2019
When containers meet serverless: a match made in heaven
Traditionally, websites or applications are hosted on a virtual or physical server. And even though this seems to work out fine, it’s hard to make the most out of your resources. However, so-called containers are designed to do the exact opposite: host applications and getting the most out of your resources. This brings along many advantages for both developers, engineers and businesses that need to adapt fast at any given moment. And when containers and serverless (also known as PaaS) meet, true magic happens.
The basics of containers
Many developers have encountered the issue of code working perfectly fine on their machine, but when shipped into production to a local development environment, all of a sudden the code fails them. There are several reasons for that, think of differences in libraries, versions and operating systems. Local development with the use of containers is a great solution for these types of issues. But that’s not all, the application it’s used for runs quickly and reliably from one computing (cloud) environment to the other which makes it agnostic. They’re lightweight and fast, and they include an entire environment: an application, all its dependencies, libraries and other binaries, and configuration files needed to run it, all together in one container.
Containers & Serverless
Although container development isn’t new per se, with Docker becoming increasingly popular, it’s a technology that brings along a lot of conveniences. Speed is one of them, as you can start and stop quickly with them and improve your resource utilisation because you can run many containers on a single machine. Moreover, it provides developers with the freedom to be in control of their work. Normally, a developer needs an engineer, but with this technology, he or she can work on the containers directly.
A big added value for containers comes to life when combining it with serverless hosting. This is a cloud-computing execution model in which the cloud provider runs the server infrastructure and manages the distribution of machine resources. The responsibility to manage and monitor servers and network components is a thing of the past since it’s now under control by the cloud provider.
A preferred way of building up a serverless environment is by unrolling the infrastructure based on code. By doing this via a coding script it’s easy to unroll multiple infrastructures with just a single-liner. Working like this provides yet another huge advantage for developers, namely that they can work in their own scripting mindset. So, by combining containers with serverless, developers become less dependent on ops who used to run this before and gain more control. And at this point is where the new rock stars enter the scene to make sure this actually takes flight: DevOps.
Working serverless, in turn, brings yet another set of advantages. It simplifies the process of deploying code into production, meaning fast development is a very likely possibility. Scaling up and down is easier, while developers and operators do not need to spend time setting up and tuning complex autoscaling configurations or managing systems; the cloud provider is responsible for scaling the capacity to the demand and managing the underlying infrastructure. Moreover, it can be more cost-effective, since there’s no need to involve a hosting partner or host servers yourself which generally involves periods of underutilisation or idle time. Also, costs that usually go into licenses, installation, dependencies, support and maintenance are avoided when working serverless.
DevOps in control
By developing in containers and hosting it serverless, developers have the freedom to directly implement what they built to the infrastructure, as securely as possible. And especially this is the success formula. The container is developed by the developers themselves and by combining this with serverless, you create the huge advantage of configuring an environment that makes it easy to implement their product, flawless.
Working in this combination means developers are able to run codes themselves, without the dependence upon infrastructure and support engineers. This also means that the sharp line between operations and developers is fading, because developers are able to independently work and implement code easier and faster.
Does that mean that ultimately DevOps is a dying breed? Not entirely. Hosting containers in a serverless environment still needs DevOps to manage this, making sure the developed code in containers is successfully built, tested and deployed by using ci/cd tools. Moreover, it’s essential for DevOps to keep an eye on the infrastructure on the application level. That’s why monitoring & feedback loops are very important processes for DevOps to keep the environment stable and up and running. DevOps all in all still plays a crucial part in managing the overall process, but that doesn’t mean that the boundaries between DevOps and developers aren’t slowly fading. Because where these two groups used to clash back in the days, this technology and the way of work brings both worlds together.
The combination in practice
That containers and serverless infrastructures are a match made in heaven is the work of the Dutch fintech company Essy. This corporate start-up aims towards informing and stimulating home-owners to make their houses more sustainable. Making sure that with the right information and tools they make the most profitable, easy and trustworthy choice. This way, sustainable living becomes a natural way of living. Essy achieves this with the use of a digital platform on which they connect the right people, join forces and use smart technology to help home-owners in reaching this goal.
One of these custom build data-driven technological solutions was a calculator that helps home-owners to calculate their current energy expenditure. To put it more clearly, people that want to know how they can save energy (and money) per month, need to insert data in the calculator which analyses it all and provides the customers with a number on how much they can save each month on their energy, making their homes more sustainable. This tool used an approach of containers and serverless hosting. This way, the responsibilities within the developers and operations team were directed clearly, guaranteeing continuity and speed.
New environments within minutes
For Essy, working Azure WebApps for Containers via Microsoft’s Cloud Azure was the way to go. This Microsoft technology is the key to run Docker containers in a WebApp where application settings and variables can be injected directly in the Docker container without storing plain text keys, settings and connection strings in the configuration or within the code repo.
Custom build applications (Node.JS, Python, React, PHP) which are running within the containers are all non-Microsoft technologies which are proof that Microsoft on Microsoft only technologies is a thing of the past. Using these kinds of containers and serverless technologies makes your infrastructure (cloud) agnostic.
Keyvault was used as the heart of security to store keys, secrets and certificates. Auto-generating secrets and storing them automatically in Keyvault makes your environment password proof because there is no need to see or manually store a password. Azure WebApps have the ability to make a connection to Keyvault based on the managed identity and assigned permissions without making code changes which makes this a secure setup.
The environment was built based on ARM templates and Azure CLI, all based on the principle: infra-as-code. Developers are able to roll out new environments within minutes by executing a single-line bash command.
A perfect match
In the case of Essy, the environment was implemented in no time, which is a huge advantage for an innovative company that constantly needs to keep up in a fast paced environment. By developing within containers and hosting it serverless, not only do developers have more control in how the tool would end up like, but operations can act quickly and in better conformity with developers giving them, in turn, more control over the entire project.