Skip to content

Commit

Permalink
Updated default max heap to 4GB,
Browse files Browse the repository at this point in the history
Updated README
Changed tomcat image to tomcat:7.0.108-jdk8-openjdk-buster due to no upstream support for tomcat:7-jre8-alpine
  • Loading branch information
kelseym committed Mar 5, 2021
1 parent 6c6b636 commit 2becaf6
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
XNAT_VER=1.8.0
XNAT_MIN_HEAP=256m
XNAT_MAX_HEAP=2g
XNAT_MAX_HEAP=4g
SMTP_ENABLED=false
SMTP_HOSTNAME=fake.fake
SMTP_PORT=
Expand Down
51 changes: 50 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
# Dockerized XNAT
Use this repository to quickly deploy an [XNAT](https://xnat.org/) instance on [docker](https://www.docker.com/).


See the [features/dependency-mgmt](https://github.com/NrgXnat/xnat-docker-compose/tree/features/dependency-mgmt) branch for advanced gradle-based version and plugin management.


This document contains the following sections:

* [Introduction](#markdown-header-introduction)
* [Prerequisites](#markdown-header-prerequisites)
* [Usage](#markdown-header-usage)
* [Environment variables](#markdown-header-environment-variables)
* [Mounted Data](#markdown-header-mounted-data)
* [Troubleshooting](#markdown-header-troubleshooting)
* [Notes on using the Container Service](#markdown-header-notes-on-using-the-container-service)

## Introduction

This repository contains files to bootstrap XNAT deployment. The build creates three containers:
Expand All @@ -11,7 +25,7 @@ This repository contains files to bootstrap XNAT deployment. The build creates t

## Prerequisites

* [docker](https://www.docker.com/)
* [docker](https://www.docker.com/) including sufficient memory allocation, according to [Max Heap](#mardown-header-xnat-configuration) settings and container usage. (>4GB with default settings)
* [docker-compose](http://docs.docker.com/compose) (Which is installed along with docker if you download it from their site)

## Usage
Expand Down Expand Up @@ -83,6 +97,41 @@ When you bring up XNAT with `docker-compose up`, several directories are created
* **xnat-data/build** - Contains the XNAT build space. This is useful when running the container service plugin.
* **xnat-data/home/logs** - Contains the XNAT logs.

## Environment variables

To support differing deployment requirements, `xnat-docker-compose` uses variables for settings that tend to change based on environment. By
default, `docker-compose` takes the values for variables from the [file `.env`](https://docs.docker.com/compose/environment-variables/). Advanced configurations will need to use a customized `.env` file.

To create your own `.env` file, it's best to just copy the existing `.env` and modify the values in there.

### XNAT configuration

These variables directly set options for XNAT itself.

Variable | Description | Default value
-------- | ----------- | -------------
XNAT_VERSION | Indicates the version of XNAT to install. | 1.8.0
XNAT_MIN_HEAP | Indicates the minimum heap size for the Java virtual machine. | 256m
XNAT_MAX_HEAP | Indicates the minimum heap size for the Java virtual machine. | 4g
XNAT_SMTP_ENABLED | Indicates whether SMTP operations are enabled in XNAT. | false
XNAT_SMTP_HOSTNAME | Sets the address for the server to use for SMTP operations. Has no effect if **XNAT_SMTP_ENABLED** is false. |
XNAT_SMTP_PORT | Sets the port for the server to use for SMTP operations. Has no effect if **XNAT_SMTP_ENABLED** is false. |
XNAT_SMTP_AUTH | Indicates whether the configured SMTP server requires authentication. Has no effect if **XNAT_SMTP_ENABLED** is false. |
XNAT_SMTP_USERNAME | Indicates the username to use to authenticate with the configured SMTP server. Has no effect if **XNAT_SMTP_ENABLED** or **XNAT_SMTP_AUTH** are false. |
XNAT_SMTP_PASSWORD | Indicates the password to use to authenticate with the configured SMTP server. Has no effect if **XNAT_SMTP_ENABLED** or **XNAT_SMTP_AUTH** are false. |
XNAT_DATASOURCE_ADMIN_PASSWORD | Indicates the password to set for the database administrator user (**postgres**) | xnat1234
XNAT_DATASOURCE_URL | Specifies the URL to use when accessing the database from XNAT. | jdbc:postgresql://xnat-db/xnat
XNAT_DATASOURCE_DRIVER | Specifies the driver class to set for the database connection. | org.postgresql.Driver
XNAT_DATASOURCE_USERNAME | Specifies the username for the XNAT database account. | xnat
XNAT_DATASOURCE_PASSWORD | Specifies the password for the XNAT database account. | xnat
XNAT_WEBAPP_FOLDER | Indicates the name of the folder for the XNAT application. This affects the context path for accessing XNAT. The value `ROOT` indicates that XNAT is the root application and can be accessed at http://localhost (i.e. no path). Otherwise, you must add this value to the _end_ of the URL so, e.g. if you specify `xnat` for this variable, you'll access XNAT at http://localhost/xnat. | ROOT
XNAT_ROOT | Indicates the location of the root XNAT folder on the XNAT container. | /data/xnat
XNAT_HOME | Indicates the location of the XNAT user's home folder on the XNAT container. | /data/xnat/home
XNAT_EMAIL | Specifies the primary administrator email address. | harmitage@miskatonic.edu
XNAT_ACTIVEMQ_URL | Indicates the URL for an external ActiveMQ service to use for messaging. If not specified, XNAT uses its own internal queue. |
XNAT_ACTIVEMQ_USERNAME | Indicates the username to use to authenticate with the configured ActiveMQ server. Has no effect if **XNAT_ACTIVEMQ_URL** isn't specified. |
XNAT_ACTIVEMQ_PASSWORD | Indicates the password to use to authenticate with the configured ActiveMQ server. Has no effect if **XNAT_ACTIVEMQ_URL** isn't specified. |


## Troubleshooting

Expand Down
8 changes: 3 additions & 5 deletions xnat/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM tomcat:7-jre8-alpine
FROM tomcat:7.0.108-jdk8-openjdk-buster
MAINTAINER Matt Kelsey <kelseym@wustl.edu>

ARG XNAT_VER=${XNAT_VER}
Expand All @@ -16,7 +16,7 @@ ARG TOMCAT_XNAT_FOLDER_PATH=${CATALINA_HOME}/webapps/${TOMCAT_XNAT_FOLDER}
ADD make-xnat-config.sh /usr/local/bin/make-xnat-config.sh
ADD wait-for-postgres.sh /usr/local/bin/wait-for-postgres.sh

RUN apk add --no-cache postgresql-client wget
RUN apt-get update && apt-get install -y postgresql-client wget
RUN rm -rf ${CATALINA_HOME}/webapps/*
RUN mkdir -p \
${TOMCAT_XNAT_FOLDER_PATH} \
Expand All @@ -32,11 +32,9 @@ RUN mkdir -p \
${XNAT_ROOT}/prearchive
RUN /usr/local/bin/make-xnat-config.sh
RUN rm /usr/local/bin/make-xnat-config.sh
#RUN wget --no-verbose --output-document=/tmp/xnat-web-${XNAT_VER}.war https://api.bitbucket.org/2.0/repositories/xnatdev/xnat-web/downloads/xnat-web-${XNAT_VER}.war
RUN wget --no-verbose --output-document=/tmp/xnat-web-${XNAT_VER}.war https://ci.xnat.org/job/XNAT%20Web/lastSuccessfulBuild/artifact/build/libs/xnat-web-1.8.0.war
RUN wget --no-verbose --output-document=/tmp/xnat-web-${XNAT_VER}.war https://api.bitbucket.org/2.0/repositories/xnatdev/xnat-web/downloads/xnat-web-${XNAT_VER}.war
RUN unzip -o -d ${TOMCAT_XNAT_FOLDER_PATH} /tmp/xnat-web-${XNAT_VER}.war
RUN rm -f /tmp/xnat-web-${XNAT_VER}.war
RUN apk del wget

EXPOSE 8080

Expand Down
12 changes: 0 additions & 12 deletions xnat/make-xnat-config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,5 @@ adminEmail=${XNAT_EMAIL}
EOF
fi

if [ "${XNAT_SMTP_ENABLED}" == "true" ]; then
cat >> ${XNAT_HOME}/config/prefs-init.ini << EOF
[notifications]
smtpEnabled=true
smtpHostname=${XNAT_SMTP_HOSTNAME}
smtpPort=${XNAT_SMTP_PORT}
smtpUsername=${XNAT_SMTP_USERNAME}
smtpPassword=${XNAT_SMTP_PASSWORD}
smtpAuth=${XNAT_SMTP_AUTH}
EOF
fi



2 comments on commit 2becaf6

@ilka-schulz
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There actually is an image tomcat:7-jre8-alpine and also tomcat:9-jre8-alpine. Also, they are smaller than the Debian-based images by manifolds. Is there a specific reason why you would not use them anymore? We are currently using the Alpine-based images at one of our projects and it works well. Also, the immense memory saving actually makes a real difference for our build server.

@rherrick
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As indicated in the commit message, the primary issue with those images is that they haven't been updated in a couple years (i.e. "no upstream support"), as you can see here for 9-jre8-alpine. I don't know why they stopped building (or at least pushing) them, but we need to use something that's more up to date in terms of security and performance updates in both Java environment and Tomcat. It looks as if none of the x-jre8-y images are being updated either, so it's possible that a fair amount of the size overhead between those images is due to JRE vs JDK.

Please sign in to comment.