Help with test setup for testing container pipelines

48 views
Skip to first unread message

tom.g...@gmail.com

unread,
Nov 5, 2021, 9:15:30 PM11/5/21
to xnat_discussion
Hi,

I have installed of XNAT + postgres inside a single Docker image to run unittests for some container service pipelines I am developing. I mount in the local docker socket to use for the container service with

docker run -p 80:80 -v /var/run/docker.sock:/var/run/docker.sock tclose/test-xnat

but I keep getting a failure on launch

Did not start.Could not start container cefeea27ee812f8c1a80bb3faf2fc6fb9df06311d8b09d433d1957ce4a5e6b7b: Request error: POST unix://localhost:80/containers/cefeea27ee812f8c1a80bb3faf2fc6fb9df06311d8b09d433d1957ce4a5e6b7b/start: 500

and can't work out why. If anyone is interested in taking a look you can access a snapshot of the XNAT Docker container on Docker Hub at

tclose/test-xnat

and pull the container pipeline I'm trying to test at

tclose/arcana-concatenate-test

Thanks!

tom.g...@gmail.com

unread,
Nov 7, 2021, 7:39:58 PM11/7/21
to xnat_discussion
Am I right in thinking that this is a problem with my XNAT setup, or could it be an issue with my container pipeline?

tom.g...@gmail.com

unread,
Nov 8, 2021, 8:14:04 PM11/8/21
to xnat_discussion
Here is the dockerfile if anyone can spot anything that is missing. My understanding was that all you needed to do was install the docker package and mount in the hosts docker socket, should this work?

I'm able to run the XNAT container and launch the docker workflow using the docker CLI fine so I'm not sure why the XNAT CS isn't able to use it

FROM tomcat:9-jre8-alpine

# User configurable arguments
ARG XNAT_VER=1.8.3
ARG XNAT_CS_PLUGIN_VER=3.1.0
ARG XNAT_BATCH_LAUNCH_PLUGIN_VER=0.5.0
ARG XNAT_ROOT=/data/xnat
ARG XNAT_HOME=/data/xnat/home
ARG JAVA_MS=256m
ARG JAVA_MX=2g
ARG XNAT_DATASOURCE_DRIVER=org.postgresql.Driver
ARG XNAT_DATASOURCE_URL=jdbc:postgresql://localhost:5432/xnat
ARG XNAT_DATASOURCE_USERNAME=xnat
ARG XNAT_DATASOURCE_PASSWORD=xnat
ARG XNAT_HIBERNATE_DIALECT=org.hibernate.dialect.PostgreSQL9Dialect
ARG TOMCAT_XNAT_FOLDER=ROOT
ARG TOMCAT_XNAT_FOLDER_PATH=${CATALINA_HOME}/webapps/${TOMCAT_XNAT_FOLDER}

# Create XNAT config file at $XNAT_HOME/config/xnat-conf.properties
COPY make-xnat-config.sh /usr/local/bin/make-xnat-config.sh

