Create a UrbanCode Deploy Cluster using AWS

Let’s see how to install and configure a 2 node uDeploy cluster with Amazon Web Services (AWS).

First of all create 2 Linux Instances (if you are asking why not Microsoft Windows Server you can stop reading and go for a walk).

Choose your region and click on EC2, then “Launch Instance”:

Click next until “Configure Security Group”, then choose a name for your group like “uDeploy” and add rules to open inbound ports: 22, 8443, 7918, 7919 and 2049 like fig. below:

Go back to Instances, select your first instance and click on Actions, then “Launch More Like This” to create a new one with same configurations of the first.

Now let’s create your DB instance:

Click on Services, then look for Databases and click on RDS

CLick on “Create Database” and choose your engine (MariaDB in this tutorial).

then define Instance Name, Master Username and Password and create a “New Security Group” like in fig. below:

The new MariaDB Security Group rules must allow incoming traffic from EC2 Instances (Linux uDeploy Servers) so we allow inbound from uDeploy Security Group ID like in fig. below:

Try to connect to DB from Linux instances to check if firewall rules are correctly configured:

[ec2-user@ip-172-31-30-175 ~]$  mysql --host=database-1.ceg6tpilbyom.eu-west-2.rds.amazonaws.com --port=3306 -u admin -p
Enter password:

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 33
Server version: 5.5.5-10.2.21-MariaDB-log Source distribution

Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

Now let’s create a shared file system for Appdata uDeploy cluster directory.

Click Services > Storage > EFS and create the File System.

Specify uDeploy “Group ID” Security Group to allow Linux Instances to mount target:

Click Next until the end.

For each Linux Server execute commands below:

[ec2-user@ip-172-31-30-175 ~]$ sudo yum install -y amazon-efs-utils
[ec2-user@ip-172-31-30-175 ~]$ sudo mkdir /mnt/efs
[ec2-user@ip-172-31-30-175 ~]$ sudo vi /etc/fstab

Add to /etc/fstab:

fs-92e94e63:/ /mnt/efs efs defaults,_netdev,nofail 0 0

where fs-92e94e63 is the File System ID.

Mount the File System:

mount -a

Now, for each Linux Server, create uDeploy directories:

[ec2-user@ip-172-31-30-175 ~]$ sudo mkdir -p /opt/ibm-ucd/server
[ec2-user@ip-172-31-30-175 ~]$ sudo mkdir /mnt/efs/appdata 
[ec2-user@ip-172-31-30-175 ~]$ sudo ln -fs /mnt/efs/appdata /opt/ibm-ucd/server/appdata

sudo mkdir /mnt/efs/appdata

must be executed just once, obviously.

Create a Load Balancer:
Click on Services > EC2 > Load Balancer and select “Classic” one:

Define Load Balancer Basic Configuration:

Assign Security Group selecting “uDeploy” Security Group.

Configure Health Check like in fig. below:

Add 2 Linux Instances.

Remember to enable Load Balancer generated cookie stickiness:

Now create a Self Signer certificate for Load Balancer and upload to IAM .

Now it’s time to install uDeploy on the first Server but before starting installation, remember to:

copy mysql-connector-java-8.0.17.jar to lib/ext of uDeploy installation directory.

Install jdk1.8 and remove jdk1.7

 sudo yum install java-1.8.0
 sudo yum remove java-1.7.0-openjdk

Connect to DB instance and create User and Database:

CREATE USER 'ibm_ucd'@'localhost' IDENTIFIED BY 'password';
CREATE DATABASE ibm_ucd character set utf8 collate utf8_bin;
GRANT ALL ON ibm_ucd.* TO 'ibm_ucd'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;

Start uDeploy Server installation:

