Run Camunda as a service on PCF
In order to leverage Camunda as a service you need to run it as own deployment in PCF and connect to it via REST API:
The recommended way to run Camunda on PCF is to create and deploy a simple Spring Boot application that just provides Camunda. This folder contains a ready-to-use example.
You have mutliple alternatives to deploy to PCF
- Local build and push
- Building your own tile
This video walks you through the whole procedure and deploys the Node.JS Sample Application afterwards:
Deploy via CI/CD
If you do not fancy a local build, e.g. because you are not a Java shop, you can leverage your CI/CD to build and deploy.
As example I use Travis-CI to deploy the Camunda service on PCF using this configuration. Make sure you set environment variables for your PCF credentials:
Local build and cf push
- Add a service for a relational database named camunda-db. I used ElephantDB as managed service offering of PostgreSQL. But any database supported for Camunda will do.
- Install PCF CLI locally.
- Login (use api.run.pivotal.io as API endpoint if you run on PCF in the cloud):
- Build and push the application. Check the PCF manifest file to make sure that it references the right database service.
mvn clean install && cf push -p target/*.jar
Hint: In on-prem installations of PCF the java buildpack might not yet be available, then you need to specify that in your command:
cf push -p target/*.jar https://github.com/cloudfoundry/java-buildpack.git
- Now you can access your application by either triggering your REST endpoint or open up the Camunda web applications. PCF as default creates an URL that matches exactly your application name, in my example that is https://camunda-on-pcf-engine-as-a-service.cfapps.io:
No you can use the Camunda REST API to access the engine, e.g. to query deployed process definitions:
Run example applications
Now you can run one of the sample applications of this tutorial:
Using an external database
You might not leverage a PCF service to provide the database. In this case you have to
- Configure your database properties in the cloud profile, e.g. by copying
spring.datasource.urland related datasource parameters in a file
spring.datasource.url= # JDBC URL of the database. spring.datasource.username= # Login username of the database. spring.datasource.password= # Login password of the database.
- Make sure you disable the 'DataSourceCloudConfiguration', the easiest way is to delete the
Camunda as User-Provided Service Instances
On PCF you have the option to promote certain deployments as spo called User-Provided Service Instances. This allows to define certain metadata attached to your service, especially the endpoint (Host, URL) and credentials.
cf cups ...
This allows that deployments, which use Camunda, can simply read this data from the service description as described e.g. in Service Bindings in Node.JS.