AWS – Deploy Jira Datacenter

Posted by

Before you install JIRA Data Center, review this prerequisite information at Atlassian document guide. In this blog I just want to show you the steps how to setup JIRA data center in AWS.

There are 4 main steps

  • Setup efs in AWS which is used for shared-home
  • Setup database server
  • Setup Jira node in ec2
  • Setup load-blancer

At first. You need to login AWS

Setup EFS

https://us-west-1.console.aws.amazon.com/efs/home?region=us-west-1#/filesystems

Notes : You need to note down security groups that you had chosen for this efs

Setup database server

Notes : You can use RDS but this blog I instance DB server in Jira node 1.

Go to e2c https://us-west-1.console.aws.amazon.com/ec2/v2/home?region=us-west-1 . And the create one and waiting it is ready

sudo -i -u postgres
psql
create database jira;

Now you have database server for your Jira.

Setup Jira node 1

Mount EFS file server. Remember that we have already setup the EFS at step 1. So go back the efs section in AWS and click on “Amazon E2C mount ….”

sudo yum install -y amazon-efs-utils
mkdir /opt/efs
cd /opt
sudo mount -t efs fs-bb59dea2:/ efs

Install JDK

sudo su
curl --location --junk-session-cookies --insecure --output /tmp/jdk-8u131-linux-x64.rpm \
      --header 'Cookie: gpw_e24=http://www.oracle.com/; oraclelicense=accept-securebackup-cookie' \
      http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.rpm && \
    yum localinstall -y /tmp/jdk-8u131-linux-x64.rpm && \
    yum clean all && \
    rm -f /tmp/jdk-8u131-linux-x64.rpm

Download and setup Jira binary

cd /opt
export JIRA_HOME="/opt/efs/jira-node1-home"
export JIRA_RELEASE="7.10.0"
mkdir -p ${JIRA_HOME}
curl --location https://www.atlassian.com/software/jira/downloads/binary/atlassian-jira-software-${JIRA_RELEASE}.tar.gz -o /opt/efs/atlassian-jira-software-${JIRA_RELEASE}.tar.gz

tar -xvf /opt/efs/atlassian-jira-software-${JIRA_RELEASE}.tar.gz -C /opt

Update Jira home for node-1

sudo vi /opt/atlassian-jira-software-7.10.0-standalone/atlassian-jira/WEB-INF/classes/jira-application.properties

jira.home = /opt/efs/jira-node1-home

Start node 1

/opt/atlassian-jira-software-7.10.0-standalone/bin/catalina.sh start

Access node 1 by using ec2 publish dns

e.g :  ec2-54-219-137-163.us-west-1.compute.amazonaws.com:8080

Enter DB server that we already setup above

Now you are getting the connection error because your DB server is not remote enable yet.

sudo vi /var/lib/pgsql/data/postgresql.conf
#append or update
listen_addresses='*' # be careful with this which means everyone can access your DB server.
sudo systemctl start postgresql

Remember , you need to setup Data center license for this Jira node. see more about it at https://www.atlassian.com/licensing/data-center

Setup Jira shared-home and enable clustering for node 1

#stop node 1
/opt/atlassian-jira-software-7.10.0-standalone/bin/catalina.sh stop
# create shared-home
mkdir /opt/efs/shared-home
# copy jira-node1-home to shared-home
cp -R /opt/efs/jira-node1-home/{data,plugins,logos,import,export,caches} /opt/efs/shared-home
cd /opt/efs/jira-node1-home
>cluster.properties

modify cluster.properties content as below

# This ID must be unique across the cluster
jira.node.id = node1
# The location of the shared home directory for all JIRA nodes
jira.shared.home = /opt/efs/shared-home

Start node 1

/opt/atlassian-jira-software-7.10.0-standalone/bin/catalina.sh start

Now your Jira is running with Datacenter but only 1 node. So let start node 2

Setup Jira node 2

#connect to node 2 ec2
ssh -i "jsoft.pem" ec2-user@ec2-54-183-204-121.us-west-1.compute.amazonaws.com
sudo yum install -y amazon-efs-utils
mkdir /opt/efs
cd /opt
sudo mount -t efs fs-bb59dea2:/ efs

Install JDK

sudo su
curl --location --junk-session-cookies --insecure --output /tmp/jdk-8u131-linux-x64.rpm \
      --header 'Cookie: gpw_e24=http://www.oracle.com/; oraclelicense=accept-securebackup-cookie' \
      http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.rpm && \
    yum localinstall -y /tmp/jdk-8u131-linux-x64.rpm && \
    yum clean all && \
    rm -f /tmp/jdk-8u131-linux-x64.rpm

You will see the shared-home and jira binary in efs folder as below

[root@ip-172-31-10-38 efs]# ls -lt
total 281748
drwxr-xr-x 10 root root      6144 Jun 20 00:46 shared-home
drwxr-xr-x 12 root root      6144 Jun 20 00:44 jira-node1-home
-rw-r--r--  1 root root 288500174 Jun 19 02:27 atlassian-jira-software-7.10.0.tar.gz

Extract Jira binary to /opt

tar -xvf atlassian-jira-software-7.10.0.tar.gz -C /opt

Update Jira home for node 2 with value “/opt/efs/jira-node2-home”

mkdir -p /opt/efs/jira-node2-home
vi atlassian-jira-software-7.10.0-standalone/atlassian-jira/WEB-INF/classes/jira-application.properties
cd /opt/efs/jira-node1-home
cp cluster.properties  dbconfig.xml /opt/efs/jira-node2-home

Start node 2

atlassian-jira-software-7.10.0-standalone/bin/catalina.sh start

Now you access Jira node 2 via public dns. e.g : http://ec2-54-183-204-121.us-west-1.compute.amazonaws.com:8080

So you have 2 Jira nodes. If you want more just repeat the step2 for Jira node 2

And the question is how the Jira users only one endpoint. By resolving that we use LoadBalancers in AWS

Setup LoadBalancers

Login AWS

https://us-west-1.console.aws.amazon.com/ec2/v2/home?region=us-west-1#TargetGroups:sort=targetGroupName

Click on Edit button

Now you can use LoadBalancer URL instead of node url

e.g : http://jira-cluster-1917291435.us-west-1.elb.amazonaws.com:8080/secure/Dashboard.jspa

Now you can see 2 Jira nodes under : Systems –> System Info in Jira

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.