Configuring the agent and target system
To deploy applications with IBM® UrbanCode® Deploy, you need one or more agents. The server uses the agents to deploy the application components on target systems.
-
Prepare a computer for use as the target system.
This computer must meet the system requirements that are listed in System requirements and performance considerations. Most of the examples in this tutorial show information for a simple Linux™ operating system such as Red Hat Enterprise Linux version 7.
-
Install an agent on the target system.
See Installing agents.
- On the IBM UrbanCode Deploy server,
verify that the agent is installed by clicking Resources > Agents. Your agent must appear
in the list of agents with a status of Online,
as shown in the following figure:
- Add the agent as a resource:
- Go to the Resource Tree tab.
- Click Create Top-Level Group,
give the new group a name such as JPetStore agents and
click Save.This group is a container for resources, such as agents.
- On the same row as the new resource group, click Actions > Add Agent, as shown in the following figure:
- In the Create Resource window, select the agent in the Agent field and click Save.
The agent is now listed as a child of the resource group. You must add agents to resource groups in this way so that applications can access the agents through the resource group. -
Install and start the MySQL/MariaDB server on the target system.
The application uses a MySQL/MariaDB database.If you are using a Linux operating system, you can use the package manager to install and start MySQL/MariaDB. For example, on Red Hat Enterprise Linux version 7, run the following commands:
yum install mariadb mariadb-server
systemctl enable mariadb
systemctl start mariadb
On Windows, you can use a graphical installer or download a binary package for the database server. Then, start the server by going to the bin folder and running the mysqld command. - Create an empty database for the application to use:
-
Open a command-line window and log in to the database as the root user.
For example, run this command from the command line:
mysql -u root
The command line now shows a prompt that looks like this prompt:MariaDB>
- Create the database with the following command:
create database jpetstore;
If the command runs properly, you see the messageQuery OK, 1 row affected
. - Create the database user with the following command:
create user 'jpetstore'@'localhost' identified by 'jppwd';
If the command runs properly, you see the messageQuery OK, 0 rows affected
. - Give the user access rights to the database with the
following command:
grant all privileges on jpetstore.* to 'jpetstore'@'localhost';
If the command runs properly, you see the messageQuery OK, 0 rows affected
. - Type quit to exit the MySQL command line.
-
Open a command-line window and log in to the database as the root user.
- Verify that the user can access the database:
-
From the command-line window, log in to the database as the new user:
mysql -u jpetstore -pjppwd
- Run the following command to list the databases on the
system:
show databases;
- Verify that the
jpetstore
database appears in the list, as shown in the following figure: - Type quit to exit the database command line.
-
From the command-line window, log in to the database as the new user:
-
Install Apache Tomcat on the target system.
You can use Tomcat version 6 through version 9.A simple way to install Tomcat on a Linux operating system is to download and install the binary distribution of Tomcat, as in the following steps:
- Download the binary distribution of Tomcat, such as apache-tomcat-6.0.39.tar.gz .
-
Extract this file to a folder on the target computer, such as
/opt/apache-tomcat-6.0.39 .
For example, on a Linux operating system you might run the following command:
tar -xf apache-tomcat-6.0.39.tar.gz ; mv apache-tomcat-6.0.39/ /opt
- Add an administrative user to the Tomcat server in the conf/tomcat-users.xml file.
This user account is necessary to deploy applications to Tomcat.For example, for Tomcat version 6, open the file conf/tomcat-users.xml and uncomment the
role
anduser
tags at the bottom of the file. Then, add the following lines of code to those tags:
The end of the file looks like the following example:<role rolename="manager"/> <user username="tomcatmanager" password="tomcatmanager" roles="manager"/>
<role rolename="tomcat"/> <role rolename="role1"/> <user username="tomcat" password="tomcat" roles="tomcat"/> <user username="both" password="tomcat" roles="tomcat,role1"/> <user username="role1" password="tomcat" roles="role1"/> <role rolename="manager"/> <user username="tomcatmanager" password="tomcatmanager" roles="manager"/> </tomcat-users>
For Tomcat version 7 or 8, open the file conf/tomcat-users.xml and uncomment therole
anduser
tags at the bottom of the file. Remove the text<must-be-changed>
and replace it with passwords for the default user accounts. If you do not remove this text, the configuration file is unreadable and your sample application will not be able to access Tomcat. Then, add the following lines of code to those tags:
The end of the file might look like the following example:<role rolename="manager-script"/> <role rolename="manager-gui"/> <user username="tomcatmanager" password="tomcatmanager" roles="manager-script,manager-gui"/>
<role rolename="tomcat"/> <role rolename="role1"/> <user username="tomcat" password="tomcat" roles="tomcat"/> <user username="both" password="tomcat" roles="tomcat,role1"/> <user username="role1" password="tomcat" roles="role1"/> <role rolename="manager-script"/> <role rolename="manager-gui"/> <user username="tomcatmanager" password="tomcatmanager" roles="manager-script,manager-gui"/> </tomcat-users>
- In the conf/server.xml file, modify
the default HTTP ports to avoid conflicts.
-
Replace all instances of port number
8080
with port number8081
.To update the port numbers from the command line, run this command:sed -i 's/8080/8081/g' /opt/tomcat_directory/conf/server.xml
-
Replace all instances of port number
8443
with port number8445
.To update the port numbers from the command line, run this command:sed -i 's/8443/8445/g' /opt/tomcat_directory/conf/server.xml
-
Replace all instances of port number