Public | Automated Build

Last pushed: 6 months ago
Short Description
OpenClinica 3.4.1 + Web Services
Full Description

OpenClinica 3.13 via Docker

The OpenClinica Community edition is free and open source and is distributed under the GNU LGPL license.

This repository contains the Dockerfile, a startup script and the following instructions for running a Docker container which you can use to give OpenClinica a try. An image built with this Dockerfile is available on Docker Hub.

IMPORTANT: This image is meant for trying out OpenClinica and not meant for running a production server or for storing important study data.

Setup

0. Install Docker

  • Follow the installation instructions for your host system
  • If you are running Docker on VirtualBox: the maximum RAM size can be adjusted through the user interface of VirtualBox (run it from the start menu, stop the virtual machine, change the configuration to e.g. 4096MB, close it and start the virtual machine using docker-machine)

1. Create a database init script

  • Create a file init-db.sh that adds a user and a database for OpenClinica to PostgreSQL:
#!/bin/bash
set -e

psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" <<-EOSQL
    CREATE ROLE clinica LOGIN ENCRYPTED PASSWORD 'clinica' SUPERUSER NOINHERIT NOCREATEDB NOCREATEROLE;
    CREATE DATABASE openclinica WITH ENCODING='UTF8' OWNER=clinica;
EOSQL
  • Please adjust the database password

2. Start a PostgreSQL database server

  • This expects the init-db.sh script residing in the current directory
docker container run --name ocdb -d -v ocdb-data:/var/lib/postgresql/data \
 -v $PWD/init-db.sh:/docker-entrypoint-initdb.d/init-db.sh \
 -p 5432:5432 \
 -e POSTGRES_INITDB_ARGS="-E 'UTF-8' --locale=POSIX" \
 -e POSTGRES_PASSWORD=postgres123 \
 postgres:9.5
  • Please change the root database password

3. Start Tomcat serving OpenClinica and OpenClinica-ws

docker container run --name oc -h oc -d -v oc-data:/usr/local/tomcat/openclinica.data \
 -p 80:8080 \
 -e LOG_LEVEL=INFO \
 -e TZ=UTC-1 \
 -e DB_TYPE=postgres \
 -e DB_HOST=192.168.99.100 \
 -e DB_NAME=openclinica \
 -e DB_USER=clinica \
 -e DB_PASS=clinica \
 -e DB_PORT=5432 \
 -e SUPPORT_URL="https://www.openclinica.com/community-edition-open-source-edc/" \
 piegsaj/openclinica:oc-3.13
  • Adjust DB_HOST and passwords accordingly
  • The environment variables for log level and timezone are optional here.

4. Run OpenClinica

Operation

To show the OpenClinica logs:

docker container logs -f oc

To backup a database dump to the current directory on the host:

echo "postgres123" | docker container run -i --rm \
 --link ocdb:ocdb \
 -v $PWD:/tmp \
 postgres:9.5 sh -c '\
 pg_dump -h ocdb -p $OCDB_PORT_5432_TCP_PORT -U postgres -F tar -v openclinica \
 > /tmp/ocdb_pg_dump_$(date +%Y-%m-%d_%H-%M-%S).tar'

To backup the OpenClinica data folder to the current directory on the host:

docker container run --rm \
 -v oc-data:/tomcat/openclinica.data \
 -v $PWD:/tmp \
 piegsaj/openclinica:oc-3.13 \
 tar cvf /tmp/oc_data_backup_$(date +%Y-%m-%d_%H-%M-%S).tar /tomcat/openclinica.data

Contribute

Feedback is welcome. The source is available on Github. Please report any issues.

Docker Pull Command
Owner
piegsaj
Source Repository

Comments (2)
fendoude007
19 days ago

I meet a problem with exception messages. is there any configration lost in my setting?

in ch.qos.logback.classic.joran.JoranConfigurator@2bc85121 - Registering current configuration as safe fallback point
java.lang.NullPointerException
at java.util.Hashtable.put(Hashtable.java:459)
at java.util.Properties.setProperty(Properties.java:166)
at org.akaza.openclinica.dao.core.CoreResources.setDatabaseProperties(CoreResources.java:445)
at org.akaza.openclinica.dao.core.CoreResources.setDataInfoProperties(CoreResources.java:287)
at org.akaza.openclinica.dao.core.CoreResources.setResourceLoader(CoreResources.java:159)
at org.springframework.context.support.ApplicationContextAwareProcessor.invokeAwareInterfaces(ApplicationContextAwareProcessor.java:97)
at org.springframework.context.support.ApplicationContextAwareProcessor.postProcessBeforeInitialization(ApplicationContextAwareProcessor.java:85)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:394)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1413)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:353)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:983)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:879)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:322)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:106)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1325)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1086)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:626)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:407)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
at org.akaza.openclinica.dao.core.OCContextLoaderListener.contextInitialized(OCContextLoaderListener.java:38)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5118)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5634)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:899)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:875)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1260)
at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:2002)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Sep 28, 2017 11:54:55 AM org.apache.catalina.core.StandardContext startInternal

musketyr
3 years ago

the ifconfig command is not working for me at Mac OS but I was able to follow this guide to obtain the ip address.

Actually getting the IP is very straightforward, just find the line

To connect the Docker client to the Docker daemon, please set:
    export DOCKER_HOST=tcp://<THIS IS THE VM IP>:2376

And you see the IP of the DOCKER_HOST variable.