[ec2-user@ip-172-31-20-242 ibm-ucd-install]$ sudo ./install-server.sh
Enter the directory of the server to upgrade(leave blank for installing to a clean directory).
/opt/ibm-ucd/server
Enter the home directory for the JRE/JDK that the new server or already installed server uses. Default []:
/etc/alternatives/jre_openjdk
[echo] Will this server be used as a node in a high availability cluster? y,N [Default: N]
y
[echo] Where should the server store application data such as logs, plugins, and keystores? Where should the server store application data such as logs, plugins, and keystores? For every node in the HA cluster, this location must be the same, must be accessible, and must have the proper permissions. [Default: /opt/ibm-ucd/server/appdata]
[echo] What host name will users access the Web UI at? (For high availability servers, specify the host name of the load balancer, not the computer that hosts the server.) [Default: ip-172-31-20-242.eu-west-2.compute.internal]
udeploy-lb-1777079688.eu-west-2.elb.amazonaws.com
[echo] Do you want the Web UI to always use secure connections using SSL? Y,n [Default: Y]
[echo] Enter the port on which the Web UI should listen for secure HTTPS requests. [Default: 8443]
[echo] Enter the port on which the Web UI should redirect unsecured HTTP requests from. [Default: 8080]
[echo] Enter the initial password for the admin user.
[echo] Please type password again.
[echo] Enter the port to use for JMS agent communication. [Default: 7918]
[echo] Do you want the Server and Agent communication to require mutual authentication? This requires a manual key exchange between the server and each agent. See the documentation for more details. y,N [Default: N]
[echo] Enter the web agent communication URL for this server. [Default: wss://ip-172-31-20-242.eu-west-2.compute.internal:7919]
wss://ec2-35-178-181-18.eu-west-2.compute.amazonaws.com:7919
 [echo] Enter the port and hostname of a Rational License Key Server containing product licenses for UrbanCode Deploy, in the form of port@hostname. (e.g. 27000@licenses.example.com) Alternatively, you may leave this blank to begin a 60-day evaluation period. [Default: none]
[echo] Create database schema? (For high availability servers, this should only be done for the first server in the cluster) Y,n [Default: Y]
[echo] The following database types are supported for high availability installs: mysql, oracle, sqlserver, db2, db2zos.
[echo] Enter the database type to use. [Default: mysql]
[echo] Enter the database driver. [Default: com.mysql.jdbc.Driver]
 [echo] Enter the database connection string. Eg. jdbc:mysql://localhost:3306/ucd
jdbc:mysql://database-1.ceg6tpilbyom.eu-west-2.rds.amazonaws.com:3306/ibm_ucd
 [echo] Enter the database username. [Default: ucd]
ibm_ucd
 [echo] Enter the database password. [Default: password]
[echo] After starting the server, you may access the web UI by pointing your web-browser at
     [echo] https://udeploy-lb-1777079688.eu-west-2.elb.amazonaws.com:8443 to complete the Installation.
     [echo] Installer Complete. (press return to exit installer)
ibm_ucd

Start uDeploy.

[ec2-user@ip-172-31-20-242 server]$ sudo ./bin/server start

Check Load Balancer first instance status until will be: “In Service

Check Load Balancer url:

https://udeploy-lb-1777079688.eu-west-2.elb.amazonaws.com:8443/

Now it’s time to install the second uDeploy cluster instance:

The process is the same but remember:

[echo] The specified directory for application data (/opt/ibm-ucd/server/appdata) already exists and is non-empty. Do you want to use the existing data? Y,n [Default Y]
[echo] Create database schema? (For high availability servers, this should only be done for the first server in the cluster) Y,n [Default: Y]
N

Start the second uDeploy instance.

Check the Load Balancer Instances status unti both will be “In Service”.

Now, click Settings > Network > Add Server To Server Cluster. The “Connect Server To Server Cluster” dialog box is displayed.
Enter a name for the cluster connection.
In the Host field, enter the host name or IP address of the target server.
In the Port field, enter the JMS communication port of the target server (port 7918).
Select the Active check box.
Click Save.
On the same server, repeat the process to create a connection to each server in the cluster, including a connection that points to the current server itself.
Restart the targeted servers. If create the cluster connections on server A, for example, restart servers B to ensure that they can communicate with one another.

Stop the first server and check high availability of your configuration.

Backstage:

Have a nice day!

Operations Engineer working with Cloud Infrastructure, Containers, Kubernetes, CI/CD pipelines, CDRA processes, GitOps.