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.
New to Cloud Run?
Here is a short explanation of what a Cloud Run is
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
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
After login, feel free to look around and explore processes and instances
You can run new instances by going to Tasklist and starting a new process
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
- What is Camunda? Learn more about workflow process automation for microservices and workflows: https://camunda.com/products/bpmn-engine/
- What is Cloud Run? Try this new exiting serverless container based technology: https://cloud.google.com/run/
About the author
Ruslan is the Tech Lead at the Futurice working on backend, architecture and cloud projects.