New to camunda here. I am thinking of maintaining the war files (i.e. the bpmn files, forms and the code for them) in the same repo as my backend application and have their deployment automated with merges to master, so as a new version of the workflows is merged to master, it also gets zipped in a war file and deployed. I wonder if war files can contain a bpmn and its forms only with no java code in case that particular workflow doesn't really need java code to be completed?
Since you did not provide us with enough information about your Camunda Stack this answer might be too generic.
According to the official Camunda documentation you basically have two deployment options:
You can of course have a .war
deployment file containing only forms and .bpmn
(or .dmn
) files. You can check the following simple example of .war
deployment to shared container-managed process engine via a separate process application.
If you have access to your Camunda REST API you could also consider deploying through /engine-rest/deployment/create
endpoint (documentation and specification of the endpoint can be found here).
If you plan to automate the process of process deployment, I also provide a script we use in our Gitlab CI/CD pipeline to deploy the process. We keep the processes (.bpmn
, .dmn
, .js
and forms) in separate repository, with the following structure:
definitions/
- .bpmn
and .dmn
filesscripts/
- javascript files needed for script tasks or listenersforms/
- JSON forms we use for our custom build user task formsOur case will probably be different than yours, but the script can be adjusted to your particular needs or serve as an inspiration:
#!/bin/bash
SCRIPT=`realpath $0`
SCRIPTPATH=`dirname $SCRIPT`
if [ -z "$CAMUNDA_DEPLOYMENT_ENDPOINT" ]; then # LOCAL DEPLOYMENT ENDPOINT WON'T BE SET
CAMUNDA_DEPLOYMENT_ENDPOINT="http://localhost:8080/engine-rest/deployment/create"
fi
if [ -z "$CAMUNDA_DEPLOYMENT_NAME" ]; then # OPTIONAL: YOU CAN NAME THE DEPLOYMENT VIA ENV VARIABLE
CAMUNDA_DEPLOYMENT_NAME="rest-deployment"
fi
# FAIL THE SCRIPT WHEN CREDENTAILS ARE NOT SET
if [ -z "$CREDENTIALS_USERNAME" ]; then
echo "Error: Username not set, please set the CREDENTIALS_USERNAME env variable."
exit 1;
fi
if [ -z "$CREDENTIALS_PASSWORD" ]; then
echo "Error: Password not set, please set the CREDENTIALS_PASSWORD env variable."
exit 1;
fi
ENCODED_CREDENTIALS=$(echo -n "$CREDENTIALS_USERNAME:$CREDENTIALS_PASSWORD" | base64)
echo "Deploying to $CAMUNDA_DEPLOYMENT_ENDPOINT"
CURL_OPTS="curl --write-out '%{http_code}' --show-error --fail --silent --request POST --url $CAMUNDA_DEPLOYMENT_ENDPOINT --header 'Authorization: Basic $ENCODED_CREDENTIALS' --header 'Content-Type: multipart/form-data' --header 'content-type: multipart/form-data;' --form deployment-name=$CAMUNDA_DEPLOYMENT_NAME "
if [ -z "$(ls -A scripts/)" ]; then
echo "Empty scripts folder"
else
while read -r file; do
echo "Adding following javascript source: $file"
name=${file##*/}
CURL_OPTS+="--form $name=@$SCRIPTPATH/$file "
done<<< "$(find scripts/ -type f -print)"
fi
if [ -z "$(ls -A definitions/)" ]; then
echo "Empty definitions folder"
else
while read -r file; do
echo "Adding following process definition source: $file"
name=${file##*/}
CURL_OPTS+="--form $name=@$SCRIPTPATH/$file "
done<<< "$(find definitions/ -type f -print)"
fi
if [ -z "$(ls -A forms/)" ]; then
echo "Empty forms folder"
else
while read -r file; do
echo "Adding following form file: $file"
name=${file##*/}
CURL_OPTS+="--form $name=@$SCRIPTPATH/$file "
done<<< "$(find forms/ -type f -print)"
fi
echo "Executing deployment request:"
echo "------------------------------"
echo "RESPONSE:"
echo "------------------------------"
echo "$CURL_OPTS"
response=$(eval "$CURL_OPTS")
echo "------------------------------"
echo "$response";
I hope you can find any of this useful. You can find many sources on each of the approaches.