Deployment of Process and Java class

Hi,

I am looking for a way to deploy BPMN process definition along with relevant Java classes (javaDelegate). How it may be done via REST API and/or Cockpit?

Thank you

Java classes cannot be deployed through the Rest API.
You cannot deploy BPMN through the Cockpit.

Could deploy Groovy files and call the groovy files as external resource scripts?

Groovy is not good right now for us. So, what is the right way to make Process deployment? Could you point me, please, to the relevant page?

The best way is to create a project in Eclipse (or whatever IDE you like) using either the maven archetypes or manually - using this guide.

Once you’ve done that you can use maven to package your project in a WAR and deploy it to the container that is running camunda.

1 Like

We are looking for dynamic solution - ability to upload Process definition in runtime without need for repackage and redeployment.

If you do an initial deployment with everything you need packaged you can then update/re-deploy just the changed BPMN model itself. Assuming no additional classes or artifacts are needed for the changed model deployment will work fairly dynamically.

Right, but I do need to make an additional deployments, including Java classes. What is the way to do it?

Once you have Camunda running within an application server, in my context I use JBoss/WildFly, new projects and/or updates will trigger Camunda to update its repository.

For example:

  1. Startup your application server hosting Camunda. This is the complete platform downloaded from Camunda (though you can also build this yourself).
    example on Linux: ./bin/standalone.sh <<< from the WildFly directory

1a) Add an “admin” user for Wildfly/JBoss.
example: ./bin/add-user.sh <<< it will ask a series of questions (let me know if you have any questions with this: for development… i keep it very simple)

  1. Add and configure JBoss Tools (eclipse plugin) within Eclipse. I use Eclipse neon. Make sure you match the ports to your running server.

  2. Add the server to the Eclipse “servers” view. Make sure you set to “Server lifecycle is externally managed” - this helps speed server resets and deployments up. For development, I may “halt” the server and I don’t want to wait for Eclipse - I go directly to the server and send a “kill” signal if it’s not responding (note: I use a Linux and Win7 combination)

  3. From the eclipse “servers” view, “add” your Camunda project and deploy. If anything changes in your camunda project, you can set the eclipse “server” adapter to automatically publish if anything changes in your eclipse project. This is an excellent feature! It helps me keep an eye on potential model issues.

NOTE: This approach also works with Tomcat. But, once you become familiar with Java’s CDI… you’ll get hooked on Camunda’s “camunda-archetype-ejb-war” archetype.

It is good practice when you do the develoment. However, we plan to run Camunda as a microservice and don’t want to make redeploy after each change or new Process.

Referring to Docker containers? Or, were you thinking about something like WildFly Swarm? Or, the new AWS Lambda - I don’t think Camunda can run within AWS Lambda since it’s (Lambda) is more geared towards discrete services.

In my opinion (others will differ here), the docker container is simply like a very small virtual machine. Same practice applies.

If you’re using something like Wildfly Swarm… it should also be able to follow the same approach. But, there’s a little more setup in that you need to configure the microservice with necessary features to accept and ingest model and code updates. I’ve only tested hot-deployment capabilities on a few microservice platforms… so, I’d need more details per your platform specifics.

It is running inside Kubernetis platform. However, the idea to redploy it on each change seems not really practical.

As long as your Kubernetis platform is setup to host your application container… in some form - it should work. Recommend some extra testing and verification here. Kubernetets illustrates the management of docker images. However, your docker-hosted Camunda images would need to somehow coordinate their participation (such as sharing the same DB - or, a more federated architectural approach).

Check the admin/deployment ports on your running service (i.e. using ncat to check/verify connections). If you find the server listening on one of these ports then “hot” deployments may work.

Given “microservices”, you’d also need to insure your long-running processes remain preserved until completion. So, if you push a complete deployment that includes a fresh Database (database maintains process instances), you’ll need to add an extra step for migrations.

May I recommend that you use microservices for your process-supporting services. In-other-words, or at least for your early phases in roll-out, deploy the bulk of your BPM task implementations services as microservices. These microservices then aren’t required to maintain the sort of long-running state as a full Camunda process instance. Camunda then calls on these services, as needed, during process execution.

Camunda then runs as a bigger image hosting all the extra features necessary for maintaining continuity between process versions, type, and state.

