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.
Before you begin
Before you begin the tutorial, make sure that you completed the
Prerequisites.
About this task
To work through this tutorial, you need an agent that is
running on a target computer system. This target computer can be a
cloud resource, a virtual image, or a physical computer. You must
have access to this computer and be able to install MySQL, Apache
Tomcat, and the
IBM UrbanCode Deploy agent
on it. Follow these steps to set up an agent and a target system for
your work with the tutorial:
Procedure
- 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
6.
- Install an agent on the target system. See Installing agents.
- On the IBM UrbanCode Deploy server,
verify that the agent is installed by clicking . 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:
- To the left of the Agents tab, click 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 , 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 server on the target system. The application uses a MySQL database. If you are using a Linux operating system, you can
use the package manager to install and start MySQL. If you use Red Hat Enterprise Linux version 6, run the following
commands:
yum install mysql mysql-server
chkconfig mysqld on
/etc/init.d/mysqld start
On Windows, you
can use a graphical installer or download a binary package for the
MySQL 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:
- Log in to MySQL command line as the MySQL root user. For example, if you installed MySQL as the root user, run
this command from the command line:
mysql -u root
The command line now shows a prompt that looks like this
prompt:mysql>
- Create the database with the following command:
create database jpetstore;
If the command runs properly, you see the message Query
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 message Query
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 message Query
OK, 0 rows affected.
- Type quit to exit the MySQL command
line.
- Verify that the user can access the database:
- From the command line, log in to MySQL 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 MySQL command
line.
- Install Apache Tomcat version 6 or version 7 on the target
system. A simple way to install Tomcat
on a Linux operating system
is to download and install the binary distribution of Tomcat version
6 or version 7, 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 and user tags
at the bottom of the file. Then, add the following lines of code to
those tags:
<role rolename="manager"/>
<user username="tomcatmanager" password="tomcatmanager" roles="manager"/>
The
end of the file looks like the following example:<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, open the file conf/tomcat-users.xml and uncomment
the role and user tags at the bottom
of the file. Then, add the following lines of code to those tags:<role rolename="manager-script"/>
<role rolename="manager-gui"/>
<user username="tomcatmanager" password="tomcatmanager" roles="manager-script,manager-gui"/>
The
end of the file might look like the following example:<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 number
8081. 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 number
8445. To update the port numbers from the command line, run this command:
sed -i 's/8443/8445/g' /opt/tomcat_directory/conf/server.xml
Results
Now the agent and the target system are configured for your work with the sample
application. You need the passwords and locations that you specified later.