Hello!
In my previous article I showed how to create your own docker image with Atlassian Jira Data Center for M1 processors. But it is not enough for development of apps. We need to start 2 nodes and each node should be available for connecting in debug mode. I intended to modify my Dockerfile but then I found this repo which says that it can create an image of Jira Data Center for M1 processors. I tried it but it did not work for me. I made a couple of changes.
First of all I changed the base image in Dockerfile to
ARG BASE_IMAGE=arm64v8/adoptopenjdk:11.0.11_9-jdk-hotspot
And the file started to look like this
ARG BASE_IMAGE=arm64v8/adoptopenjdk:11.0.11_9-jdk-hotspot
FROM $BASE_IMAGE
ENV RUN_USER jira
ENV RUN_GROUP jira
ENV RUN_UID 2001
ENV RUN_GID 2001
# https://confluence.atlassian.com/display/JSERVERM/Important+directories+and+files
ENV JIRA_HOME /var/atlassian/application-data/jira
ENV JIRA_INSTALL_DIR /opt/atlassian/jira
WORKDIR $JIRA_HOME
EXPOSE 8080
CMD ["/entrypoint.py"]
ENTRYPOINT ["/tini", "--"]
RUN apt-get update && apt-get upgrade -y \
&& apt-get install -y --no-install-recommends fontconfig python3 python3-jinja2 \
&& apt-get clean autoclean && apt-get autoremove -y && rm -rf /var/lib/apt/lists/*
ARG TINI_VERSION=v0.19.0
RUN arch=$(dpkg --print-architecture); \
case "$arch" in \
arm64) export ARCH="-arm64" ;; \
*) export ARCH="" ;; \
esac; \
url="https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini${ARCH}" ; \
curl "$url" -Lo /tini ; \
chmod +x /tini
ARG MYSQL_DRIVER_VERSION=5.1.49
RUN export JIRA_LIB=$JIRA_INSTALL_DIR/lib \
&& mkdir -p $JIRA_LIB \
&& export MYSQL_FILE_BASE=mysql-connector-java-$MYSQL_DRIVER_VERSION \
&& export MYSQL_FILE_TAR=$MYSQL_FILE_BASE.tar.gz \
&& export MYSQL_FILE_BIN=$MYSQL_FILE_BASE-bin.jar \
&& export MYSQL_DOWNLOAD_URL=https://dev.mysql.com/get/Downloads/Connector-J/$MYSQL_FILE_TAR \
&& rm -f $JIRA_LIB/mysql-connector-java*.jar \
&& curl $MYSQL_DOWNLOAD_URL -Lo $MYSQL_FILE_TAR \
&& tar xzf $MYSQL_FILE_TAR --strip=1 \
&& cp $MYSQL_FILE_BIN $JIRA_LIB/$MYSQL_FILE_BIN
ARG JIRA_VERSION
# The link may change from version to version, check
# https://www.atlassian.com/ru/software/jira/download-archives
ARG DOWNLOAD_URL=https://product-downloads.atlassian.com/software/jira/downloads/atlassian-jira-software-${JIRA_VERSION}.tar.gz
RUN groupadd --gid ${RUN_GID} ${RUN_GROUP} \
&& useradd --uid ${RUN_UID} --gid ${RUN_GID} --home-dir ${JIRA_HOME} --shell /bin/bash ${RUN_USER} \
&& echo PATH=$PATH > /etc/environment \
\
&& mkdir -p ${JIRA_INSTALL_DIR} \
&& curl -L --silent ${DOWNLOAD_URL} | tar -xz --strip-components=1 -C "${JIRA_INSTALL_DIR}" \
&& chmod -R "u=rwX,g=rX,o=rX" ${JIRA_INSTALL_DIR}/ \
&& chown -R root. ${JIRA_INSTALL_DIR}/ \
&& chown -R ${RUN_USER}:${RUN_GROUP} ${JIRA_INSTALL_DIR}/logs \
&& chown -R ${RUN_USER}:${RUN_GROUP} ${JIRA_INSTALL_DIR}/temp \
&& chown -R ${RUN_USER}:${RUN_GROUP} ${JIRA_INSTALL_DIR}/work \
\
&& sed -i -e 's/^JVM_SUPPORT_RECOMMENDED_ARGS=""$/: \${JVM_SUPPORT_RECOMMENDED_ARGS:=""}/g' ${JIRA_INSTALL_DIR}/bin/setenv.sh \
&& sed -i -e 's/^JVM_\(.*\)_MEMORY="\(.*\)"$/: \${JVM_\1_MEMORY:=\2}/g' ${JIRA_INSTALL_DIR}/bin/setenv.sh \
&& sed -i -e 's/-XX:ReservedCodeCacheSize=\([0-9]\+[kmg]\)/-XX:ReservedCodeCacheSize=${JVM_RESERVED_CODE_CACHE_SIZE:=\1}/g' ${JIRA_INSTALL_DIR}/bin/setenv.sh \
\
&& touch /etc/container_id \
&& chown ${RUN_USER}:${RUN_GROUP} /etc/container_id \
&& chown -R ${RUN_USER}:${RUN_GROUP} ${JIRA_HOME}
# Must be declared after setting perms
VOLUME ["${JIRA_HOME}"]
COPY components/entrypoint/ /
COPY components/support/ /opt/atlassian/support
COPY components/config/ /opt/atlassian/etc/
Then I modified a bit the build-image.sh file
#!/bin/zsh
set -x -o errexit -o pipefail
REPO="arm64/jira-software"
JIRA_VERSION="9.2.0"
MYSQL_DRIVER_VERSION="5.1.49"
# tini is a small helper library for Docker containers https://github.com/krallin/tini
# It makes sense to update.
TINI_VERSION="v0.19.0"
docker build \
--no-cache \
-t "$REPO:$JIRA_VERSION-arm64" \
--build-arg JIRA_VERSION="$JIRA_VERSION" \
--build-arg MYSQL_DRIVER_VERSION="$MYSQL_DRIVER_VERSION" \
--build-arg TINI_VERSION="$TINI_VERSION" \
.
And after it I ran ./build-image.sh
After the image had been created, I ran the following docker-compose.yml file
version: '3'
services:
jira_node_1:
depends_on:
- postgresql
image: arm64/jira-software:9.2.0-arm64
networks:
- jiranet
volumes:
- /Users/alexm/projects/prometheus/jira/shared:/var/atlassian/application-data/jira/shared
ports:
- '8080:8080'
- '8000:8000'
environment:
- 'ATL_JDBC_URL=jdbc:postgresql://postgresql:5432/jiradb'
- 'ATL_JDBC_USER=jira'
- 'ATL_JDBC_PASSWORD=jellyfish'
- 'ATL_DB_DRIVER=org.postgresql.Driver'
- 'ATL_DB_TYPE=postgres72'
- 'JVM_MINIMUM_MEMORY=2048m'
- 'JVM_MAXIMUM_MEMORY=4096m'
- 'JVM_SUPPORT_RECOMMENDED_ARGS="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:8000"'
- 'CLUSTERED=true'
- 'JIRA_NODE_ID=node_1'
logging:
# limit logs retained on host to 25MB
driver: "json-file"
options:
max-size: "500k"
max-file: "50"
jira_node_2:
depends_on:
- postgresql
image: arm64/jira-software:9.2.0-arm64
networks:
- jiranet
volumes:
- /Users/alexm/projects/prometheus/shared:/var/atlassian/application-data/jira/shared
ports:
- '8081:8080'
- '8001:8000'
environment:
- 'ATL_JDBC_URL=jdbc:postgresql://postgresql:5432/jiradb'
- 'ATL_JDBC_USER=jira'
- 'ATL_JDBC_PASSWORD=jellyfish'
- 'ATL_DB_DRIVER=org.postgresql.Driver'
- 'ATL_DB_TYPE=postgres72'
- 'JVM_MINIMUM_MEMORY=2048m'
- 'JVM_MAXIMUM_MEMORY=4096m'
- 'JVM_SUPPORT_RECOMMENDED_ARGS="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:8000"'
- 'CLUSTERED=true'
- 'JIRA_NODE_ID=node_2'
logging:
# limit logs retained on host to 25MB
driver: "json-file"
options:
max-size: "500k"
max-file: "50"
postgresql:
image: postgres:9.5-alpine
networks:
- jiranet
volumes:
- postgresqldata:/var/lib/postgresql/data
ports:
- '5432:5432'
environment:
- 'POSTGRES_USER=jira'
# CHANGE THE PASSWORD!
- 'POSTGRES_PASSWORD=jellyfish'
- 'POSTGRES_DB=jiradb'
- 'POSTGRES_ENCODING=UNICODE'
- 'POSTGRES_COLLATE=C'
- 'POSTGRES_COLLATE_TYPE=C'
logging:
# limit logs retained on host to 25MB
driver: "json-file"
options:
max-size: "500k"
max-file: "50"
volumes:
postgresqldata:
external: false
networks:
jiranet:
driver: bridge
And as a result I had 2 nodes of Jira Software in debug mode. You can read more about this docker-compose.yml file in my previous article.
Alexey Matveev
software developer
MagicButtonLabs
Philippines
1,575 accepted answers
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
0 comments