diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 00000000..63ebdd80
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,2 @@
+Dockerfile
+docker.Makefile
\ No newline at end of file
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 00000000..29a2cd40
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,16 @@
+
+build:
+ image: docker:18-git
+ stage: build
+ only:
+ - main
+ - stable
+ services:
+ - docker:18-dind
+ script:
+ - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
+ - docker build -t ${ZOOMA_IMAGE_PREFIX}/zooma:$CI_COMMIT_REF_NAME-$CI_BUILD_ID .
+ - docker tag ${ZOOMA_IMAGE_PREFIX}/zooma:$CI_COMMIT_REF_NAME-$CI_BUILD_ID ${ZOOMA_IMAGE_PREFIX}/zooma:$CI_COMMIT_REF_NAME
+ - docker push ${ZOOMA_IMAGE_PREFIX}/zooma:$CI_COMMIT_REF_NAME-$CI_BUILD_ID
+ - docker push ${ZOOMA_IMAGE_PREFIX}/zooma:$CI_COMMIT_REF_NAME
+
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 00000000..5d7bed3f
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,41 @@
+FROM tomcat:9-jdk8-openjdk
+
+# ENV ZOOMA_HOME=/opt/zooma cant set this because hard coded in build-virtuoso-index.sh
+ENV ZOOMA_OPTS="-Xms1g -Xmx4g"
+
+RUN mkdir /opt/zooma_github /opt/zooma
+RUN apt-get update && apt-get install -y nano maven
+COPY . /opt/zooma_github/
+ENV OJDBC6="https://www.oracle.com/webapps/redirect/signon?nexturl=https://download.oracle.com/otn/utilities_drivers/jdbc/11204/ojdbc6.jar"
+RUN wget $OJDBC6 -O /lib/ojdbc6.jar \
+ && mvn install:install-file -DgroupId=com.oracle -DartifactId=ojdbc6 -Dpackaging=jar -Dversion=11.2.0.4 -Dfile=/lib/ojdbc6.jar \
+ && test /root/.m2/repository/com/oracle/ojdbc6/11.2.0.4/ojdbc6-11.2.0.4.jar
+RUN cd /opt/zooma_github && mvn clean package
+RUN mkdir /opt/tmp && unzip /opt/zooma_github/zooma-builder-app/target/zooma-builder.zip -d /opt/tmp
+RUN cp /opt/zooma_github/zooma-ui/target/zooma.war /usr/local/tomcat/webapps/
+
+ENV VIRTUOSO_VERSION="7.2.5"
+ENV VIRTUOSO_HOME=/opt/virtuoso/virtuoso-opensource
+ENV VIRTUOSO="https://downloads.sourceforge.net/project/virtuoso/virtuoso/${VIRTUOSO_VERSION}/virtuoso-opensource.x86_64-generic_glibc25-linux-gnu.tar.gz"
+# ?r=&ts=1597420967
+RUN mkdir /opt/virtuoso && wget $VIRTUOSO -O /opt/virtuoso/virtuoso-${VIRTUOSO_VERSION}.tar.gz \
+ && tar -xzvf /opt/virtuoso/virtuoso-${VIRTUOSO_VERSION}.tar.gz -C /opt/virtuoso
+
+RUN sed -i 's@base=\${0%\/[*]}/..;@base=..;@g' /opt/tmp/bin/build-labels.sh
+RUN sed -i 's@base=\${0%\/[*]}/..;@base=..;@g' /opt/tmp/bin/build-lucene-index.sh
+RUN sed -i 's@base=\${0%\/[*]};@base=.;@g' /opt/tmp/bin/build-virtuoso-index.sh
+RUN sed -i 's@base=\${0%\/[*]}/..;@base=..;@g' /opt/tmp/bin/build-rdf.sh
+
+# ERROR: $ZOOMA_DATA_DIR not set - using /root/.zooma/data (build-virtuoso-index.sh )
+ENV ZOOMA_HOME=/root/.zooma
+RUN ls -a /root/
+RUN cp /opt/zooma_github/startup.sh /root/startup.sh
+# The following is a bit of a hack to initialise the zooma directories
+RUN startup.sh && sleep 20 && shutdown.sh
+
+# Overwriting server.xml is necessary only because of we had to add relaxedQueryChars='^{}[]|"' to the main connector
+COPY server.xml /usr/local/tomcat/conf/server.xml
+#RUN mkdir $ZOOMA_HOME $ZOOMA_HOME/config
+EXPOSE 8080
+CMD ["bash","/root/startup.sh"]
+#CMD ["catalina.sh","run"]
diff --git a/README.md b/README.md
index 80c260d3..c473aa1f 100644
--- a/README.md
+++ b/README.md
@@ -2,15 +2,34 @@
ZOOMA is an application for discovering optimal ontology mappings, developed by the Samples, Phenotypes and Ontologies Team at [EMBL-EBI](http://www.ebi.ac.uk). It can be used to automatically annotate "properties" (plain text, descriptive values about biological entities) with "semantic tags" (ontology classes).
-## Links
+* ZOOMA is currently live at the EBI here http://www.ebi.ac.uk/spot/zooma
+* ZOOMA documentation can be found here http://www.ebi.ac.uk/spot/zooma/docs
-### ZOOMA homepage
+## Deploying with Docker
-http://www.ebi.ac.uk/spot/zooma
+The preferred method of deployment for ZOOMA is using Docker. First, create the
+necessary volumes:
-### ZOOMA documentation
+ docker volume create --name=zooma-config
-http://www.ebi.ac.uk/spot/zooma/docs
+Then, start ZOOMA:
+
+ docker run -d --name zooma -p 8009:8080 -v zooma-config:/root/.zooma/config ebispot/zooma:latest
+
+You should now be able to access ZOOMA at `http://localhost:8080`.
+
+To configure ZOOMA, first stop the docker container:
+
+ docker stop zooma
+
+The configuration files will be located in the zooma-config volume on your filesystem. For Ubuntu, this will be located at `/var/lib/docker/volumes/zooma-config/_data`.
+
+Once configured, start ZOOMA again:
+
+ docker start zooma
+
+
+## Building ZOOMA manually
### Dependencies
1. Java - Tested on Oracle JDK version 1.8
diff --git a/server.xml b/server.xml
new file mode 100644
index 00000000..b51b4593
--- /dev/null
+++ b/server.xml
@@ -0,0 +1,171 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/startup.sh b/startup.sh
new file mode 100644
index 00000000..9f944a69
--- /dev/null
+++ b/startup.sh
@@ -0,0 +1,14 @@
+set -e
+
+echo "Data dir:"
+ls $ZOOMA_DATA_DIR
+
+SCRIPT_DIR=/opt/tmp/bin/
+cd $SCRIPT_DIR
+bash build-rdf.sh
+bash build-virtuoso-index.sh
+bash virtuoso-start.sh
+bash build-labels.sh
+bash build-lucene-index.sh
+
+catalina.sh run
diff --git a/zooma-builder-app/src/main/java/uk/ac/ebi/fgpt/zooma/ZOOMA2BackingUpDriver.java b/zooma-builder-app/src/main/java/uk/ac/ebi/fgpt/zooma/ZOOMA2BackingUpDriver.java
index f517247b..e3edb1e2 100644
--- a/zooma-builder-app/src/main/java/uk/ac/ebi/fgpt/zooma/ZOOMA2BackingUpDriver.java
+++ b/zooma-builder-app/src/main/java/uk/ac/ebi/fgpt/zooma/ZOOMA2BackingUpDriver.java
@@ -37,29 +37,28 @@ protected void backupFiles(Path path, Path backupPath, PrintStream out) throws I
if (!Files.exists(backupPath)) {
out.print(
"Backing up " + path.toString() + " to " + backupPath.toString() + "...");
- Files.move(path,
+ Files.copy(path,
backupPath,
- StandardCopyOption.REPLACE_EXISTING,
- StandardCopyOption.ATOMIC_MOVE);
+ StandardCopyOption.REPLACE_EXISTING);
out.println("ok!");
}
else {
out.print(
"Backup already exists for today, clearing " + path.toString() + "...");
- Files.walkFileTree(path, new SimpleFileVisitor() {
- @Override
- public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
- Files.delete(file);
- return FileVisitResult.CONTINUE;
- }
-
- @Override
- public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException {
- Files.delete(dir);
- return FileVisitResult.CONTINUE;
- }
- });
- out.println("ok!");
}
+ Files.walkFileTree(path, new SimpleFileVisitor() {
+ @Override
+ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
+ Files.delete(file);
+ return FileVisitResult.CONTINUE;
+ }
+
+ @Override
+ public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException {
+ Files.delete(dir);
+ return FileVisitResult.CONTINUE;
+ }
+ });
+ out.println("ok!");
}
}