# Install XNAT
RUN apk add --no-cache postgresql postgresql-client supervisor wget vim docker
RUN rm -rf ${CATALINA_HOME}/webapps/*
RUN mkdir -p \
${TOMCAT_XNAT_FOLDER_PATH} \
${XNAT_HOME}/config \
${XNAT_HOME}/logs \
${XNAT_HOME}/plugins \
${XNAT_HOME}/work \
${XNAT_ROOT}/archive \
${XNAT_ROOT}/build \
${XNAT_ROOT}/cache \
${XNAT_ROOT}/ftp \
${XNAT_ROOT}/pipeline \
${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 unzip -o -d ${TOMCAT_XNAT_FOLDER_PATH} /tmp/xnat-web-${XNAT_VER}.war
RUN rm -f /tmp/xnat-web-${XNAT_VER}.war
RUN wget --output-document ${XNAT_HOME}/plugins/container-service-plugin.jar https://bitbucket.org/xnatdev/container-service/downloads/container-service-${XNAT_CS_PLUGIN_VER}-fat.jar
RUN wget --output-document ${XNAT_HOME}/plugins/batch-launch-plugin.jar https://bitbucket.org/xnatx/xnatx-batch-launch-plugin/downloads/batch-launch-plugin-${XNAT_BATCH_LAUNCH_PLUGIN_VER}.jar
RUN apk del wget
RUN mkdir /var/log/tomcat
ENV XNAT_HOME=${XNAT_HOME} XNAT_DATASOURCE_USERNAME=${XNAT_DATASOURCE_USERNAME} PGPASSWORD=${XNAT_DATASOURCE_PASSWORD}
ENV CATALINA_OPTS="-Xms${JAVA_MS} -Xmx${JAVA_MX} -Dxnat.home=${XNAT_HOME}"

# Add scripts for configuring XNAT database before launching Tomcat
COPY launch-xnat.sh /launch-xnat.sh
COPY XNAT.sql /XNAT.sql

# Skip the new site setup by creating site preferences file
COPY xnat-prefs-init.ini ${XNAT_HOME}/config/prefs-init.ini

# Change the default port to 80 (so that the container service knows where to)
# find it) and expose it
RUN sed -i 's/port="8080"/port="80"/' ${CATALINA_HOME}/conf/server.xml
EXPOSE 80

# Setup Postgres
RUN mkdir /run/postgresql
RUN mkdir /var/lib/postgresql/data
RUN chmod 700 /var/lib/postgresql/data
RUN chown postgres:postgres /run/postgresql /var/lib/postgresql/data

# Create postgres DB
USER postgres
RUN initdb -D /var/lib/postgresql/data
RUN echo -e "\ndatasource.driver = '/tmp'" >> /var/lib/postgresql/data/postgresql.conf
USER root

# Use supervisord to launch postgres and tomcat
COPY supervisord.conf /etc/supervisord.conf
CMD ["/usr/bin/supervisord"]


tom.g...@gmail.com

unread,
Nov 10, 2021, 11:01:42 PM11/10/21
to xnat_discussion
For anyone interested, one of my colleagues got to the bottom of the problem with my setup.

The issue was that I was that I needed to place the archive directory on the Docker Host (i.e. my mac) and mount it into the Docker container running XNAT, and then set the "Docker Server Path Prefix" to the parent of the mounted directory on the Docker Host, e.g.

docker run -p 80:80 -v /Users/tclose/Desktop/xnat-home/archive:/data/xnat/archive -v /var/run/docker.sock:/var/run/docker.sock tclose/test-xnat

"Docker Server Path Prefix"=/Users/tclose/Desktop/xnat-home

Herrick, Rick

unread,
Nov 11, 2021, 11:36:27 AM11/11/21
to xnat_di...@googlegroups.com

I’m glad you figured that because I started to reply a couple times but really didn’t have any idea what was going on 😊

 

-- 

Rick Herrick

XNAT Architect/Developer

Computational Imaging Laboratory

Washington University School of Medicine

 

 

From: xnat_di...@googlegroups.com <xnat_di...@googlegroups.com> on behalf of tom.g...@gmail.com <tom.g...@gmail.com>
Date: Wednesday, November 10, 2021 at 10:01 PM
To: xnat_discussion <xnat_di...@googlegroups.com>
Subject: [XNAT Discussion] Re: Help with test setup for testing container pipelines

* External Email - Caution *

--
You received this message because you are subscribed to the Google Groups "xnat_discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to xnat_discussi...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/xnat_discussion/c4dfec92-33b8-4947-a9a9-7288d38f93b9n%40googlegroups.com.

 


The materials in this message are private and may contain Protected Healthcare Information or other information of a sensitive nature. If you are not the intended recipient, be advised that any unauthorized use, disclosure, copying or the taking of any action in reliance on the contents of this information is strictly prohibited. If you have received this email in error, please immediately notify the sender via telephone or return mail.

Reply all
Reply to author
Forward
0 new messages