Get Umbraco demo docker images running on Azure

In my last post Umbraco demos in docker containers with default starterkit vendr demo store or umarketingsuite, I explained how get up a simple Umbraco demo instance in a local environment from a docker image (hosted in docker hub). This time, we will see how to deploy it in Azure Cloud.

In Azure, which services and why

There are several options in Azure to get docker containers running. Each one with pros and cons depending on what we are looking for.

Azure kubernete service

This is the option that looks the most natural, however, the main purpose of Kubernete is to orchestrate and scale container architectures, for simple Umbraco instances, it is a little under engineering, and also, the setup process is not straight forward, it requires several steps to be done and resources to set up. So, this is not the best solution for what we are looking for here.

Virtual Machine

Docker containers on Virtual Machine is quite an easy and quick option, and could be really cost effective in case of complex container infrastructure against other Azure services. However, virtual machines sounds a little old-fashioned, needs more maintenance tasks and are, from my point of view, not really cloud friendly for simple Umbraco demos..

WebApp service for container

Azure offers the option to create web apps for docker containers, which is really nice. We can take advantage of all the powerful web app functionalities for docker containers, like scaling, slot deployment, and much more. This is a perfect option for a long-running container deploy, but the negative side of it is that only premium tiers allow windows containers and the cost immediately increases.

Azure container instances (ACI)

ACI are serverless containers-as-a-service instances, very fast and super easy to set up. It is a per-second billing service, so only is paid for the time used it and it is definitely cheaper than a web app, view pricing. It is perfect to get an isolated container up and definitely the best option for our Umbraco demo setup. Let’s see step by step how to get this working.

Get Umbraco demo running step by step on Azure container instances

In this example, we will set up a simple Umbraco instance with the default starter kit, the docker image is hosted in Docker Hub: Umbraco demo docker image .

  1. From your Azure subscription, choose Container instances service

enter image description here

  1. Create a new Container instances service:

enter image description here

Note: Azure container instances are not compatible with Windows images version 1803 (https://docs.microsoft.com/en-us/azure/container-instances/container-instances-faq#what-windows-base-os-images-are-supported), so you must use the Umbraco Demo image built on top of Windows Server Core ltsc2019.

  1. Set up on the networking options, a DNS Alias for your container. This name will be used as url for your the site, in my case umbraco-demo.westeurope.azurecontainer.io. Make sure, also, to keep the port 80 opened (by default):

enter image description here

  1. You can now create the resource, wait for a while and browse the site on http://umbraco-demo.westeurope.azurecontainer.io and the magic is done.

enter image description here

Manage your ACI with logic app

Now, let's have a look on how easy it could be to perform some management tasks on the container instance with Azure Logic App, like stop, start, reset, etc. Logic app has a very handy connector for Azure Container Instances out of the box: https://docs.microsoft.com/en-us/connectors/aci/.

In this sample, to optimize the cost, we will keep live the container we created before only 8 hours per day (8am to 4pm, UTC+1) from Monday to Fridays, more or less 556000 seconds per month, meaning around 13 € per month (price simulated on the Azure pricing calculator https://azure.microsoft.com/en-us/pricing/calculator/)

The logic app setting look like that:

enter image description here

The connection with the container instance is quite straightforward and we used as the container group name, the name of the container itself:

enter image description here

You can download the Json configuration of the logic app setting here, make sure to update the subscription id.

The caveat of this setup is that because the database (SQLCE) is part of the docker image, every time the instance is stopped and started again, the site is reseted from scratch, that is pretty cool for a demo.

Next challenge

In the case described in this post, we are only managing one simple container that makes everything easier. What happens if we need to orchestrate more containers, like for instance adding an SQL server container for the database ? Azure Container instances support instance groups, that means that we can get up complex containers infrastructure based on docker-compose files. Sadly, this feature is only available for Linux images, so, it doesn’t work in our case. The options could be using separated isolated azure container instances for them, or get back to the other alternatives describe at the beginning of the post, virtual machine or kubernete. Anyway, we have to take into consideration that Umbraco v8 is still tidy up with the .net framework, in a (perfect) near future, Umbraco will run on .net core, so containerized will become cheaper, smaller and easier, with everything up in Linux containers (SQL server already works on Linux).