Introduction

With its Cloud and server offerings, Atlassian is world famous for making their software easy to stand up, letting you get productive fast. The ease of getting Jira up and running has resulted in many of the 100K+ teams around the world who use Jira to collaborate. At least half of the work we do here at Isos is helping organizations who at first planted their own Jira seedlings in their infrastructure, and then Isos helps them ‘transplant’ those instances into more enterprise ready configurations. Again, for people just starting out, setting up a test instance of Jira Server can be completed in a few short hours.

However, if you want to evaluate or test Jira using Oracle as a database backend.. well that process is not so much fun. Many of our enterprise customers who run Oracle as their database and my fellow Isos consultants have inquired to me, “how can we cut down the time it takes to create a Jira + Oracle sandbox?”  I’m happy to announce that thanks to Docker, there is now a better, faster way!

What do you need to get going?

The list of prerequisites you need to complete this task:

  • Docker or Docker CE for Mac, Windows or Linux: https://www.docker.com/get-started
  • A Docker Hub account (I believe this is now required to download Docker for Mac or Windows)
  • docker-compose – This comes with Docker for Windows / Mac but you’ll need to install this specifically for Linux.
  • 50 GB of free disk space
  • Microsoft Visual Code – It is just great, install it!

Let get going cloning!

  1. Clone the simple repository that backs this project and cd into the directory it creates:

    # git clone git@bitbucket.org:cowmixtoo/jira-oracle-docer.git
    # cd jira-oracle-docker
  2. Rename the docker-compose file

    # mv docker-compose.yml.oracle docker-compose.yml
  3. Get the Oracle jdbc driver (there’s not automated way to do this!)

http://download.oracle.com/otn/utilities_drivers/jdbc/121010/ojdbc7.jar

Make sure it is called ojdbc7.jar and move into the ‘jira’ subdirectory.

Compose file – breaking it down.

Oracle section

version: '2'
services:
  oracle:
    image: sath89/oracle-12c
    container_name: oracle
    #restart: unless-stopped
    ports:
      - 8080:8080
      - 1521:1521
    volumes:
      - oracle-data:/u01/app/oracle
  1. sath89/oracle-12c – This is a popular Docker container that contains Oracle 12c
  2. ports entry: 8080 is the Oracle web management interface and 1521 is the Oracle SQL port.
  3. volumes: oracle-data is the data volume Oracle data will persist to.

Jira section

jira-oracle:
  build: ./jira
  container_name: jira-oracle
  depends_on:
    - oracle
  command: >
    /bin/bash -c "
      sleep 10;
      /opt/atlassian/jira/bin/catalina.sh run;
    "
  volumes:
    - jira-oracle-data:/var/atlassian/jira
    - jira-oracle-logs:/opt/atlassian/jira/logs
  environment:
    - CATALINA_OPTS=-Xms2024m -Xmx2048m -Datlassian.plugins.enable.wait=150
  ports:
    - "9080:8080"
  1. build – We are going to rebuild / add to a popular Jira Docker container
  2. depends_on: this tells docker-compose this container depends on Oracle
  3. command: This is custom command we use to start the Jira container. It adds a delay to allow Oracle time to start.
  4. Volumes: These are the persistent data stores Jira data and logs are stored.
  5. environment: We allow plenty of memory for Jira and allow time for addons to start.
  6. port: You’ll access Jira from port 9080 instead of the default 8080.

Jira Docker file – breaking it down.

FROM cptactionhank/atlassian-jira

We start with a great Jira implementation in Docker. We are assuming the latest version of Jira here.

COPY ojdbc7.jar /opt/atlassian/jira/lib
ADD https://repo1.maven.org/maven2/com/microsoft/sqlserver/mssql-jdbc/7.0.0.jre8/mssql-jdbc-7.0.0.jre8.jar /opt/atlassian/jira/lib

This is moving the JDBC driver you downloaded into place in the Jira Docker container. We are also grabbing the latest SQL Server JDBC driver for kicks too.


ARG SQLLINE_VERSION="1.5.0"
ARG SLF4J_VERSION="1.7.22"
USER root
RUN mkdir -p /opt/atlassian/jira/sqlline/target && ln -s /opt/atlassian/jira/lib/mssql-jdbc-7.0.0.jre8.jar /opt/atlassian/jira/sqlline/target/ && ln -s /opt/atlassian/jira/lib/ojdbc7.jar /opt/atlassian/jira/sqlline/target/ && mkdir -p /sbin/.sqlline && chmod -R a+rwx /sbin/.sqlline && chmod a+r /opt/atlassian/jira/lib/mssql-jdbc-7.0.0.jre8.jar
ADD https://repo1.maven.org/maven2/sqlline/sqlline/${SQLLINE_VERSION}/sqlline-${SQLLINE_VERSION}-jar-with-dependencies.jar /opt/atlassian/jira/sqlline/target/
ADD https://repo1.maven.org/maven2/org/slf4j/slf4j-simple/${SLF4J_VERSION}/slf4j-simple-${SLF4J_VERSION}.jar /opt/atlassian/jira/sqlline/target/
ADD https://repo1.maven.org/maven2/org/slf4j/slf4j-api/${SLF4J_VERSION}/slf4j-api-${SLF4J_VERSION}.jar /opt/atlassian/jira/sqlline/target/
ADD https://raw.githubusercontent.com/julianhyde/sqlline/master/bin/sqlline /opt/atlassian/jira/sqlline/bin/
RUN chmod a+x /opt/atlassian/jira/sqlline/bin/sqlline

RUN chown -R daemon:daemon /opt/atlassian/jira/sqlline

Many times when using Jira, you might need to make SQL queries against your databases for debugging or other purposes. However, more times than not a Jira server will not have the require database client libraries to make such queries. When using Oracle, the problem tends to be much worse. The Oracle client library suite is pretty heavy weight and I have yet to see a Jira installation where it was installed along side of Jira Server.

In the above code block, we are installing a Java SQL client called sqlline. sqlline will allow you to make SQL queries against all four databases Jira supports with installing additions software. For 99.9% of your SQL needs, sqlline should cover you.

Fire it up!

# docker-compose up

After you issue the above command, you should see Oralce and Jira booting in a console.

Next, you’ll need to get into the Jira container to create the Jira database:


➜ ~ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
2d7294f57bc7 jira-oracle-docker_jira-oracle "/docker-entrypoint.…" 2 minutes ago Up 2 minutes 0.0.0.0:9080->8080/tcp jira-oracle
234020a6b992 sath89/oracle-12c "/entrypoint.sh " 2 minutes ago Up 2 minutes 0.0.0.0:1521->1521/tcp, 0.0.0.0:8080->8080/tcp oracle

Then ‘exec’ into the Jira container:

➜ ~ docker exec -it jira-oracle bash

Next, you need to connect the Oralce database:


# cd /opt/atlassian/jira/sqlline/bin/
# ./sqlline -d oracle.jdbc.driver.OracleDriver -u jdbc:oracle:thin:@oracle:1521:xe -n system -p oracle

Finally, you need to seed the Oralce database:


create tablespace jiradb datafile '/u01/app/oracle/oradata/xe/oracleizbad.dbf' size 400M;

create user jira identified by jirapass default tablespace users quota unlimited on users;

grant connect to jira;

grant resource to jira;

grant create table to jira;

grant create sequence to jira;

grant create trigger to jira;

Configure Jira – that is!

Wrapping up is easy.. Just point your browser to [ip address]:9080 and you can configure Jira like normal!

If you have any questions please ask below or contact me on Bitbucket.org.

Thanks!