Lesson 2: Creating component processes
Component processes describe automated tasks that run on components. Component processes can deploy, install, uninstall, update, or run other tasks on a component.
About this task
- Generic processes run outside the context of components or applications. Generic processes are
shown on the top-level Processes tab. You can use generic processes in these
instances, for example:
- In conjunction with a number of different component processes that do not fit well into a component template
- When you want to run processes that directly affect HCL Launch agents that are unrelated to component, such as changing the agent configuration
- Application processes run within the context of applications. In many cases, application processes call component processes. For example, an application process can call the component processes that deploy their associated components.
- Component processes run tasks on a single component, such as deploying it, uninstalling it, or running configuration tasks on it.
Processes are lists of steps and connections between those steps. Each step is an individual command that runs on a target computer. Steps can manipulate files, run system commands, download files, and run programs. Plug-ins contribute most of these steps; plug-ins are available that work with many different types of software.
Each component must have at least one component process to deploy or install the component. In this lesson, you create a deployment process for each of the three components. Later, you create an application process that calls these component processes to deploy each component.
Creating a component process for the web component
The component process for the web component downloads the most recent version of the component artifacts and puts those artifacts in the correct folder.
About this task
Procedure
- On the Components tab, click the JPetStore-WEB component.
- Click Processes, and then click Create Process.
- In the Create Process window, specify the name to be Deploy component.
-
In the Process Type list, select Deployment.
This list has other options for processes that uninstall or configure components.
-
Accept the default values for the other properties, and click
Save.
The process opens in the process editor. This editor shows the steps in the process in a graphical form, as a flowchart. The Start and Finish boxes represent the beginning and the end of the process. From here, you add steps to the process and link them between the Start and Finish steps to show the order of the steps.
-
Add a step to clean any files out of the working directory.
The process runs within a working directory. To ensure that you are using the most recent version of the files in the web component, run a command to clean the working directory:The new step is displayed as a box in the process editor. The process editor looks like the following figure:
-
Add a step to download the latest version of the component artifacts.
The Download Artifacts step is used in most deployment processes. This step downloads the specified version of the component artifacts to the target computer. When you run the process, you will specify whether to use the most recent version of the component artifacts or a specific version.
-
Tip: When you drag the first step into a process editor, that step is automatically connected to the Start and Finish steps. When you drag subsequent steps into the process editor, place the cursor in the target position so that the connection arrow is highlighted, and then place the step. The new step is automatically connected. You can always change step locations and manually connect steps later.In the step palette, expand Repositories, and under Artifact/ HCL Launch, drag the Download Artifacts step to the process editor.
- Click the Edit icon , and in the Edit Properties window, accept the default values; then, click OK.
-
-
Add a step to remove the old web content from the server:
-
Add a step to deploy the new content to the server.
This step copies the component artifacts to the application server.Now the process has four steps, as in the following figure:
- Optional:
If your steps are not connected or are not connected in the correct order, you can connect the
steps manually:
You can connect steps in a sequence like these steps, or you can run steps in parallel with each other by creating more links. However, processes always start with the Start step and end with the Finish step. The sequence of steps in this process is as follows:
Start
Clean working directory
Download Artifacts
Remove old content
Deploy new content
Finish
- Save the process by clicking Save.
Results
Creating a component process for the application component
The application component consists of a single WAR file. This component process downloads the most recent version of the WAR file, updates values in the file, and deploys the file on the application server.
Procedure
- From the Components tab, click the JPetStore-APP component.
- Click Processes, and then click Create Process.
- In the Create Process window, specify the name as Deploy component.
- In the Process Type list, select Deployment.
- Accept the default values for the other properties, and click Save.
-
In the process editor, add a step to clean the working directory.
As you did for the web component, add a Delete Files and Directories step named Clean working directory, and specify a period in the Base Directory field and
**/*
in the Include field. -
Add a step to download the artifacts.
As you did for the web component, add a
Download Artifacts
step, and accept the default properties. -
Add a step to extract the WAR file.
You must extract the WAR file so you can update a property file with the database connection information.
-
Add a step to update the property file with the location of the database:
-
Add a step to update the WAR file with the new property file:
-
Add a step to start Tomcat:
-
Add a step to remove any previous versions of the application:
-
Add a step to deploy the updated WAR file to the application server:
- Optional:
If required, arrange and connect the steps in the following order:
Start
Clean working directory
Download Artifacts
Expand WAR
Update Property File
Update WAR
Start Tomcat
Undeploy Application
Deploy Application
Finish
-
Change the conditional flag on the link between the
Undeploy Application
andDeploy Application
steps toboth
by clicking the green check mark on the connection until it turns to a gray circle, as shown in the following figure:
Each connection from one step to another has a conditional flag. The conditional flag specifies a condition for the connection. Three conditional flags are available:- By default, the conditional flag on each connection is set to
success
, which is represented by a green check mark. The process follows these connections when the step succeeds. - The conditional flag
fail
is represented by an exclamation point (!) in a red field. The process follows these connections when steps fail. - The conditional flag
both
is represented by a gray circle. The process follows these connections regardless of whether a step succeeds or fails.
Undeploy Application
step fails if no previous versions of the application are installed. In this case, setting the conditional flag on the connection toboth
specifies that the process keeps running regardless of whether the step fails or succeeds. - By default, the conditional flag on each connection is set to
- Save the process.
Results
Creating a component process for the database component
The deployment process for the database component updates the database with sample values.
Procedure
-
From the Components tab, click the
JPetStore-DB
component. - Click Processes, and then click Create Process.
- In the Create Process window, specify the name as Deploy component.
- In the Process Type list, select Deployment.
- Accept the default values for the other properties, and click Save.
-
In the process editor, add a step to download the artifacts.
As you did for the web component, add a
Download Artifacts
step, and accept the default properties. -
Add a step to update the database:
You must create a database version table on every target database either manually before you run the DBUpgrader plug-in steps for the first time or as part of the first change.
- Optional:
If required, arrange and connect the steps in the following order:
Start
Download Artifacts
Upgrade DB
Finish
- Save the process.
Results
In this lesson, you created component processes to deploy the components.
You can use component processes to automate many different tasks on components. However, you generally do not run component processes directly; in most cases, you add them to application processes. Later in this tutorial, you will create an application process for these three component processes.
Processes consist of steps, which are provided by plug-ins. To see a list of plug-ins that are available, and for documentation on those plug-ins and steps, see HCL Plug-ins.