Automatic deployment

Hi,
what are the step for automatic deployment of war in camunda?

Presently I am generating war in eclipse and manually coping and pasting it to webapp folder of camunda then running .sh file for deployment. I want as soon as war is generated it should automatically goes to camunda and deployment happens…

cheers,
Jauhari

Hi @jauhari,

at the moment there is no autodeploy functionality implemented, you just perform normal deployment in your application server\web container. You can use rsync\cron jobs to automate it if you want.

Cheers,
Askar

You can use the maven-deployment-plugin to automate it by maven: Have a look into our archetype, how it worked: https://github.com/camunda/camunda-archetypes/blob/master/camunda-archetype-servlet-war/src/main/resources/archetype-resources/pom.xml#L181-L218

Hope this helps.

Ingo

2 Likes

Ingo’s suggestion is what I would do if you want to deploy directly from your Eclipse instance into a running Camunda server. You don’t mention which Java server you are using, but I suppose you’re using Tomcat as you referenced the use of a “webapp” directory. Following is a configuration from a pom.xml file for use with JBoss WildFly. It provides at least some idea of how this should be done, though it is not specific to Tomcat. Note that the values represented as “variables” (e.g. “${wildfly-camunda-username}”) would be set “higher up” in the pom file, typically in the properties section.

Here are a couple more things to keep in mind:

  • You will need a library (dependency) to make this work that is specific to the target Java server.

  • You will need to change paths, etc. in the following to match your environment.

  • The username and password will be for an administrative user on the Java server supporting Camunda, not necessarily a system user.

  • If you are deploying to an SSL encrypted interface, some deployers will not support that.

  • Make sure the goals set in your pom.xml file match those in your run configuration. Somethings they don’t match in the way you would think. For example, with WildFly, you must use something like: wildfly-plugin:redeploy

      		<plugin>
      			<groupId>org.wildfly.plugins</groupId>
      			<artifactId>wildfly-maven-plugin</artifactId>
      			<version>1.0.0.Final</version>
      			<configuration>
      				<hostname>${wildfly-camunda-hostname}</hostname>
      				<port>${wildfly-camunda-port}</port>
      				<username>${wildfly-camunda-username}</username>
      				<password>${wildfly-camunda-password}</password>
      			</configuration>
      			<executions>
      				<execution>
      					<phase>deploy</phase>
      					<goals>
      						<goal>redeploy-only</goal>
      					</goals>
      					<configuration>
      						<jbossHome>C:/camunda-bpm-ee-wildfly10-7.5.3-ee/server/wildfly-10.0.0.Final</jbossHome>
      						<serverName>wildfly_server_1</serverName>
      						<targetDir>C:/eclipse_workspace/processServicel/target</targetDir>
      						<fileName>processService-0.0.1.SNAPSHOT.war</fileName>
      					</configuration>
      				</execution>
      			</executions>
      		</plugin>

@mppfor_manu
Hi,
in pom.xml I can see
<fileName>processService-0.0.1.SNAPSHOT.war</fileName> (Last line).
How can I know this name before generating the war, as this pom will be configured before running the application ?

I have not actually tried to implement more sophisticated Maven configuration. However, I do know that variables can be set to provide values that Maven will use when executing a specific goal. I don’t know if these variables can be set in the “environment” by some process or if you would have to create some way to dynamically modify the pom.xml file.

For example, your entry above might look something like this:

<fileName>${processName}-${processVersion}.SNAPSHOT.war</fileName>

The values for “${processName}” and “${processVersion}” would typically be set in the properties section of the POM file. However, there are probably mechanisms that would allow you to set them dynamically as opposed to you having to modify the POM file each time (which you don’t want to do). I don’t know how to do that.

Finally, I’m not completely sure I understand your requirements. Do you want to create a “prototype” project with all of this automation set up so that you can simply create a new project from it? If so, the first step would be to understand how to create a Maven archetype, which I don’t know how to do. That way, when you go to create a new process, you would create a new Maven project you would use that archetype as starting point. You would name the project or process and that name should “flow” into the pom.xml file some way.

The deployment mechanism, assuming the Camunda server hostname, user, and password were static, would automatically be there every time. Then after you finished your process, you would execute the Maven build and include the deployment goal. This would build, package, and deploy your project in one step.

One reason we still use the Camunda Eclipse plugin is because all of the machinery to do this is in there. Camunda Modeler decouples several key development tools (like creation of custom Java classes) from the primary development environment. I don’t think that’s the right way to do it.

I wish I could give you a simple recipe for what you’re trying to do, but if you’re going to use Camunda Modeler and a separate instance of Maven, then you’re going to have to build a lot of the automation yourself.