Deploy Camunda using Azure App Service (WebApp)

Madhu Naidu
tech_experiments
Published in
6 min readNov 1, 2020
Deploy Camunda BPM in Azure App Service Container

Note: To deploy Camunda as Azure Container instance please refer here.

In this article we will see how to deploy Camunda on Azure App Service Container. When I initially started creating an Azure App Service Container for Camunda server, it was an easy task to create the App Service and start using Camunda. However the real challenge I faced was mounting volumes in Azure App Service to point to my custom bpm-platform.xml and mounting webapps to a empty folder to avoid creating the default example workflows in Camunda.

What not to expect: We will not be speaking anything about the embedded version of Camunda using Java or Spring Boot. We will be using the Camunda standalone server docker image.

Pre Requisites:

  1. You should have basic knowledge of Camunda and how Camunda works.

2. You should have an Azure account and have access to create resource

Using Azure App Service for container(WebApp for Container) we can deploy docker images directly on Windows or Linux machines without much effort. We will be using Azure portal to create Azure resources for this task.

As I said earlier there are 2 ways to deploy Camunda server in Azure.

  1. Deploying it as a Container Instance and use it
  2. Deploy it as a App Service Container and use it.

To know the difference between the both refer here. If your not sure whether to use Container instance or App Service for Continer refer here.

Let’s jump to see how to create the App Service. First login to Azure portal and create a new resource.

In Azure portal click on create resource to create a new Azure resource

After clicking on Create new resource search for Web App for Containers

Search for Web App for Cotainers
name can be any name you prefer
we need to provide the full path of image camunda/image name:version

In the Docker selection , select Options = Single container, Image Source = Docker Hub and Access Type = Public. To know the different Camunda images please refer here.

You can decide whether you need app insights logging. We will turn off application insights in our example.

Next click on Review + create. On click of create the App service gets created with a url to access Camunda.

By default Camunda uses H2 db. If we want to use MySQL or PostgreSQL db then we can configure it using the application settings under configuration

I am using MySQL. When using MySQL I initially used to get timeout error. So I had to add the app settings DB_VALIDATE_ON_BORROW = true, DB_VALIDATION_QUERY = SELECT 1 and WAIT_FOR=dbhost:dbport

For more Camunda specific application setting properties please check here.

On creating the app service, Camunda is up and running. We can access it using the url (azure app service url/camunda). When accessing for first time Camunda asks to create default admin user.

When accessing Camunda, we can see the default processes and tasks are created. This should be avoided in a production environment because it adds unnecessary processes and increases application startup time.

To avoid creating default processes and tasks on startup Camunda suggests mounting the /camunda/webapps directory to a empty directory

To do volume mounting in Azure app service we use the Path mapping.

In App service path mappings we create 2 volume mappings, one for /camunda/webapps/examples and one for /camunda/webapps/camunda-invoice. If we mount the entire /webapps folder then the Camunda welcome page will not be shown. To avoid this we mount only the examples and invoice folder.

To add path mapping we first need to create a Azure storage account and then create a blob storage container. Inside the blob storage create the paths /camunda/webapps/examples and /camunda/webapps/camunda-invoice. We upload dummy file test.txt because Azure does not allow to have empty folders.

Once the storage paths are added we then add the path mappings in Azure app service.

Now if we save the path mappings and restart the app service the default processes and tasks will not be created.

Note: Make sure the application setting WEBSITES_ENABLE_APP_SERVICE_STORAGE is set to false.

Once Azure app service is up, Camunda runs fine and all looks good. But if we need to enable the basic authentication or LDAP authentication we need to update the bpm-platform.xml file. I also faced another issue with async tasks, the parallel gateways and timer events were getting stuck if the Camunda app service restarts every time. On checking I realized I had to set the “jobExecutorDeploymentAware” flag to false to fix the issue. This change should be done in bpm-platform.xml file.

Now the drawback is we cannot mount single file in Azure app service. If we need to do volume mount then we need to mount the entire /camunda/conf folder. If we mount the /conf folder then we need to set the server.xml, web.xml, context.xml and other files. This is not a viable solution.

Luckily Camunda provides a way to load bpm-platform.xml from a seperate path or from url. To make it simple lets upload our custom bpm-platform.xml into blob container storage and use the url in our application settings.

Once we have uploaded the bpm-platform.xml file we can provide its path in the app setting path BPM_PLATFORM_XML

Now Camunda picks our custom bpm-platform.xml instead of the default bpm-platform.xml inside $CATALINA_CONF/server/conf.

Now our app service works seamlessly without any issues.

Conclusion

Deploying Camunda BPM into Azure App Service for Container Service makes things simple since Azure App Service takes care of scaling. However the drawback is Azure app service allows only 1 instance of Camunda to run. For microservices environment it is good to go for Azure Container instances and Kubernetes.

--

--

Madhu Naidu
tech_experiments

An enthusiastic developer interested in taking up challenges in my daily life