Run Camunda BPM on Google Cloud Run

Recently Google Cloud launched a new (beta) service to run serverless container-based applications. This service does not require you to do complex platform-specific packaging. You just need to create a Docker container which follows Cloud Run container contract.

New to Camunda?

Camunda is an awesome workflow automation platform which allows you to orchestrate complex microservice interactions and human-oriented actions across different applications and platforms.

Image for post
Image for post

New to Cloud Run?

Here is a short explanation of what a Cloud Run is

Image for post
Image for post
Google Cloud Run
Introduction to Google Cloud Run

Already got a Google Cloud account? Run Camunda in 5 minutes using 5 lines on the terminal. I`ve used my open source repo https://github.com/wizecore/camunda-demo/ so you can deploy it and use immediately.

Setup default Google Cloud project

You need to select the default project you will launch Cloud Run in. Use project-id from https://console.developers.google.com/

> gcloud config set project <your-project-id>

Enable beta components for gcloud CLI

As Cloud Run is in beta state now, to enable it in CLI you need to download and install beta commands.

> gcloud components install beta

Enable Cloud Run for the current project

Enable this specific APIs either using CLI or https://console.developers.google.com/

> gcloud services enable run.googleapis.com

Set default region for Cloud Run

Choose default region for Cloud Run. Currently, only us-central1 region is supported.

> gcloud config set run/region us-central1

Run Camunda BPM 7.10

Use Camunda BPM image based on Spring Boot

> gcloud beta run deploy --image gcr.io/camundacloud/camunda-demo --memory=1G
Service name: (camunda-bpm-platform): mycamunda
Deploying container to Cloud Run service [mycamunda] in project [<your-project-id>] region [us-central1]
Allow unauthenticated invocations to new service [mycamunda]? (y/N)? Y
✓ Deploying new service…
✓ Creating Revision…
✓ Routing traffic…
Done.
Service [mycamunda] revision [mycamunda–00001] has been deployed and is serving traffic at https://mycamunda-abcabc-uc.a.run.app

(link are an example only, you will get your own link when you run a command)

Boom! You have a running serverless Camunda BPM 🎉🎉 When you open link in the browser you will find launchpad with links for most useful prepackaged resources

Image for post
Image for post

After Camunda launches, visit Google Cloud Console for logs and look for the line containing a randomly generated password:

========= YOUR CAMUNDA PASSWORD IS cafebeef =========

alternatively, you can define password using variables during startup i.e. CAMUNDA_PWD

gcloud beta run deploy --image gcr.io/camundacloud/camunda-demo \
--memory=1G \
--set-env-vars=CAMUNDA_PWD=deadbeef

The default username is demo, you can login by clicking Cockpit on the Launchpad

Image for post
Image for post

After login, feel free to look around and explore processes and instances

Image for post
Image for post
Cockpit to monitor deployed processes

You can run new instances by going to Tasklist and starting a new process

Image for post
Image for post
Starting process from Tasklist

Production notes

By default, Camunda docker container uses an embedded database for process definitions and instances. Therefore, on every restart of the service (either because of elastic scaling or after a period of inactivity) all the persistent changes will be lost.

To configure an external, cloud-hosted persistent database, change Camunda Spring Boot configuration settings https://docs.camunda.org/manual/7.10/user-guide/spring-boot-integration/

Links

About the author

Ruslan is the Tech Lead at the Futurice working on backend, architecture and cloud projects.

Written by

Tech Lead & Software engineer with a passion for #DevRel, Serverless, Java, and Javascript. https://ruslan.org

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store