This tutorial will educate you about Application Deployment Automation without any manual intervention using IBM UrbanCode Deploy (JBoss Application Server).
All the 12 steps involved in the process along with the tools are explained here in detail with clear screenshots for your easy and better understanding.
NOTE: This tutorial has many images so allow it to load properly.
What You Will Learn:
- What is IBM UrbanCode Deploy?
- Tools Used in this Tutorial
- Step #1: JBoss Configuration
- Step #2: UrbanCode Deploy Login
- Step 3: Verify Agent Status
- Step 4: Add Files
- Step 5: Creating Components
- Step 7: Import the component version
- Step 8: Create Component Process
- Step 9: Create an Application
- Step 10: Create Application Process
- Step 11: Deploy the component
- Step 12: Rational Team Concert6.0.2 Post-Deploy Build Settings
What is IBM UrbanCode Deploy?
IBM UrbanCode Deploy is a tool for automating application deployment through various deployment environments like Dev, QA, Staging, and PROD.
It is a very important tool used for continuous delivery in agile development.
UrbanCode Deploy provides:
- Automated deployments and rollbacks of applications
- Orchestration of application changes across servers
- Inventory Management
- Clear visibility which defines what and where artifact is deployed
- Integration with various J2EE and .NET application servers and ITSM tools
- Integrate with build and test tools to automatically deploy, test and promote new builds
IBM Rational Team Concert and IBM Urbancode Deploy help to automate the CI / CD steps:
Tools Used in this Tutorial
- IBM UrbanCode Deploy v6.2.2. To install UCD 6.2.2 server, please check here
- WildFly10.0 Application Server (Formerly known as JBoss Application Server)
- JDK 8. This version of JDK is mandatory with Urbancode Deploy 6.2.2
- Download and install Urbancode Deploy plugin for JBoss from here
Step #1: JBoss Configuration
This tutorial uses WildFly 10.0 (Formerly known as JBoss Application Server) as the application server to deploy a WAR file using UrbanCode Deploy.
Start the JBoss application server by running the file standalone.bat. This file can be found in the JBoss installation directory \bin folder.
(Note: Click on any image for an enlarged view)
Sample WAR file Deploy through JBoss
Start the CLI command by running the file Jboss-cli.bat and typing connect
Step #2: UrbanCode Deploy Login
a) Login to UrbanCode using this URL https://<ServerName>:8443
b) Install the UCD Agent.
An agent must be running on all target machines or environments(QA, Staging etc) where deployment is being carried out. An agent does the job of deploying artifacts to the target environment.
c) Go to the Help menu and select the Tools option.
d) Click the link to download the zip containing the Deploy agent
e) Extract the agent ZIP file and RUN the file install-agent.bat to install it.
f) Sample installation of Agent. At the end of the installation do not select to Run the Agent as Windows service.
g) Run the agent from the Installed directory. Select the file cmd
h) Agent starts in a command window. Do not close this BLANK. Just minimize it
Step 3: Verify Agent Status
After you log in to the IBM UrbanCode Deploy server, verify if the agent is online. To check, go to Resources and select the Agents TAB as shown below. The agent should have a status of Online in GREEN, as shown in the following figure. Only agents with online status can perform the task of deployment.
Step 4: Add Files
Add files that represent deployable artifacts to the file system, on the computer where you installed the agent.
- Create a folder on the machine where the agent is installed.
- In this folder, create a subfolder named as 1.0.
- In the this1.0sub folder, copy the project WAR file. In this example, it is called HelloWorld-Maven.war
Step 5: Creating Components
Components are typically the “What” of deployment. It defines a deployable piece of application like WAR/JAR file, database SQL file etc. In Urbancode Deploy, you can import deployable artifacts from any build system, SCM system or file system.
In my previous tutorial, I showed you how BUILD is done, using Rational Team Concert SCM repository and how a J2EE WAR file is generated. In this tutorial, I will first show how we import the WAR file from a file system and then the second part will be about how a deploy can be automated to an environment directly from RTC Build
To start the first step in IBM UrbanCode Deploy includes creating/configuring components & component processes and adding the components to applications. Then, you use the processes to deploy the components to different environments.
The artifacts for this example component come from the file system where the IBM UrbanCode Deploy agent is installed.
How to create JBoss component:
- On the Components tab click Create New Component.
- In the Name field, type JBoss_Component.
- Select File System (Versioned) in the Source Config Type drop-down box
- In the Base Path field, specify d:\tempfolder created in step 4.In this folder, there is a subdirectory called 1.0 which is actually a version for the artifact. So we need to be sure to use the temp directory and not the d:\temp\1.0directory.
- Select the second radio button to import the component version using the agent installed
- Accept the default values for the other fields on the page.
- Click Save.
Step 7: Import the component version
- Click the Versions tab.
- Click Import New Versions. The server imports 1.0 as a new version. If other folders were in the Temp directory, they too would be imported and versions would be created for them as well.
- The version 1.0 is now listed and the WAR file is within
Click on 1.0 version
Step 8: Create Component Process
A Component process describes various steps on how to automate the deployment without any manual intervention.
In this step, we will create a deployment process for the JBOSS_Component. Later, we will create an application process that uses the component process to deploy the component. These two steps are required to deploy the WAR file effectively.
How to create the component process:
#1) On the “Component: JBOSS_Component” page, click the Processes tab and then click Create New Process.
#2) In the Create New Process window, type _JBoss_Component_Process in the Name field.
#3) Click on the HelloWorld_JBoss_Component_Process. The process editor opens. The process editor lists plug-ins and steps to deploy the application. The 2 steps – Start and Finish represent the beginning and the end of the process and are automatically placed on the editor. You need to add steps for deploying the application to the process by dragging them onto the editor between the Start and Finish steps.
a) Firstly expand Repositories => Artifact => IBM UrbanCode Deploy on the plugin palette on the left and drag the Download Artifacts step to the process editor.
This step downloads the specified version, which will be mentioned during the deployment later on, about the component artifacts to the agent’s recently working directory which is typically the <drive:>\<AgentDir>\var\work\<Name of Comp>.
So in most cases, this is usually the first step as the application (WAR file) is downloaded from UCD server to the target machine or the environment for deployment
Click on the MIDDLE icon to edit the step
Click OK and do not add or modify any fields in this step.
b) We will now do the following steps to automate the deployment.
(i) Stop or Disable the application
(ii) Undeploy the current version deployed in JBoss AS
(iii) Deploy a new version of the application
c) Expand Application Server => Java =>JBoss and drag the remaining steps to the process editor. Enter the values as shown below
Values for each step
Step 9: Create an Application
Applications manage components, and contain environments.
How to create an application:
1) Click the Applications tab and then click Create New Application.
2) Name the new application. , For instance, HelloWorld-Maven_JBoss_Application
3) Accept the default values for the other fields and then click Save
4) Add the JBOSS_Component to the application.
5) Click the Components tab and then click Add Component.
6) In the Add, a Component window, select the JBOSS_Component and then click Save. Only if components are added to an application it can be deployed.
Step 10: Create Application Process
An application process, like a component process, consists of steps that are configured within the process editor. In this step, you create an application process that installs the JBOSS_Component component by calling the component process that we created earlier.
How to create an application process:
1) Click the Applications tab and then click the HelloWorldMaven_JBoss_Application.
2) Click Processes and then click Create New Process.
3) In the Create an Application Process window, name the new application process something like HotelWeb_JBoss_Application_Process.
4) Accept the default values for the other fields and click Save.
5) To open the new process in the process editor, click the new process.
6) Click on HelloWorld-Maven_JBoss_Application_Process to open the Process editor.
7) Add a step that deploys the JBoss_Component. From the list of steps on the left, add an Install Component step to the editor.
8) In the Component list, select the JBoss_Component. All components that are associated with an application are available.
9) In the Component Process list, select the HelloWorld-Maven_JBoss_Component_Process
10) Accept the default values for the other fields and then click Save.
11) Connect the Start step to the Install JBoss_Component step.
12) Connect the Install_JBoss_Component step to the Finish step.
13) Save the process by clicking the Save icon
Save the process
Step 11: Deploy the component
Before we start the deploying process, we need to create a Resource which defines what should be deployed and where it should be deployed. So, we need to link the Agent and then the component to the resource.
a) Click on the Resources tab at the TOP
b) Click on the Create Top-Level Group button, give the new resource a name such as JBoss and click Save.
c) Click Actions > Add Agent to the resource which was just created, as shown in the following figure:
Link the Agent to the Resource
Link the Component to the Agent
Click on Save.
d) Before you can run any deployment, you must define at least one environment that associates components with an agent on the target host. Let’s create a SIT_Env.
e) Open the Create New Environment window by clicking Applications > HelloWorld-Maven_JBoss_Application> Environments > Create New Environment and then enter the following information and later click Save
f) Click on the Environment just created and select Add Base Resources. Select the JBoss folder and Click OK
g) To deploy the component, run the application process on the SIT_Env environment.
- Open the application page by clicking Applications and then clicking on the application name.
- On the environment, click the Request Process icon
- In the Run Process window, un-check the default value for the Only Changed Versions parameter.
- In the Process list, select the HelloWorld-Maven_JBoss_Application_Process
- Click Choose Versions. The Component Versions window opens.
- In the Component Versions window, click Add and select the 1.0 version. Click OK to return to the Run Process window.
- Click Submit. The progress is shown. From here, you can watch the process run on the application server. The following figure shows the running process.
Step 12: Rational Team Concert6.0.2 Post-Deploy Build Settings
In my previous tutorial, we learned about the BUILD process which generated the application WAR file. The Build definition created can now be extended to call the above UCD Application process.
So the benefit here is that, once the BUILD is done the application is auto-deployed to a particular environment thereby not waiting for a resource to be made available to manually deploy the application.
Firstly we need to open the Build Definition which we created in the previous tutorial and enable the Post-Build Deploy option.
Click Ok after selecting the Post-build Deploy option. Also, remember to SAVE the Build Definition
Base Directory is the folder where the WAR file resides after the Build is completed.
Now when you request a build and after it is completed the deployment will automatically begin and no manual intervention is needed.
In this tutorial, we learned how an application deployment can be automated without manual intervention using IBM Urbancode Deploy which is a very useful tool for DevOps.
Today it is very crucial from an automation point of view too. We also came to know how IBM Rational Team Concert BUILD process can be extended to automate the deployment once the build is completed.
This tutorial focused on JBoss as the application server. You can also use other J2EE application servers like Websphere Application Server, Weblogic, Tomcat etc. as well for deployment automation.
Let us know your thoughts/suggestions in the comments section below.