User Tools

Site Tools


wiki:install_2_node_jira_datacenter_docker_behind_apache_reverse_proxy

Install 2 node Jira Datacenter in Docker behind apache reverse proxy

This assumes you already have a mysql container running with a created database for jira on the same docker network, for example at ip 172.20.20.2.

If not create that container and the docker network.

Install first node

docker run --network=atl --ip=172.20.20.5 -e JVM_SUPPORT_RECOMMENDED_ARGS=-DjvmRoute=node1 -e CLUSTERED=true -e JIRA_NODE_ID=node1 -e ATL_PROXY_NAME=jiratestdc.example.com -e ATL_PROXY_PORT=443 -e ATL_TOMCAT_SCHEME=https -v jiradc1:/var/atlassian/application-data/jira -v jiradcshared:/var/atlassian/application-data/jira/shared/ --name="jiradc1" -d -p 8585:8080 atlassian/jira-software

Explanation:

-e JVM_SUPPORT_RECOMMENDED_ARGS=-DjvmRoute=node1

This is required so that JVM is aware of the node used. Replace “node1” with whatever is set as BalancerMember in load balancer configuration.

-e JIRA_NODE_ID=node1

This sets the node name in jira home directory cluster.properties file. Should be same as in LB.

-v jiradcshared:/var/atlassian/application-data/jira/shared/

In addition to volume for jira home we need a shared folder that will be used by the nodes.

Don't forget to copy mysql connector and restart the container

docker cp mysql-connector-java-8.0.20.jar jiradc1:/opt/atlassian/jira/lib/
docker restart jiradc1

Add node to load balancer

Enable the required modules:

a2enmod proxy
a2enmod lbmethod_byrequests

Edit vhost file to match this:

<VirtualHost *:80>
    ProxyRequests off
    ServerName jiratestdc.example.com
    ServerAdmin webmaster@localhost
 
<Proxy balancer://jiracluster>
    # JIRA node 1
    BalancerMember http://localhost:8585 route=node1
    # JIRA node 2
    BalancerMember http://localhost:8686 route=node2
 
    # Security "we aren't blocking anyone but this the place to make those changes
    Order Deny,Allow
    Deny from none
    Allow from all
 
    # Load Balancer Settings
    ProxySet lbmethod=byrequests
    ProxySet stickysession=JSESSIONID
</Proxy>
    # Here's how to enable the load balancer's management UI if desired
<Location /balancer-manager>
    SetHandler balancer-manager
 
    # You SHOULD CHANGE THIS to only allow trusted ips to use the manager
    Order deny,allow
    Deny from all
    #Allow from all
    Allow from <youripaddress>
</Location>
 
    # Don't reverse-proxy requests to the management UI
    ProxyPass /balancer-manager !
    # Reverse proxy all other requests to the JIRA cluster
    ProxyPass / balancer://jiracluster/
    ProxyPreserveHost on
 
    SSLProxyEngine          On
 
    ErrorLog ${APACHE_LOG_DIR}/jiratestdc-error.log
    CustomLog ${APACHE_LOG_DIR}/jiratestdc-access.log combined
 
    # SSL rewrite
    RewriteEngine on
    RewriteCond %{SERVER_NAME} =jiratestdc.example.com
    RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]

The same configuration should be in ssl vhost configuration as well.

Reload apache2 and run through the setup of the node.

Add a new Jira node to the cluster

Copy the Jira installation directory to a new host. This is easily done by making a docker image from the first node.

docker commit CONTAINER ID jiradc

We will use jiradc to spin up a new node.

Create new container

docker run --network=atl --ip=172.20.20.6 -e JVM_SUPPORT_RECOMMENDED_ARGS=-DjvmRoute=node2 -e ATL_PROXY_NAME=jiratestdc.example.com -e ATL_PROXY_PORT=443 -e ATL_TOMCAT_SCHEME=https -v jiradc2:/var/atlassian/application-data/jira -v jiradcshared:/var/atlassian/application-data/jira/shared/ --name="jiradc2" -d -p 8686:8080 jiradc

Copy home data from node1 and change permissions:

cp -R atlassian-jira.log caches cluster.properties customisations customisations-backup dbconfig.xml .java .jira-home.lock log monitor plugins __pycache__ tmp ../../jiradc2/_data/

chown -R 2001:2001 ../../jiradc2/_data/

Change the cluster.properties line to jira.node.id=node2 for the second node and restart second docker node.

Test

Go to the configured url and hit refresh couple of times. You should see the node names change on bottom of page

Once you're logged in, the Session cookie JSESSIONID will be set (Developer console > Storage) with the name of the node e.g. JSESSIONID:“F24EF7DBDB6AF41DD6930A0CA947E4CF.node2”

Tested on

  • Atlassian Jira Project Management Software (v8.8.1#808001)
  • Docker 18.09.1
  • Debian 10.8

See also

References

wiki/install_2_node_jira_datacenter_docker_behind_apache_reverse_proxy.txt · Last modified: 2022/07/12 14:53 by antisa

Except where otherwise noted, content on this wiki is licensed under the following license: CC0 1.0 Universal
CC0 1.0 Universal Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki