Tomcat

Executing deployments requiring a Tomcat Server.

Tomcat

Integrating Tomcat into Your Deployment Logic

DeployHub Pro integrates with Tomcat for managing deployments where you need to stop and start the Tomcat server as part of your deployment logic. Actions for Tomcat Windows servers are pre-defined within DeployHub Pro. At the Application level, you define Pre and Post Actions that perform the calls to stop and then start Tomcat. You will be creating new Procedures and Actions to complete this setup. For more information see:

The following steps will take you through the process.

Creating Pre and Post Actions for Starting/Stopping Tomcat

Step 1 - Download and Import the Tomcat Stop and Start scripts as Procedures

Download the the most current DeployHub Pro Tomcat Procedures from the Ortelius Git Repo. There will be two:

  • TomcatPreDeploy.re: This Procedure stops your Tomcat Server.

  • TomcatPostDeploy.re – This Procedure starts your Tomcat Server.

Step 2 - Create your Tomcat Procedures

Once downloaded, you will need to Import the scripts into DeployHub Pro as Procedures. To import these Procedures navigate to the Func/Procs Menu option on the left hand side of the DeployHub Pro Main Menu panel. This will take you to the Functions and Procedures List View. From the Functions and Procedures List View select the Import option. The Import will bring you to your operating system “file open” dialog box for selecting the TomcatPreDeploy.re and TomcatPostDeploy.re files.

Next, select your “Global,” or highest level, Domain and upload the Procedure into DeployHub Pro. If you select a lower level Sub-Domain you will restrict access. By defining it to your highest level Domain, all Users will be able to see the Procedures. Once you have both imported, you are now ready to create your Action.

Step 3 - Create your Action for the Tomcat Procedures

Once you have imported your TomcatPreDeploy.re and TomcatPostDeploy.re files as Procedures, you can define your Actions. Navigate to the Actions list view from the Actions menu option on the left hand side of the DeployHub Pro Main Menu panel. You will be creating two Actions, one for your Tomcat stop step, and the other for the Tomcat start step. One will be called in the Pre Action the other in the PostAction.

  • Create the TomcatStopAction Use the +Add option to create your first new Action. In the “Full Domain” field select your “Global” Domain. If you select a lower level Sub-Domain you will restrict access to this Custom Action. By defining it to your highest level Domain, all Users will be able to execute the process regardless of their Sub-Domain.

Name the new Action “TomcatStopAction” (no spaces).

Now we are going to customize this Action. On the right hand side, you will see a list of Functions and Procedures you can choose from. Navigate to your Domain to find the TomcatPreDeploy.re imported Procedure. Drag it onto the area under “Start”. When you drag the TomcatPreDeploy.re Procedure onto the area under “Start” a pop-up dialog box will open for you to complete the following parameters:

Field Value Description
Title Not Required Name of the step in your deployment workflow.
Summary Not Required Enter a summary of this step.
Tomcat Service Name $TOMCAT_SERVICE_NAME The service running Tomcat
Tomcat Root $TOMCAT_ROOT Tomcat web root
Application Name $APPLICATION_NAME Application name (based on the .war or .ear)
  • Create the TomcatStartAction

Follow the directions above, except name the new Action “TomcatStopAction” (no spaces). Again on the right hand side of the Action Dashboard, you will see a list of Functions and Procedures you can choose from. Navigate to your Domain to find the TomcatPostDeploy.re imported Procedure. Drag it onto the area under “Start”. When you drag the TomcatPostDeploy.re Procedure onto the area under “Start” a pop-up dialog box will open for you to complete the following parameters:

Field Value Description
Title Not Required Name of the step in your deployment workflow.
Summary Not Required Enter a summary of this step.
Tomcat Service Name $TOMCAT_SERVICE_NAME The service running Tomcat
Tomcat Root $TOMCAT_ROOT Tomcat web root
Application Name $APPLICATION_NAME Application name (based on the .war or .ear)

At this point your new Actions are ready to be used by anyone with access (based on Domain and security options). Each Component that uses the these Actions as Pre and Post steps to the deployment will need to define specific values.

Step 4 - Assign the TomcatStop and TomcatStart Action to an Application

Create your Application and define your Pre and Post Tomcat Actions using the Application Dashboard. The Applications Pre-Action should be assigned the TomcatStopAction. This will cause your Tomcat server to be stopped prior to the Application files being deployed. The Application’s Post-Action should be assigned the TomcatStartAction which will start Tomcat after the deployment of your .ear/.war has been completed. For more information see the Application Chapter.

Step 5 - Set Your Application Attributes_

The following variables must be added to the Attributes Section for your Application using the TomcatStopAction Pre Action and TomcatStartAction Post Action. The Attributes section can be found on the Application Dashboard. Use the +Add option in this section to add a row for the variable. You must use Save to commit the row to the table:

Variable Name Value Description
TOMCAT_SERVICE_NAME The service running Tomcat
TOMCAT_ROOT Tomcat web root
APPLICATION_NAME Application name (based on the .war or .ear)