@StephenOTT, Is it possible to use Python scripts in Service tasks? If yes, where Python executable should be defined?

Read the top paragraph of this page: https://docs.camunda.org/manual/7.4/user-guide/process-engine/scripting/

Can use jpython but will need to add it to the classpath.

1 Like

OK, it may help, thank you.

Is it possible to hot-deploy such scripts? For example, when I call deployment/create in REST api, may I add an additional part(s) with relevant scripts? Will they be deployed along with the Process?

Yes you can deploy scripts along side your BPMN files with the Rest API as part of the single deployment. Look at: https://medium.com/@stephenrussett/deploying-external-scripts-with-camunda-rest-api-e06bd90a2931#.k8ywemdwp

1 Like

Dear Team,
Need some info on clustering.
We have developed spring boot application, which enables camunda suite. We planning to deploy on AWS, whenever we will scale up(create another instance of an application). How cockpit(Camunda suite) will work for each instance or will be maintaining single instance for both the instance.

Thanks and Regards,
Shashikumar K S

Hey Niall,

i have a maven project in intellij and i want to deploy my project to camunda docker.
i created a container for camunda and copied the .war file inside it with this command :
docker cp /Abschlussarbeit/BachelorA/Bachelorarbeit-Process/target/Bachelorarbeit-Process.war 9738f8a3aa229f05703e072357e2f0c454834171bd9d05e02f2e20fcf9a9fba1:/camunda/webapps
All tasks are succefully completed when i start the process in camunda bpm, only 1 service task can’t be executed. this 1 task musst create a pdf file and save it in a folder in my maven project. it seems like camunda can’t read this task. my process is successuflly executed but i can’t find any pdf file in the folder. is there another Method to deploy my project in camunda docker other docker cp… ?
hier is my pdf java file.

package org.example;

import com.itextpdf.io.font.;
import com.itextpdf.io.image.
;
import com.itextpdf.kernel.color.;
import com.itextpdf.kernel.font.
;
import com.itextpdf.kernel.pdf.PdfDocument;
import com.itextpdf.kernel.pdf.PdfWriter;

import com.itextpdf.layout.;
import com.itextpdf.layout.Document;
import com.itextpdf.layout.border.
;
import com.itextpdf.layout.element.;
import com.itextpdf.layout.font.
;
import com.itextpdf.layout.property.TextAlignment;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.delegate.JavaDelegate;

public class pdf implements JavaDelegate {

@Override
public void execute(DelegateExecution delegateExecution) throws Exception {

    try {



        String path = "/Abschlussarbeit/BachelorA/Bachelorarbeit-Process/Urkunde/"+delegateExecution.getVariable("student_id")+".pdf";







        PdfWriter pdfWriter = new PdfWriter(path);

        PdfDocument pdfDocument = new PdfDocument(pdfWriter);
        pdfDocument.addNewPage();

        Document document = new Document(pdfDocument);


        //Title
        Paragraph title = new Paragraph("BACHELOR-URKUNDE" +"\n\n")
                .setFontColor(new DeviceRgb(8, 73, 117))
                .setFontSize(30f)
                .setTextAlignment(TextAlignment.CENTER);



        //image
        String IMAGE = "/Abschlussarbeit/BachelorA/Bachelorarbeit-Process/images/logoFH.png";
        ImageData data = ImageDataFactory.create(IMAGE);
        Image image = new Image(data);
        image.setFixedPosition(500, 650);
        image.scaleToFit(150,180);

        //text
        Paragraph name = new Paragraph().add(delegateExecution.getVariable("name") + " , " + delegateExecution.getVariable("prename"))
                                         .setFontSize(20f)
                                         .setTextAlignment(TextAlignment.CENTER);
        Paragraph para = new Paragraph().add("hat sein Bachelor fĂĽr den Studiengang "+ delegateExecution.getVariable("degree") + " mit der \n Gesamtnote " + delegateExecution.getVariable("gesamtNote") + " bestanden."+"\n"+"Herzlichen GlĂĽckwĂĽnsch!")
                .setTextAlignment(TextAlignment.CENTER);


        document.add(title);
        document.add(name);
        document.add(para);
        document.add(image);







        document.close();
        //System.out.println("finish");


    } catch (Exception e){
        System.out.println(e);
    }

}

}