From 94a93513092f4758f96f81d8ae7c64a805d6a691 Mon Sep 17 00:00:00 2001 From: William Welling Date: Thu, 23 Feb 2023 14:20:37 -0600 Subject: [PATCH 01/18] Enable war deployment model (#197.1) --- .github/workflows/build.yml | 2 +- .github/workflows/deploy.yml | 2 +- .github/workflows/docker.yml | 4 +- Dockerfile | 12 +- README.md | 5 +- docker-compose.yml | 6 +- home/pom.xml | 2 +- ...onSetup.n3 => default.applicationSetup.n3} | 0 ....properties => default.runtime.properties} | 20 --- installer/example-settings.xml | 22 --- installer/home/pom.xml | 88 ++-------- installer/home/src/main/assembly/home.xml | 1 + installer/pom.xml | 56 +------ installer/webapp/pom.xml | 158 +++++++----------- .../main/webResources/META-INF/context.xml | 49 +++++- .../WEB-INF/classes/log4j.properties | 2 +- pom.xml | 3 +- start.sh | 56 +++---- 18 files changed, 169 insertions(+), 319 deletions(-) rename home/src/main/resources/config/{example.applicationSetup.n3 => default.applicationSetup.n3} (100%) rename home/src/main/resources/config/{example.runtime.properties => default.runtime.properties} (96%) delete mode 100644 installer/example-settings.xml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index dcd3346372..8df140f5c0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -30,4 +30,4 @@ jobs: - name: Maven Build run: | cd ../VIVO - mvn clean package -s installer/example-settings.xml + mvn clean install diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index bde1e3a39f..a9aad97e1b 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -37,7 +37,7 @@ jobs: - name: Maven Deploy run: | cd ../VIVO - mvn --batch-mode deploy -Pskip + mvn --batch-mode deploy env: MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }} diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 73466c2ed4..ccd12ea038 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -34,7 +34,7 @@ jobs: - name: Maven Build run: | cd ../VIVO - mvn clean package -s installer/example-settings.xml + mvn clean install - name: Set up QEMU uses: docker/setup-qemu-action@v1 @@ -47,7 +47,7 @@ jobs: with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - + - name: Build and push id: docker_build uses: docker/build-push-action@v2 diff --git a/Dockerfile b/Dockerfile index 6632d8b3b9..ccfe74a7e9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,18 +1,20 @@ FROM tomcat:9-jdk11-openjdk ARG SOLR_URL=http://localhost:8983/solr/vivocore -ARG VIVO_DIR=/usr/local/vivo/home +ARG VIVO_DIR=/opt/vivo/home ARG TDB_FILE_MODE=direct ENV SOLR_URL=${SOLR_URL} -ENV JAVA_OPTS="${JAVA_OPTS} -Dtdb:fileMode=$TDB_FILE_MODE" +ENV JAVA_OPTS="${JAVA_OPTS} -Dvivo-dir=$VIVO_DIR -Dtdb:fileMode=$TDB_FILE_MODE" -RUN mkdir /usr/local/vivo -RUN mkdir /usr/local/vivo/home +RUN mkdir /opt/vivo +RUN mkdir /opt/vivo/home -COPY ./installer/home/target/vivo /vivo-home COPY ./installer/webapp/target/vivo.war /usr/local/tomcat/webapps/ROOT.war +COPY ./home/src/main/resources/config/default.applicationSetup.n3 /applicationSetup.n3 +COPY ./home/src/main/resources/config/default.runtime.properties /runtime.properties + COPY start.sh /start.sh EXPOSE 8080 diff --git a/README.md b/README.md index b9a89d62b5..ee50b9f616 100644 --- a/README.md +++ b/README.md @@ -40,13 +40,12 @@ RESET_CORE=false - `RESET_HOME`: Convenience to reset VIVO home when starting container. **Caution**, will delete local configuration, content, and configuration model. - `RESET_CORE`: Convenience to reset VIVO Solr core when starting container. **Caution**, will require complete reindex. -Before building VIVO, you will also need to clone (and switch to the same branch, if other than main) of [Vitro](https://github.com/vivo-project/Vitro). The Vitro project must be cloned to a sibling directory next to VIVO so that it can be found during the build. +Before building VIVO, you will also need to clone (and switch to the same branch, if other than main) of [Vitro](https://github.com/vivo-project/Vitro). The Vitro project must be cloned to a sibling directory next to VIVO so that it can be found during the build. Build and start VIVO. -1. In VIVO (with Vitro cloned alongside it), run: ``` -mvn clean package -s installer/example-settings.xml +mvn clean install docker-compose up ``` diff --git a/docker-compose.yml b/docker-compose.yml index d47dcf7d0d..17022507e9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -19,7 +19,7 @@ services: context: ./ dockerfile: Dockerfile args: - - VIVO_DIR=/usr/local/vivo/home + - VIVO_DIR=/opt/vivo/home - TDB_FILE_MODE=direct - SOLR_URL=http://solr:8983/solr/vivocore environment: @@ -28,9 +28,11 @@ services: ports: - 8080:8080 volumes: - - ${LOCAL_VIVO_HOME}:/usr/local/vivo/home + - ${LOCAL_VIVO_HOME}:/opt/vivo/home networks: - vivo + depends_on: + - solr networks: vivo: diff --git a/home/pom.xml b/home/pom.xml index 86c24e05d4..f08b6c7af1 100644 --- a/home/pom.xml +++ b/home/pom.xml @@ -69,4 +69,4 @@ tar.gz - \ No newline at end of file + diff --git a/home/src/main/resources/config/example.applicationSetup.n3 b/home/src/main/resources/config/default.applicationSetup.n3 similarity index 100% rename from home/src/main/resources/config/example.applicationSetup.n3 rename to home/src/main/resources/config/default.applicationSetup.n3 diff --git a/home/src/main/resources/config/example.runtime.properties b/home/src/main/resources/config/default.runtime.properties similarity index 96% rename from home/src/main/resources/config/example.runtime.properties rename to home/src/main/resources/config/default.runtime.properties index 92e775384d..4e828b30a5 100644 --- a/home/src/main/resources/config/example.runtime.properties +++ b/home/src/main/resources/config/default.runtime.properties @@ -19,26 +19,6 @@ # BASIC PROPERTIES # ----------------------------------------------------------------------------- - # - # This namespace will be used when generating URIs for objects created in the - # editor. In order to serve linked data, the default namespace must be composed - # as follows (optional elements in parentheses): - # - # scheme + server_name (+ port) (+ servlet_context) + "/individual/" - # - # For example, Cornell's default namespace is: - # - # http://vivo.cornell.edu/individual/ - # -Vitro.defaultNamespace = http://vivo.mydomain.edu/individual/ - - # - # The email address of the root user for the VIVO application. The password - # for this user is initially set to "rootPassword", but you will be asked to - # change the password the first time you log in. - # -rootUser.emailAddress = vivo_root@mydomain.edu - # # Argon2 password hashing parameters for time, memory and parallelism required to # compute a hash. diff --git a/installer/example-settings.xml b/installer/example-settings.xml deleted file mode 100644 index cae40e61b1..0000000000 --- a/installer/example-settings.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - defaults - - vivo - - /usr/local/vivo/home - /usr/local/tomcat - - wilma - - - - - - defaults - - diff --git a/installer/home/pom.xml b/installer/home/pom.xml index 932f43ea6a..6d89944de1 100644 --- a/installer/home/pom.xml +++ b/installer/home/pom.xml @@ -18,86 +18,24 @@ wilma - - - install - - vivo-dir - - - ${app-name} - - - maven-assembly-plugin - - - src/main/assembly/home.xml - - false - - - - package - - single - - - - - - maven-antrun-plugin - - - remove-webapp - verify - - run - - - - - - - - - - - - - - - - maven-resources-plugin - - - install - install - - copy-resources - - - ${vivo-dir} - - - ${project.build.directory}/${project.build.finalName} - - - - - - - - - - - - maven-install-plugin + maven-assembly-plugin - true + + src/main/assembly/home.xml + + false + + + package + + single + + + diff --git a/installer/home/src/main/assembly/home.xml b/installer/home/src/main/assembly/home.xml index 6de97e21d7..34f447c0ae 100644 --- a/installer/home/src/main/assembly/home.xml +++ b/installer/home/src/main/assembly/home.xml @@ -4,6 +4,7 @@ home dir + tar false diff --git a/installer/pom.xml b/installer/pom.xml index 5b3eaa5432..2d563d86e6 100644 --- a/installer/pom.xml +++ b/installer/pom.xml @@ -10,6 +10,7 @@ VIVO Installer + vivo ${project.version} true UTF-8 @@ -24,12 +25,6 @@ UTF-8 - - maven-install-plugin - - true - - org.apache.maven.plugins maven-gpg-plugin @@ -150,12 +145,6 @@ - - maven-dependency-plugin - - true - - maven-resources-plugin 2.6 @@ -179,45 +168,6 @@ - - maven-war-plugin - - - default-war - - - - - - - - - install - - vivo-dir - - - - - maven-enforcer-plugin - - - enforce-properties - validate - - enforce - - - - - app-name - You must provide an application name (app-name) - - - - - - @@ -248,7 +198,7 @@ vivo-dependencies VIVO Dependencies - https://raw.github.com/vivo-project/dependencies/main/ + https://raw.github.com/vivo-project/dependencies/master/ sonatype-nexus-snapshots @@ -262,4 +212,4 @@ - \ No newline at end of file + diff --git a/installer/webapp/pom.xml b/installer/webapp/pom.xml index 6f5f16513b..0d896cc23a 100644 --- a/installer/webapp/pom.xml +++ b/installer/webapp/pom.xml @@ -2,11 +2,14 @@ xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + 4.0.0 + org.vivoweb vivo-installer-vivo 1.13.1-SNAPSHOT war + org.vivoweb vivo-installer @@ -16,105 +19,9 @@ VIVO Install Web App - - - package - - app-name - - - ${app-name} - - - org.apache.maven.plugins - maven-war-plugin - - - - true - - - false - - - org.vivoweb - vivo-webapp - war - - - - - src/main/webResources - true - - - - - - - - - install - - tomcat-dir - - - - - maven-antrun-plugin - - - remove-webapp - verify - - run - - - - - - - - - - - org.apache.maven.plugins - maven-dependency-plugin - - - install - install - - unpack - - - - - ${project.groupId} - ${project.artifactId} - ${project.version} - war - true - ${tomcat-dir}/webapps/${project.build.finalName} - - - - - - - - - - - + ${app-name} - - maven-install-plugin - - true - - maven-clean-plugin @@ -125,6 +32,63 @@ + + org.apache.maven.plugins + maven-dependency-plugin + + false + + + + include-home + process-resources + + copy + + + + + org.vivoweb + vivo-installer-home + ${project.version} + tar + vivo-home.tar + ${project.build.directory}/home-files + + + + + + + + org.apache.maven.plugins + maven-war-plugin + + + + true + + + false + + + org.vivoweb + vivo-webapp + war + + + + + src/main/webResources + true + + + ${project.build.directory}/home-files/ + WEB-INF/resources/home-files/ + + + + diff --git a/installer/webapp/src/main/webResources/META-INF/context.xml b/installer/webapp/src/main/webResources/META-INF/context.xml index d60bd1ff63..ea94491337 100644 --- a/installer/webapp/src/main/webResources/META-INF/context.xml +++ b/installer/webapp/src/main/webResources/META-INF/context.xml @@ -1,9 +1,52 @@ + + + + + + + + + + + + name="vitro/defaultNamespace" + value="http://vivo.mydomain.edu/individual/" override="true"/> - \ No newline at end of file + diff --git a/installer/webapp/src/main/webResources/WEB-INF/classes/log4j.properties b/installer/webapp/src/main/webResources/WEB-INF/classes/log4j.properties index 5cdfd31cd8..3c4d7c95cb 100644 --- a/installer/webapp/src/main/webResources/WEB-INF/classes/log4j.properties +++ b/installer/webapp/src/main/webResources/WEB-INF/classes/log4j.properties @@ -24,7 +24,7 @@ # debug.log4j.properties exists will be used instead, if it exists, but is not stored in Subversion. log4j.appender.AllAppender=org.apache.log4j.RollingFileAppender -log4j.appender.AllAppender.File=${catalina.base}/logs/${app-name}.all.log +log4j.appender.AllAppender.File= ${catalina.base}/logs/vivo.all.log log4j.appender.AllAppender.MaxFileSize=10MB log4j.appender.AllAppender.MaxBackupIndex=10 log4j.appender.AllAppender.layout=org.apache.log4j.PatternLayout diff --git a/pom.xml b/pom.xml index d429a0db8a..c9b8c142da 100644 --- a/pom.xml +++ b/pom.xml @@ -51,6 +51,7 @@ + vivo ${project.version} ${basedir} yyyy-MM-dd HH:mm:ss @@ -542,4 +543,4 @@ https://oss.sonatype.org/service/local/staging/deploy/maven2/ - \ No newline at end of file + diff --git a/start.sh b/start.sh index 0f9ef7d921..90e76f6057 100644 --- a/start.sh +++ b/start.sh @@ -9,51 +9,43 @@ fi # allow easier reset home with `docker run -e RESET_HOME=true` if [[ "$RESET_HOME" = "true" ]]; then - echo 'Clearing VIVO HOME /usr/local/vivo/home' - rm -rf /usr/local/vivo/home/* + echo 'Clearing VIVO HOME /opt/vivo/home' + rm -rf /opt/vivo/home/* fi -# copy home bin if not exists -if [ ! -d /usr/local/vivo/home/bin ]; then - echo "Copying home bin directory to /usr/local/vivo/home/bin" - cp -r /vivo-home/bin /usr/local/vivo/home/bin -fi +# ensure home config directory exists +mkdir -p /opt/vivo/home/config -# copy home config if not exists -if [ ! -d /usr/local/vivo/home/config ]; then - echo "Copying home config directory to /usr/local/vivo/home/config" - cp -r /vivo-home/config /usr/local/vivo/home/config +# generate digest.md5 for existing VIVO home if not already exist +if [ ! -f /opt/vivo/home/digest.md5 ]; then + find /opt/vivo/home -type f | grep -E '^/opt/vivo/home/bin/|^/opt/vivo/home/config/|^/opt/vivo/home/rdf/' | xargs md5sum > /opt/vivo/home/digest.md5 + echo "Generated digest.md5 for VIVO home" + cat /opt/vivo/home/digest.md5 fi -# copy home rdf if not exists -if [ ! -d /usr/local/vivo/home/rdf ]; then - echo "Copying home rdf directory to /usr/local/vivo/home/rdf" - cp -r /vivo-home/rdf /usr/local/vivo/home/rdf -fi +# only move runtime.properties first time and if it does not already exist in target home directory +if [ -f /runtime.properties ]; then + # template runtime.properties vitro.local.solr.url value to $SOLR_URL value + echo "Templating runtime.properties vitro.local.solr.url = $SOLR_URL" + sed -i "s,http://localhost:8983/solr/vivocore,$SOLR_URL,g" /runtime.properties -# copy runtime.properties if it does not already exist in target home directory -if [ -f /usr/local/vivo/home/config/example.runtime.properties ]; then - if [ ! -f /usr/local/vivo/home/config/runtime.properties ] + if [ ! -f /opt/vivo/home/config/runtime.properties ] then - echo "Copying example.runtime.properties to /usr/local/vivo/home/config/runtime.properties" - cp /usr/local/vivo/home/config/example.runtime.properties /usr/local/vivo/home/config/runtime.properties - - # template runtime.properties vitro.local.solr.url value to $SOLR_URL value - echo "Templating runtime.properties vitro.local.solr.url = $SOLR_URL" - sed -i "s,http://localhost:8983/solr/vivocore,$SOLR_URL,g" /usr/local/vivo/home/config/runtime.properties + echo "First time: moving /runtime.properties to /opt/vivo/home/config/runtime.properties" + mv -n /runtime.properties /opt/vivo/home/config/runtime.properties else - echo "Using existing /usr/local/vivo/home/config/runtime.properties" + echo "Using existing /opt/vivo/home/config/runtime.properties" fi fi -# copy applicationSetup.n3 if it does not already exist in target home directory -if [ -f /usr/local/vivo/home/config/example.applicationSetup.n3 ]; then - if [ ! -f /usr/local/vivo/home/config/applicationSetup.n3 ] +# only move applicationSetup.n3 first time and if it does not already exist in target home directory +if [ -f /applicationSetup.n3 ]; then + if [ ! -f /opt/vivo/home/config/applicationSetup.n3 ] then - echo "Copying example.applicationSetup.n3 to /usr/local/vivo/home/config/applicationSetup.n3" - cp /usr/local/vivo/home/config/example.applicationSetup.n3 /usr/local/vivo/home/config/applicationSetup.n3 + echo "First time: moving /applicationSetup.n3 to /opt/vivo/home/config/applicationSetup.n3" + mv -n /applicationSetup.n3 /opt/vivo/home/config/applicationSetup.n3 else - echo "Using existing /usr/local/vivo/home/config/applicationSetup.n3" + echo "Using existing /opt/vivo/home/config/applicationSetup.n3" fi fi From 70da5727aaeb38ee7b7b86e0965ec60ef9d285e3 Mon Sep 17 00:00:00 2001 From: William Welling Date: Mon, 27 Feb 2023 09:12:15 -0600 Subject: [PATCH 02/18] Delay startup for Solr to start when using docker-compose --- start.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/start.sh b/start.sh index 90e76f6057..692c5b99b4 100644 --- a/start.sh +++ b/start.sh @@ -49,4 +49,8 @@ if [ -f /applicationSetup.n3 ]; then fi fi +echo "Giving time for Solr to startup..." +sleep 15 +echo "Starting Tomcat" + catalina.sh run From 4c5ebb3a00af599ad9ad80fb19d1e263f381f47d Mon Sep 17 00:00:00 2001 From: William Welling Date: Mon, 27 Feb 2023 16:21:40 -0600 Subject: [PATCH 03/18] Docker improvements (WIP) --- .env | 5 +- .gitignore | 1 + Dockerfile | 55 +++++++++-- docker-compose.yml | 24 +++-- .../main/webResources/META-INF/context.xml | 20 ++-- pom.xml | 4 +- start.sh | 91 ++++++++++++++----- 7 files changed, 148 insertions(+), 52 deletions(-) diff --git a/.env b/.env index e6fa0b6268..81ad80f921 100644 --- a/.env +++ b/.env @@ -1,4 +1,7 @@ +LOCAL_SOLR_DATA=./vivo-solr +RESET_CORE=false + LOCAL_VIVO_HOME=./vivo-home RESET_HOME=false -RESET_CORE=false + VERBOSE=no diff --git a/.gitignore b/.gitignore index 342e52c395..af611a1c68 100644 --- a/.gitignore +++ b/.gitignore @@ -22,6 +22,7 @@ utilities/rdbmigration/.work **/bin/ vivo-home/ +vivo-solr/ .fake .ionide diff --git a/Dockerfile b/Dockerfile index ccfe74a7e9..839b97a86a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,22 +1,57 @@ +ARG TOMCAT_CONTEXT_PATH=ROOT +ARG USER_ID=3001 +ARG USER_NAME=vivo +ARG USER_HOME_DIR=/home/$USER_NAME + FROM tomcat:9-jdk11-openjdk +ARG TOMCAT_CONTEXT_PATH +ARG USER_ID +ARG USER_NAME +ARG USER_HOME_DIR -ARG SOLR_URL=http://localhost:8983/solr/vivocore -ARG VIVO_DIR=/opt/vivo/home +ARG VIVO_HOME_DIR=/opt/vivo/home ARG TDB_FILE_MODE=direct +ARG ROOT_USER_ADDRESS=vivo_root@mydomain.edu +ARG DEFAULT_NAMESPACE=http://vivo.mydomain.edu/individual/ + +ARG SOLR_URL=http://localhost:8983/solr/vivocore +ARG SELF_ID_MATCHING_PROPERTY=http://vivo.mydomain.edu/ns + +ARG LOAD_SAMPLE_DATA=false +ARG SAMPLE_DATA_REPO_URL=https://github.com/vivo-project/sample-data.git +ARG SAMPLE_DATA_BRANCH=main +ARG SAMPLE_DATA_DIRECTORY=openvivo + +ENV JAVA_OPTS="${JAVA_OPTS} -Dvivo-dir=$VIVO_HOME_DIR -Droot-user-address=$ROOT_USER_ADDRESS -Ddefault-namespace=$DEFAULT_NAMESPACE -Dtdb:fileMode=$TDB_FILE_MODE" + +ENV VIVO_HOME_DIR=${VIVO_HOME_DIR} ENV SOLR_URL=${SOLR_URL} -ENV JAVA_OPTS="${JAVA_OPTS} -Dvivo-dir=$VIVO_DIR -Dtdb:fileMode=$TDB_FILE_MODE" +ENV SELF_ID_MATCHING_PROPERTY=${SELF_ID_MATCHING_PROPERTY} + +ENV LOAD_SAMPLE_DATA=${LOAD_SAMPLE_DATA} +ENV SAMPLE_DATA_REPO_URL=${SAMPLE_DATA_REPO_URL} +ENV SAMPLE_DATA_BRANCH=${SAMPLE_DATA_BRANCH} +ENV SAMPLE_DATA_DIRECTORY=${SAMPLE_DATA_DIRECTORY} + +RUN \ + apt-get update -y && \ + apt-get upgrade -y && \ + apt install git -y + +RUN \ + addgroup --disabled-password --gid $USER_ID $USER_NAME && \ + adduser --disabled-password --home $USER_HOME_DIR --uid $USER_ID --gid $USER_ID $USER_NAME -RUN mkdir /opt/vivo -RUN mkdir /opt/vivo/home +RUN mkdir -p $VIVO_HOME_DIR -COPY ./installer/webapp/target/vivo.war /usr/local/tomcat/webapps/ROOT.war +COPY ./installer/webapp/target/vivo.war /usr/local/tomcat/webapps/$TOMCAT_CONTEXT_PATH.war -COPY ./home/src/main/resources/config/default.applicationSetup.n3 /applicationSetup.n3 -COPY ./home/src/main/resources/config/default.runtime.properties /runtime.properties +COPY ./home/src/main/resources/config/default.applicationSetup.n3 /tmp/applicationSetup.n3 +COPY ./home/src/main/resources/config/default.runtime.properties /tmp/runtime.properties -COPY start.sh /start.sh +COPY start.sh /opt/vivo/start.sh EXPOSE 8080 -CMD ["/bin/bash", "/start.sh"] +CMD ["/bin/bash", "/opt/vivo/start.sh"] diff --git a/docker-compose.yml b/docker-compose.yml index 17022507e9..487b502ad4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,16 +1,22 @@ version: '3.2' +networks: + net: + services: solr: image: vivoweb/vivo-solr:latest + hostname: solr environment: - RESET_CORE=${RESET_CORE} - VERBOSE=${VERBOSE} ports: - 8983:8983 + volumes: + - ${LOCAL_SOLR_DATA}:/opt/solr/server/solr/mycores networks: - - vivo + - net tomcat: container_name: vivo @@ -19,20 +25,24 @@ services: context: ./ dockerfile: Dockerfile args: - - VIVO_DIR=/opt/vivo/home + - VIVO_HOME_DIR=/opt/vivo/home - TDB_FILE_MODE=direct - SOLR_URL=http://solr:8983/solr/vivocore + - TOMCAT_CONTEXT_PATH=ROOT + - LOAD_SAMPLE_DATA=true + - SAMPLE_DATA_REPO_URL=https://github.com/chenejac/sample-data.git + - SAMPLE_DATA_BRANCH=reorganization + - SAMPLE_DATA_DIRECTORY=i18n environment: - RESET_HOME=${RESET_HOME} - VERBOSE=${VERBOSE} + - SELECTABLE_LOCALES=en_US,de_DE,sr_Latn_RS,ru_RU,fr_CA,en_CA,es,pt_BR + - LANGUAGE_FILTER_ENABLED=true ports: - 8080:8080 volumes: - ${LOCAL_VIVO_HOME}:/opt/vivo/home - networks: - - vivo depends_on: - solr - -networks: - vivo: + networks: + - net diff --git a/installer/webapp/src/main/webResources/META-INF/context.xml b/installer/webapp/src/main/webResources/META-INF/context.xml index ea94491337..5fdc5b413f 100644 --- a/installer/webapp/src/main/webResources/META-INF/context.xml +++ b/installer/webapp/src/main/webResources/META-INF/context.xml @@ -1,5 +1,13 @@ + + + - - diff --git a/pom.xml b/pom.xml index c9b8c142da..37b661096d 100644 --- a/pom.xml +++ b/pom.xml @@ -52,8 +52,10 @@ vivo - ${project.version} ${basedir} + vivo_root@mydomain.edu + http://vivo.mydomain.edu/individual/ + ${project.version} yyyy-MM-dd HH:mm:ss ${maven.build.timestamp} false diff --git a/start.sh b/start.sh index 692c5b99b4..d4d050bc34 100644 --- a/start.sh +++ b/start.sh @@ -2,6 +2,8 @@ set -e +printenv + # allow easier debugging with `docker run -e VERBOSE=yes` if [[ "$VERBOSE" = "yes" ]]; then set -x @@ -9,43 +11,86 @@ fi # allow easier reset home with `docker run -e RESET_HOME=true` if [[ "$RESET_HOME" = "true" ]]; then - echo 'Clearing VIVO HOME /opt/vivo/home' - rm -rf /opt/vivo/home/* + echo 'Clearing VIVO HOME $VIVO_HOME_DIR' + rm -rf $VIVO_HOME_DIR/* fi -# ensure home config directory exists -mkdir -p /opt/vivo/home/config +# ensure home config directory exists +mkdir -p $VIVO_HOME_DIR/config + +# load sample data +if [[ "$LOAD_SAMPLE_DATA" = "true" ]]; then + echo "Cloning sample-data branch $SAMPLE_DATA_BRANCH from $SAMPLE_DATA_REPO_URL" + git clone --branch $SAMPLE_DATA_BRANCH $SAMPLE_DATA_REPO_URL sample-data > /dev/null + + # ensure home rdf directory exists + mkdir -p $VIVO_HOME_DIR/rdf -# generate digest.md5 for existing VIVO home if not already exist -if [ ! -f /opt/vivo/home/digest.md5 ]; then - find /opt/vivo/home -type f | grep -E '^/opt/vivo/home/bin/|^/opt/vivo/home/config/|^/opt/vivo/home/rdf/' | xargs md5sum > /opt/vivo/home/digest.md5 - echo "Generated digest.md5 for VIVO home" - cat /opt/vivo/home/digest.md5 + echo "Loading $SAMPLE_DATA_DIRECTORY/*" + cp -r sample-data/$SAMPLE_DATA_DIRECTORY/* $VIVO_HOME_DIR/rdf/. fi # only move runtime.properties first time and if it does not already exist in target home directory -if [ -f /runtime.properties ]; then - # template runtime.properties vitro.local.solr.url value to $SOLR_URL value - echo "Templating runtime.properties vitro.local.solr.url = $SOLR_URL" - sed -i "s,http://localhost:8983/solr/vivocore,$SOLR_URL,g" /runtime.properties - - if [ ! -f /opt/vivo/home/config/runtime.properties ] +if [ -f /tmp/runtime.properties ]; then + if [ ! -f $VIVO_HOME_DIR/config/runtime.properties ] then - echo "First time: moving /runtime.properties to /opt/vivo/home/config/runtime.properties" - mv -n /runtime.properties /opt/vivo/home/config/runtime.properties + # template runtime.properties + + echo "Templating runtime.properties vitro.local.solr.url = $SOLR_URL" + sed -i "s,vitro.local.solr.url = http://localhost:8983/solr/vivocore,vitro.local.solr.url = $SOLR_URL,g" /tmp/runtime.properties + + echo "Templating runtime.properties selfEditing.idMatchingProperty = $SELF_ID_MATCHING_PROPERTY" + sed -i "s,selfEditing.idMatchingProperty = http://vivo.mydomain.edu/ns#networkId,selfEditing.idMatchingProperty = $SELF_ID_MATCHING_PROPERTY,g" /tmp/runtime.properties + + if [[ ! -z "${EMAIL_SMTP_HOST}" ]]; then + echo "Templating runtime.properties email.smtpHost = $EMAIL_SMTP_HOST" + sed -i "s, # email.smtpHost = smtp.mydomain.edu,email.smtpHost = $EMAIL_SMTP_HOST,g" /tmp/runtime.properties + fi + if [[ ! -z "${EMAIL_PORT}" ]]; then + echo "Templating runtime.properties email.port = $EMAIL_PORT" + sed -i "s, # email.port = 25 or 587,email.port = $EMAIL_PORT,g" /tmp/runtime.properties + fi + if [[ ! -z "${EMAIL_USERNAME}" ]]; then + echo "Templating runtime.properties email.username = $EMAIL_USERNAME" + sed -i "s, # email.username = vivtroAdmin@mydomain.edu,email.username = $EMAIL_USERNAME,g" /tmp/runtime.properties + fi + if [[ ! -z "${EMAIL_PASSWORD}" ]]; then + echo "Templating runtime.properties email.password = ***" + sed -i "s, # email.password = secret,email.password = $EMAIL_PASSWORD,g" /tmp/runtime.properties + fi + if [[ ! -z "${EMAIL_REPLY_TO}" ]]; then + echo "Templating runtime.properties email.replyTo = $EMAIL_REPLY_TO" + sed -i "s, # email.replyTo = vitroAdmin@mydomain.edu,email.replyTo = $EMAIL_REPLY_TO,g" /tmp/runtime.properties + fi + + if [[ ! -z "${LANGUAGE_FILTER_ENABLED}" ]]; then + echo "Templating runtime.properties RDFService.languageFilter = $LANGUAGE_FILTER_ENABLED" + sed -i "s,# RDFService.languageFilter = false,RDFService.languageFilter = $LANGUAGE_FILTER_ENABLED,g" /tmp/runtime.properties + fi + if [[ ! -z "${FORCE_LOCALE}" ]]; then + echo "Templating runtime.properties languages.forceLocale = $FORCE_LOCALE" + sed -i "s,# languages.forceLocale = en_US,languages.forceLocale = $FORCE_LOCALE,g" /tmp/runtime.properties + fi + if [[ ! -z "${SELECTABLE_LOCALES}" ]]; then + echo "Templating runtime.properties languages.selectableLocales = $SELECTABLE_LOCALES" + sed -i "s/# languages.selectableLocales = en_US, es_GO/languages.selectableLocales = $SELECTABLE_LOCALES/g" /tmp/runtime.properties + fi + + echo "First time: moving /tmp/runtime.properties to /$VIVO_HOME_DIR/config/runtime.properties" + mv -n /tmp/runtime.properties $VIVO_HOME_DIR/config/runtime.properties else - echo "Using existing /opt/vivo/home/config/runtime.properties" + echo "Using existing $VIVO_HOME_DIR/config/runtime.properties" fi fi # only move applicationSetup.n3 first time and if it does not already exist in target home directory -if [ -f /applicationSetup.n3 ]; then - if [ ! -f /opt/vivo/home/config/applicationSetup.n3 ] +if [ -f /tmp/applicationSetup.n3 ]; then + if [ ! -f $VIVO_HOME_DIR/config/applicationSetup.n3 ] then - echo "First time: moving /applicationSetup.n3 to /opt/vivo/home/config/applicationSetup.n3" - mv -n /applicationSetup.n3 /opt/vivo/home/config/applicationSetup.n3 + echo "First time: moving /tmp/applicationSetup.n3 to $VIVO_HOME_DIR/config/applicationSetup.n3" + mv -n /tmp/applicationSetup.n3 $VIVO_HOME_DIR/config/applicationSetup.n3 else - echo "Using existing /opt/vivo/home/config/applicationSetup.n3" + echo "Using existing $VIVO_HOME_DIR/config/applicationSetup.n3" fi fi From 70d029c2b3462846645f393ff6e773caf4f38549 Mon Sep 17 00:00:00 2001 From: William Welling Date: Wed, 1 Mar 2023 08:08:31 -0600 Subject: [PATCH 04/18] Update VIVO Dependencies GitHub branch reference --- installer/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installer/pom.xml b/installer/pom.xml index 2d563d86e6..758760cf31 100644 --- a/installer/pom.xml +++ b/installer/pom.xml @@ -198,7 +198,7 @@ vivo-dependencies VIVO Dependencies - https://raw.github.com/vivo-project/dependencies/master/ + https://raw.github.com/vivo-project/dependencies/main/ sonatype-nexus-snapshots From 20e879989781cbb564a5a7b7a8bfc26288756d09 Mon Sep 17 00:00:00 2001 From: William Welling Date: Wed, 1 Mar 2023 08:11:31 -0600 Subject: [PATCH 05/18] Use app-name variable for log file naming --- .../src/main/webResources/WEB-INF/classes/log4j.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installer/webapp/src/main/webResources/WEB-INF/classes/log4j.properties b/installer/webapp/src/main/webResources/WEB-INF/classes/log4j.properties index 3c4d7c95cb..dcf4b59502 100644 --- a/installer/webapp/src/main/webResources/WEB-INF/classes/log4j.properties +++ b/installer/webapp/src/main/webResources/WEB-INF/classes/log4j.properties @@ -24,7 +24,7 @@ # debug.log4j.properties exists will be used instead, if it exists, but is not stored in Subversion. log4j.appender.AllAppender=org.apache.log4j.RollingFileAppender -log4j.appender.AllAppender.File= ${catalina.base}/logs/vivo.all.log +log4j.appender.AllAppender.File= ${catalina.base}/logs/${app-name}.all.log log4j.appender.AllAppender.MaxFileSize=10MB log4j.appender.AllAppender.MaxBackupIndex=10 log4j.appender.AllAppender.layout=org.apache.log4j.PatternLayout From 687f27fd5543a8c58cfa15a3e0c7c0da5aa59a69 Mon Sep 17 00:00:00 2001 From: William Welling Date: Wed, 1 Mar 2023 08:26:34 -0600 Subject: [PATCH 06/18] Update README to build using package --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ee50b9f616..a8c28c74ce 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ Before building VIVO, you will also need to clone (and switch to the same branch Build and start VIVO. ``` -mvn clean install +mvn clean package docker-compose up ``` From f504b4377491c587b3c72c3bdeccc5a507d194ee Mon Sep 17 00:00:00 2001 From: William Welling Date: Wed, 1 Mar 2023 09:15:00 -0600 Subject: [PATCH 07/18] Cleanup and README updates --- Dockerfile | 20 +++++--------- README.md | 66 +++++++++++++++++++++++++++++++++++++++++++--- docker-compose.yml | 8 +----- 3 files changed, 70 insertions(+), 24 deletions(-) diff --git a/Dockerfile b/Dockerfile index 839b97a86a..b21d985934 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,25 +14,17 @@ ARG TDB_FILE_MODE=direct ARG ROOT_USER_ADDRESS=vivo_root@mydomain.edu ARG DEFAULT_NAMESPACE=http://vivo.mydomain.edu/individual/ -ARG SOLR_URL=http://localhost:8983/solr/vivocore -ARG SELF_ID_MATCHING_PROPERTY=http://vivo.mydomain.edu/ns - -ARG LOAD_SAMPLE_DATA=false -ARG SAMPLE_DATA_REPO_URL=https://github.com/vivo-project/sample-data.git -ARG SAMPLE_DATA_BRANCH=main -ARG SAMPLE_DATA_DIRECTORY=openvivo - ENV JAVA_OPTS="${JAVA_OPTS} -Dvivo-dir=$VIVO_HOME_DIR -Droot-user-address=$ROOT_USER_ADDRESS -Ddefault-namespace=$DEFAULT_NAMESPACE -Dtdb:fileMode=$TDB_FILE_MODE" ENV VIVO_HOME_DIR=${VIVO_HOME_DIR} -ENV SOLR_URL=${SOLR_URL} -ENV SELF_ID_MATCHING_PROPERTY=${SELF_ID_MATCHING_PROPERTY} +ENV SOLR_URL=http://localhost:8983/solr/vivocore +ENV SELF_ID_MATCHING_PROPERTY=http://vivo.mydomain.edu/ns -ENV LOAD_SAMPLE_DATA=${LOAD_SAMPLE_DATA} -ENV SAMPLE_DATA_REPO_URL=${SAMPLE_DATA_REPO_URL} -ENV SAMPLE_DATA_BRANCH=${SAMPLE_DATA_BRANCH} -ENV SAMPLE_DATA_DIRECTORY=${SAMPLE_DATA_DIRECTORY} +ENV LOAD_SAMPLE_DATA=false +ENV SAMPLE_DATA_REPO_URL=https://github.com/vivo-project/sample-data.git +ENV SAMPLE_DATA_BRANCH=main +ENV SAMPLE_DATA_DIRECTORY=openvivo RUN \ apt-get update -y && \ diff --git a/README.md b/README.md index a8c28c74ce..04cb77a423 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,59 @@ https://wiki.lyrasis.org/display/VIVODOC112x/Installing+VIVO ### Docker -VIVO docker container is available at [vivoweb/vivo](https://hub.docker.com/repository/docker/vivoweb/vivo) with accompanying [vivoweb/vivo-solr](https://hub.docker.com/repository/docker/vivoweb/vivo-solr). These can be used independently or with docker-compose. +VIVO docker container is available at [vivoweb/vivo](https://hub.docker.com/r/vivoweb/vivo) with accompanying [vivoweb/vivo-solr](https://hub.docker.com/r/vivoweb/vivo-solr). These can be used independently or with docker-compose. + +#### Build Args + +Build args are used at time of building the Docker image. Some of the build args are passed to environment variables to be available to the running container. + +| Variable | Description | Default | +| ----------------------------- | -----------------------------| ------------------------------------ | +| TOMCAT_CONTEXT_PATH | Tomcat webapp context path | ROOT | +| USER_ID | User id | 3001 | +| USER_NAME | User name | vivo | +| USER_HOME_DIR | User home directory | /home/vivo | +| VIVO_HOME_DIR | VIVO home directory | /opt/vivo/home | +| TDB_FILE_MODE | TDB file mode | direct | +| ROOT_USER_ADDRESS | Root user email address | vivo_root@mydomain.edu | +| DEFAULT_NAMESPACE | Default namespace | http://vivo.mydomain.edu/individual/ | + +#### Environment + +| Variable | Description | Default | +| ----------------------------- | ---------------------------------------------------------------- | ----------------------------------------------- | +| VIVO_HOME_DIR | VIVO Home directory in container | /opt/vivo/home | +| SOLR_URL | VIVO Solr URL | http://localhost:8983/solr/vivocore | +| SELF_ID_MATCHING_PROPERTY | Individual property associated with user account | http://vivo.mydomain.edu/ns#networkId | +| EMAIL_SMTP_HOST | Email SMTP host | not defined | +| EMAIL_PORT | Email server port | not defined | +| EMAIL_USERNAME | Email server username | not defined | +| EMAIL_PASSWORD | Email server password | not defined | +| EMAIL_REPLY_TO | Reply to email address | not defined | +| LANGUAGE_FILTER_ENABLED | Enable language filter to respect browser Accept-Language header | not defined | +| FORCE_LOCALE | Ignore browser Accept-Language header | not defined | +| SELECTABLE_LOCALES | Selectable locales | not defined | +| LOAD_SAMPLE_DATA | Load sample data | false | +| SAMPLE_DATA_REPO_URL | Sample data GitHub repository | https://github.com/vivo-project/sample-data.git | +| SAMPLE_DATA_BRANCH | Sample data GitHub repository branch | main | +| SAMPLE_DATA_DIRECTORY | Sample data direcotyr | openvivo | + +#### Running VIVO from published Docker images. + +Create a docker [network](https://docs.docker.com/engine/reference/commandline/network_create/). +``` +docker network create vivo_net +``` + +Run vivo-solr [detached](https://docs.docker.com/engine/reference/run/#detached-vs-foreground) with [port forwarding](https://docs.docker.com/engine/reference/run/#expose-incoming-ports) and on a above [network](https://docs.docker.com/engine/reference/run/#network-settings). +``` +docker run -d -p 8983:8983 --hostname solr --network vivo_net vivoweb/vivo-solr +``` + +Run vivo with [port forwarding](https://docs.docker.com/engine/reference/run/#expose-incoming-ports), on a above [network](https://docs.docker.com/engine/reference/run/#network-settings), defining Solr URL [environment variable](https://docs.docker.com/engine/reference/run/#env-environment-variables), and local [volume](https://docs.docker.com/engine/reference/run/#volume-shared-filesystems) mounted to VIVO home directory. +``` +docker run -p 8080:8080 --network vivo_net -e "SOLR_URL=http://solr:8983/solr/vivocore" -v "./vivo-home:/opt/vivo/home" vivoweb/vivo +``` ### Docker Compose @@ -31,14 +83,22 @@ Docker Compose environment variables: .env defaults ``` +LOCAL_SOLR_DATA=./vivo-solr +RESET_CORE=false + LOCAL_VIVO_HOME=./vivo-home RESET_HOME=false -RESET_CORE=false + +VERBOSE=no ``` +- `LOCAL_VIVO_HOME`: VIVO Solr data directory on your host machine which will mount to volume in Solr docker container. Set this environment variable to persist your VIVO Solr data on your host machine. +- `RESET_CORE`: Convenience to reset VIVO Solr core when starting container. **Caution**, will require complete reindex. + - `LOCAL_VIVO_HOME`: VIVO home directory on your host machine which will mount to volume in docker container. Set this environment variable to persist your VIVO data on your host machine. - `RESET_HOME`: Convenience to reset VIVO home when starting container. **Caution**, will delete local configuration, content, and configuration model. -- `RESET_CORE`: Convenience to reset VIVO Solr core when starting container. **Caution**, will require complete reindex. + +Build and start VIVO using Docker Compose. Before building VIVO, you will also need to clone (and switch to the same branch, if other than main) of [Vitro](https://github.com/vivo-project/Vitro). The Vitro project must be cloned to a sibling directory next to VIVO so that it can be found during the build. diff --git a/docker-compose.yml b/docker-compose.yml index 487b502ad4..fa01964d6d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -27,17 +27,11 @@ services: args: - VIVO_HOME_DIR=/opt/vivo/home - TDB_FILE_MODE=direct - - SOLR_URL=http://solr:8983/solr/vivocore - TOMCAT_CONTEXT_PATH=ROOT - - LOAD_SAMPLE_DATA=true - - SAMPLE_DATA_REPO_URL=https://github.com/chenejac/sample-data.git - - SAMPLE_DATA_BRANCH=reorganization - - SAMPLE_DATA_DIRECTORY=i18n environment: - RESET_HOME=${RESET_HOME} - VERBOSE=${VERBOSE} - - SELECTABLE_LOCALES=en_US,de_DE,sr_Latn_RS,ru_RU,fr_CA,en_CA,es,pt_BR - - LANGUAGE_FILTER_ENABLED=true + - SOLR_URL=http://solr:8983/solr/vivocore ports: - 8080:8080 volumes: From 70bc159584bf5472ed87d2276ec6f882a547febf Mon Sep 17 00:00:00 2001 From: William Welling Date: Wed, 1 Mar 2023 10:12:49 -0600 Subject: [PATCH 08/18] Environment variables added to java opts on start --- Dockerfile | 12 ++++-------- README.md | 11 +++++------ docker-compose.yml | 4 ---- .../src/main/webResources/META-INF/context.xml | 18 +++++++++--------- start.sh | 2 ++ 5 files changed, 20 insertions(+), 27 deletions(-) diff --git a/Dockerfile b/Dockerfile index b21d985934..d72f0a806b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,14 +9,10 @@ ARG USER_ID ARG USER_NAME ARG USER_HOME_DIR -ARG VIVO_HOME_DIR=/opt/vivo/home -ARG TDB_FILE_MODE=direct -ARG ROOT_USER_ADDRESS=vivo_root@mydomain.edu -ARG DEFAULT_NAMESPACE=http://vivo.mydomain.edu/individual/ - -ENV JAVA_OPTS="${JAVA_OPTS} -Dvivo-dir=$VIVO_HOME_DIR -Droot-user-address=$ROOT_USER_ADDRESS -Ddefault-namespace=$DEFAULT_NAMESPACE -Dtdb:fileMode=$TDB_FILE_MODE" - -ENV VIVO_HOME_DIR=${VIVO_HOME_DIR} +ENV VIVO_HOME_DIR=/opt/vivo/home +ENV TDB_FILE_MODE=direct +ENV ROOT_USER_ADDRESS=vivo_root@mydomain.edu +ENV DEFAULT_NAMESPACE=http://vivo.mydomain.edu/individual/ ENV SOLR_URL=http://localhost:8983/solr/vivocore ENV SELF_ID_MATCHING_PROPERTY=http://vivo.mydomain.edu/ns diff --git a/README.md b/README.md index 04cb77a423..fc52aecbbd 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ VIVO docker container is available at [vivoweb/vivo](https://hub.docker.com/r/vi #### Build Args -Build args are used at time of building the Docker image. Some of the build args are passed to environment variables to be available to the running container. +Build args are used at time of building the Docker image. | Variable | Description | Default | | ----------------------------- | -----------------------------| ------------------------------------ | @@ -35,16 +35,15 @@ Build args are used at time of building the Docker image. Some of the build args | USER_ID | User id | 3001 | | USER_NAME | User name | vivo | | USER_HOME_DIR | User home directory | /home/vivo | -| VIVO_HOME_DIR | VIVO home directory | /opt/vivo/home | -| TDB_FILE_MODE | TDB file mode | direct | -| ROOT_USER_ADDRESS | Root user email address | vivo_root@mydomain.edu | -| DEFAULT_NAMESPACE | Default namespace | http://vivo.mydomain.edu/individual/ | #### Environment | Variable | Description | Default | | ----------------------------- | ---------------------------------------------------------------- | ----------------------------------------------- | -| VIVO_HOME_DIR | VIVO Home directory in container | /opt/vivo/home | +| VIVO_HOME_DIR | VIVO home directory in container | /opt/vivo/home | +| TDB_FILE_MODE | TDB file mode | direct | +| ROOT_USER_ADDRESS | Root user email address | vivo_root@mydomain.edu | +| DEFAULT_NAMESPACE | Default namespace | http://vivo.mydomain.edu/individual/ | | SOLR_URL | VIVO Solr URL | http://localhost:8983/solr/vivocore | | SELF_ID_MATCHING_PROPERTY | Individual property associated with user account | http://vivo.mydomain.edu/ns#networkId | | EMAIL_SMTP_HOST | Email SMTP host | not defined | diff --git a/docker-compose.yml b/docker-compose.yml index fa01964d6d..9ad4e9b26d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -24,10 +24,6 @@ services: build: context: ./ dockerfile: Dockerfile - args: - - VIVO_HOME_DIR=/opt/vivo/home - - TDB_FILE_MODE=direct - - TOMCAT_CONTEXT_PATH=ROOT environment: - RESET_HOME=${RESET_HOME} - VERBOSE=${VERBOSE} diff --git a/installer/webapp/src/main/webResources/META-INF/context.xml b/installer/webapp/src/main/webResources/META-INF/context.xml index 5fdc5b413f..43ee046e97 100644 --- a/installer/webapp/src/main/webResources/META-INF/context.xml +++ b/installer/webapp/src/main/webResources/META-INF/context.xml @@ -4,9 +4,9 @@ # The name of the application (possibly not used). --> + type="java.lang.String" + name="vitro/appName" + value="${app-name}" override="true"/> + type="java.lang.String" + name="vitro/rootUserAddress" + value="${root-user-address}" override="true"/> + type="java.lang.String" + name="vitro/defaultNamespace" + value="${default-namespace}" override="true"/> diff --git a/start.sh b/start.sh index d4d050bc34..cca1835468 100644 --- a/start.sh +++ b/start.sh @@ -94,6 +94,8 @@ if [ -f /tmp/applicationSetup.n3 ]; then fi fi +export JAVA_OPTS="${JAVA_OPTS} -Dvivo-dir=$VIVO_HOME_DIR -Droot-user-address=$ROOT_USER_ADDRESS -Ddefault-namespace=$DEFAULT_NAMESPACE -Dtdb:fileMode=$TDB_FILE_MODE" + echo "Giving time for Solr to startup..." sleep 15 echo "Starting Tomcat" From 3b6cde3e42c9e8818a722d8eebb33027a520b739 Mon Sep 17 00:00:00 2001 From: William Welling Date: Wed, 1 Mar 2023 10:45:19 -0600 Subject: [PATCH 09/18] Afford reconfigure on restart --- Dockerfile | 2 + README.md | 3 +- docker-compose.yml | 6 +++ start.sh | 116 ++++++++++++++++++++++----------------------- 4 files changed, 66 insertions(+), 61 deletions(-) diff --git a/Dockerfile b/Dockerfile index d72f0a806b..96b2452d64 100644 --- a/Dockerfile +++ b/Dockerfile @@ -22,6 +22,8 @@ ENV SAMPLE_DATA_REPO_URL=https://github.com/vivo-project/sample-data.git ENV SAMPLE_DATA_BRANCH=main ENV SAMPLE_DATA_DIRECTORY=openvivo +ENV RECONFIGURE=false + RUN \ apt-get update -y && \ apt-get upgrade -y && \ diff --git a/README.md b/README.md index fc52aecbbd..fb5f159667 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,8 @@ Build args are used at time of building the Docker image. | LOAD_SAMPLE_DATA | Load sample data | false | | SAMPLE_DATA_REPO_URL | Sample data GitHub repository | https://github.com/vivo-project/sample-data.git | | SAMPLE_DATA_BRANCH | Sample data GitHub repository branch | main | -| SAMPLE_DATA_DIRECTORY | Sample data direcotyr | openvivo | +| SAMPLE_DATA_DIRECTORY | Sample data directory | openvivo | +| RECONFIGURE | Whether to update runtime properties and application setup | false | #### Running VIVO from published Docker images. diff --git a/docker-compose.yml b/docker-compose.yml index 9ad4e9b26d..2b02fafff7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -28,6 +28,12 @@ services: - RESET_HOME=${RESET_HOME} - VERBOSE=${VERBOSE} - SOLR_URL=http://solr:8983/solr/vivocore + - LANGUAGE_FILTER_ENABLED=true + - SELECTABLE_LOCALES=en_US,de_DE,sr_Latn_RS,ru_RU,fr_CA,en_CA,es,pt_BR + - LOAD_SAMPLE_DATA=true + - SAMPLE_DATA_REPO_URL=https://github.com/chenejac/sample-data.git + - SAMPLE_DATA_BRANCH=reorganization + - SAMPLE_DATA_DIRECTORY=i18n ports: - 8080:8080 volumes: diff --git a/start.sh b/start.sh index cca1835468..c1c4873e40 100644 --- a/start.sh +++ b/start.sh @@ -19,7 +19,7 @@ fi mkdir -p $VIVO_HOME_DIR/config # load sample data -if [[ "$LOAD_SAMPLE_DATA" = "true" ]]; then +if [[ "$RESET_HOME" = "true" ]] && [[ "$LOAD_SAMPLE_DATA" = "true" ]]; then echo "Cloning sample-data branch $SAMPLE_DATA_BRANCH from $SAMPLE_DATA_REPO_URL" git clone --branch $SAMPLE_DATA_BRANCH $SAMPLE_DATA_REPO_URL sample-data > /dev/null @@ -30,68 +30,64 @@ if [[ "$LOAD_SAMPLE_DATA" = "true" ]]; then cp -r sample-data/$SAMPLE_DATA_DIRECTORY/* $VIVO_HOME_DIR/rdf/. fi -# only move runtime.properties first time and if it does not already exist in target home directory -if [ -f /tmp/runtime.properties ]; then - if [ ! -f $VIVO_HOME_DIR/config/runtime.properties ] - then - # template runtime.properties - - echo "Templating runtime.properties vitro.local.solr.url = $SOLR_URL" - sed -i "s,vitro.local.solr.url = http://localhost:8983/solr/vivocore,vitro.local.solr.url = $SOLR_URL,g" /tmp/runtime.properties - - echo "Templating runtime.properties selfEditing.idMatchingProperty = $SELF_ID_MATCHING_PROPERTY" - sed -i "s,selfEditing.idMatchingProperty = http://vivo.mydomain.edu/ns#networkId,selfEditing.idMatchingProperty = $SELF_ID_MATCHING_PROPERTY,g" /tmp/runtime.properties - - if [[ ! -z "${EMAIL_SMTP_HOST}" ]]; then - echo "Templating runtime.properties email.smtpHost = $EMAIL_SMTP_HOST" - sed -i "s, # email.smtpHost = smtp.mydomain.edu,email.smtpHost = $EMAIL_SMTP_HOST,g" /tmp/runtime.properties - fi - if [[ ! -z "${EMAIL_PORT}" ]]; then - echo "Templating runtime.properties email.port = $EMAIL_PORT" - sed -i "s, # email.port = 25 or 587,email.port = $EMAIL_PORT,g" /tmp/runtime.properties - fi - if [[ ! -z "${EMAIL_USERNAME}" ]]; then - echo "Templating runtime.properties email.username = $EMAIL_USERNAME" - sed -i "s, # email.username = vivtroAdmin@mydomain.edu,email.username = $EMAIL_USERNAME,g" /tmp/runtime.properties - fi - if [[ ! -z "${EMAIL_PASSWORD}" ]]; then - echo "Templating runtime.properties email.password = ***" - sed -i "s, # email.password = secret,email.password = $EMAIL_PASSWORD,g" /tmp/runtime.properties - fi - if [[ ! -z "${EMAIL_REPLY_TO}" ]]; then - echo "Templating runtime.properties email.replyTo = $EMAIL_REPLY_TO" - sed -i "s, # email.replyTo = vitroAdmin@mydomain.edu,email.replyTo = $EMAIL_REPLY_TO,g" /tmp/runtime.properties - fi - - if [[ ! -z "${LANGUAGE_FILTER_ENABLED}" ]]; then - echo "Templating runtime.properties RDFService.languageFilter = $LANGUAGE_FILTER_ENABLED" - sed -i "s,# RDFService.languageFilter = false,RDFService.languageFilter = $LANGUAGE_FILTER_ENABLED,g" /tmp/runtime.properties - fi - if [[ ! -z "${FORCE_LOCALE}" ]]; then - echo "Templating runtime.properties languages.forceLocale = $FORCE_LOCALE" - sed -i "s,# languages.forceLocale = en_US,languages.forceLocale = $FORCE_LOCALE,g" /tmp/runtime.properties - fi - if [[ ! -z "${SELECTABLE_LOCALES}" ]]; then - echo "Templating runtime.properties languages.selectableLocales = $SELECTABLE_LOCALES" - sed -i "s/# languages.selectableLocales = en_US, es_GO/languages.selectableLocales = $SELECTABLE_LOCALES/g" /tmp/runtime.properties - fi - - echo "First time: moving /tmp/runtime.properties to /$VIVO_HOME_DIR/config/runtime.properties" - mv -n /tmp/runtime.properties $VIVO_HOME_DIR/config/runtime.properties - else - echo "Using existing $VIVO_HOME_DIR/config/runtime.properties" +# only move runtime.properties if it does not already exist in target home directory or reconfigure env variable true +if [ ! -f $VIVO_HOME_DIR/config/runtime.properties ] || [[ "$RECONFIGURE" = "true" ]] +then + # template runtime.properties + + echo "Templating runtime.properties vitro.local.solr.url = $SOLR_URL" + sed -i "s,vitro.local.solr.url = http://localhost:8983/solr/vivocore,vitro.local.solr.url = $SOLR_URL,g" /tmp/runtime.properties + + echo "Templating runtime.properties selfEditing.idMatchingProperty = $SELF_ID_MATCHING_PROPERTY" + sed -i "s,selfEditing.idMatchingProperty = http://vivo.mydomain.edu/ns#networkId,selfEditing.idMatchingProperty = $SELF_ID_MATCHING_PROPERTY,g" /tmp/runtime.properties + + if [[ ! -z "${EMAIL_SMTP_HOST}" ]]; then + echo "Templating runtime.properties email.smtpHost = $EMAIL_SMTP_HOST" + sed -i "s, # email.smtpHost = smtp.mydomain.edu,email.smtpHost = $EMAIL_SMTP_HOST,g" /tmp/runtime.properties + fi + if [[ ! -z "${EMAIL_PORT}" ]]; then + echo "Templating runtime.properties email.port = $EMAIL_PORT" + sed -i "s, # email.port = 25 or 587,email.port = $EMAIL_PORT,g" /tmp/runtime.properties + fi + if [[ ! -z "${EMAIL_USERNAME}" ]]; then + echo "Templating runtime.properties email.username = $EMAIL_USERNAME" + sed -i "s, # email.username = vivtroAdmin@mydomain.edu,email.username = $EMAIL_USERNAME,g" /tmp/runtime.properties + fi + if [[ ! -z "${EMAIL_PASSWORD}" ]]; then + echo "Templating runtime.properties email.password = ***" + sed -i "s, # email.password = secret,email.password = $EMAIL_PASSWORD,g" /tmp/runtime.properties + fi + if [[ ! -z "${EMAIL_REPLY_TO}" ]]; then + echo "Templating runtime.properties email.replyTo = $EMAIL_REPLY_TO" + sed -i "s, # email.replyTo = vitroAdmin@mydomain.edu,email.replyTo = $EMAIL_REPLY_TO,g" /tmp/runtime.properties fi -fi -# only move applicationSetup.n3 first time and if it does not already exist in target home directory -if [ -f /tmp/applicationSetup.n3 ]; then - if [ ! -f $VIVO_HOME_DIR/config/applicationSetup.n3 ] - then - echo "First time: moving /tmp/applicationSetup.n3 to $VIVO_HOME_DIR/config/applicationSetup.n3" - mv -n /tmp/applicationSetup.n3 $VIVO_HOME_DIR/config/applicationSetup.n3 - else - echo "Using existing $VIVO_HOME_DIR/config/applicationSetup.n3" + if [[ ! -z "${LANGUAGE_FILTER_ENABLED}" ]]; then + echo "Templating runtime.properties RDFService.languageFilter = $LANGUAGE_FILTER_ENABLED" + sed -i "s,# RDFService.languageFilter = false,RDFService.languageFilter = $LANGUAGE_FILTER_ENABLED,g" /tmp/runtime.properties + fi + if [[ ! -z "${FORCE_LOCALE}" ]]; then + echo "Templating runtime.properties languages.forceLocale = $FORCE_LOCALE" + sed -i "s,# languages.forceLocale = en_US,languages.forceLocale = $FORCE_LOCALE,g" /tmp/runtime.properties + fi + if [[ ! -z "${SELECTABLE_LOCALES}" ]]; then + echo "Templating runtime.properties languages.selectableLocales = $SELECTABLE_LOCALES" + sed -i "s/# languages.selectableLocales = en_US, es_GO/languages.selectableLocales = $SELECTABLE_LOCALES/g" /tmp/runtime.properties fi + + echo "Copying /tmp/runtime.properties to /$VIVO_HOME_DIR/config/runtime.properties" + cp -r /tmp/runtime.properties $VIVO_HOME_DIR/config/runtime.properties +else + echo "Using existing $VIVO_HOME_DIR/config/runtime.properties" +fi + +# only move applicationSetup.n3 if it does not already exist in target home directory or reconfigure env variable true +if [ ! -f $VIVO_HOME_DIR/config/applicationSetup.n3 ] || [[ "$RECONFIGURE" = "true" ]] +then + echo "Copying /tmp/applicationSetup.n3 to $VIVO_HOME_DIR/config/applicationSetup.n3" + cp -r /tmp/applicationSetup.n3 $VIVO_HOME_DIR/config/applicationSetup.n3 +else + echo "Using existing $VIVO_HOME_DIR/config/applicationSetup.n3" fi export JAVA_OPTS="${JAVA_OPTS} -Dvivo-dir=$VIVO_HOME_DIR -Droot-user-address=$ROOT_USER_ADDRESS -Ddefault-namespace=$DEFAULT_NAMESPACE -Dtdb:fileMode=$TDB_FILE_MODE" From e14d58cad9b7cfb7d279a1c8c9b9becfca504142 Mon Sep 17 00:00:00 2001 From: William Welling Date: Wed, 1 Mar 2023 11:06:39 -0600 Subject: [PATCH 10/18] Switch to /usr/local/vivo/home for default VIVO home --- Dockerfile | 6 +++--- README.md | 2 +- docker-compose.yml | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 96b2452d64..eade7ee175 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,7 +9,7 @@ ARG USER_ID ARG USER_NAME ARG USER_HOME_DIR -ENV VIVO_HOME_DIR=/opt/vivo/home +ENV VIVO_HOME_DIR=/usr/local/vivo/home ENV TDB_FILE_MODE=direct ENV ROOT_USER_ADDRESS=vivo_root@mydomain.edu ENV DEFAULT_NAMESPACE=http://vivo.mydomain.edu/individual/ @@ -40,8 +40,8 @@ COPY ./installer/webapp/target/vivo.war /usr/local/tomcat/webapps/$TOMCAT_CONTEX COPY ./home/src/main/resources/config/default.applicationSetup.n3 /tmp/applicationSetup.n3 COPY ./home/src/main/resources/config/default.runtime.properties /tmp/runtime.properties -COPY start.sh /opt/vivo/start.sh +COPY start.sh /usr/local/vivo/start.sh EXPOSE 8080 -CMD ["/bin/bash", "/opt/vivo/start.sh"] +CMD ["/bin/bash", "/usr/local/vivo/start.sh"] diff --git a/README.md b/README.md index fb5f159667..4ea4970200 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ Build args are used at time of building the Docker image. | Variable | Description | Default | | ----------------------------- | ---------------------------------------------------------------- | ----------------------------------------------- | -| VIVO_HOME_DIR | VIVO home directory in container | /opt/vivo/home | +| VIVO_HOME_DIR | VIVO home directory in container | /usr/local/vivo/home | | TDB_FILE_MODE | TDB file mode | direct | | ROOT_USER_ADDRESS | Root user email address | vivo_root@mydomain.edu | | DEFAULT_NAMESPACE | Default namespace | http://vivo.mydomain.edu/individual/ | diff --git a/docker-compose.yml b/docker-compose.yml index 2b02fafff7..db8ac54be3 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -37,7 +37,7 @@ services: ports: - 8080:8080 volumes: - - ${LOCAL_VIVO_HOME}:/opt/vivo/home + - ${LOCAL_VIVO_HOME}:/usr/local/vivo/home depends_on: - solr networks: From c9207a9218a710e18503779328665cc6cdd5d908 Mon Sep 17 00:00:00 2001 From: William Welling Date: Thu, 2 Mar 2023 08:12:34 -0600 Subject: [PATCH 11/18] Afford changing context path on restart --- Dockerfile | 11 +++-------- README.md | 2 +- start.sh | 2 ++ 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/Dockerfile b/Dockerfile index eade7ee175..004dd41a50 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,14 +1,9 @@ -ARG TOMCAT_CONTEXT_PATH=ROOT +FROM tomcat:9-jdk11-openjdk ARG USER_ID=3001 ARG USER_NAME=vivo ARG USER_HOME_DIR=/home/$USER_NAME -FROM tomcat:9-jdk11-openjdk -ARG TOMCAT_CONTEXT_PATH -ARG USER_ID -ARG USER_NAME -ARG USER_HOME_DIR - +ENV TOMCAT_CONTEXT_PATH=ROOT ENV VIVO_HOME_DIR=/usr/local/vivo/home ENV TDB_FILE_MODE=direct ENV ROOT_USER_ADDRESS=vivo_root@mydomain.edu @@ -35,7 +30,7 @@ RUN \ RUN mkdir -p $VIVO_HOME_DIR -COPY ./installer/webapp/target/vivo.war /usr/local/tomcat/webapps/$TOMCAT_CONTEXT_PATH.war +COPY ./installer/webapp/target/vivo.war /tmp/vivo.war COPY ./home/src/main/resources/config/default.applicationSetup.n3 /tmp/applicationSetup.n3 COPY ./home/src/main/resources/config/default.runtime.properties /tmp/runtime.properties diff --git a/README.md b/README.md index 4ea4970200..7a9683ea71 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,6 @@ Build args are used at time of building the Docker image. | Variable | Description | Default | | ----------------------------- | -----------------------------| ------------------------------------ | -| TOMCAT_CONTEXT_PATH | Tomcat webapp context path | ROOT | | USER_ID | User id | 3001 | | USER_NAME | User name | vivo | | USER_HOME_DIR | User home directory | /home/vivo | @@ -40,6 +39,7 @@ Build args are used at time of building the Docker image. | Variable | Description | Default | | ----------------------------- | ---------------------------------------------------------------- | ----------------------------------------------- | +| TOMCAT_CONTEXT_PATH | Tomcat webapp context path | ROOT | | VIVO_HOME_DIR | VIVO home directory in container | /usr/local/vivo/home | | TDB_FILE_MODE | TDB file mode | direct | | ROOT_USER_ADDRESS | Root user email address | vivo_root@mydomain.edu | diff --git a/start.sh b/start.sh index c1c4873e40..3a9107d9e8 100644 --- a/start.sh +++ b/start.sh @@ -90,6 +90,8 @@ else echo "Using existing $VIVO_HOME_DIR/config/applicationSetup.n3" fi +cp -r /tmp/vivo.war /usr/local/tomcat/webapps/$TOMCAT_CONTEXT_PATH.war + export JAVA_OPTS="${JAVA_OPTS} -Dvivo-dir=$VIVO_HOME_DIR -Droot-user-address=$ROOT_USER_ADDRESS -Ddefault-namespace=$DEFAULT_NAMESPACE -Dtdb:fileMode=$TDB_FILE_MODE" echo "Giving time for Solr to startup..." From 9b83c59b90dd84fd9a9a38ae8cd79ce336909af1 Mon Sep 17 00:00:00 2001 From: William Welling Date: Thu, 2 Mar 2023 12:29:35 -0600 Subject: [PATCH 12/18] Build digest on start to preserve existing VIVO home --- start.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/start.sh b/start.sh index 3a9107d9e8..73ace83bb5 100644 --- a/start.sh +++ b/start.sh @@ -18,6 +18,13 @@ fi # ensure home config directory exists mkdir -p $VIVO_HOME_DIR/config +# generate digest.md5 for existing VIVO home if not already exist +if [ ! -f $VIVO_HOME_DIR/digest.md5 ]; then + find $VIVO_HOME_DIR -type f | grep -E "^$VIVO_HOME_DIR/bin/|^$VIVO_HOME_DIR/config/|^$VIVO_HOME_DIR/rdf/" | xargs md5sum > $VIVO_HOME_DIR/digest.md5 + echo "Generated digest.md5 for VIVO home" + cat $VIVO_HOME_DIR/digest.md5 +fi + # load sample data if [[ "$RESET_HOME" = "true" ]] && [[ "$LOAD_SAMPLE_DATA" = "true" ]]; then echo "Cloning sample-data branch $SAMPLE_DATA_BRANCH from $SAMPLE_DATA_REPO_URL" From 3e78d45c2ae5bce3ec27e2c951ca517260718e8a Mon Sep 17 00:00:00 2001 From: William Welling Date: Fri, 3 Mar 2023 08:45:17 -0600 Subject: [PATCH 13/18] Switch back to /usr/local/vivo/home for default home directory --- Dockerfile | 6 +++--- start.sh | 28 ++++++++++++++-------------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/Dockerfile b/Dockerfile index ccfe74a7e9..be98e557c9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,14 +1,14 @@ FROM tomcat:9-jdk11-openjdk ARG SOLR_URL=http://localhost:8983/solr/vivocore -ARG VIVO_DIR=/opt/vivo/home +ARG VIVO_DIR=/usr/local/vivo/home ARG TDB_FILE_MODE=direct +ENV VIVO_DIR=${VIVO_DIR} ENV SOLR_URL=${SOLR_URL} ENV JAVA_OPTS="${JAVA_OPTS} -Dvivo-dir=$VIVO_DIR -Dtdb:fileMode=$TDB_FILE_MODE" -RUN mkdir /opt/vivo -RUN mkdir /opt/vivo/home +RUN mkdir -p $VIVO_DIR COPY ./installer/webapp/target/vivo.war /usr/local/tomcat/webapps/ROOT.war diff --git a/start.sh b/start.sh index 692c5b99b4..049fa447bb 100644 --- a/start.sh +++ b/start.sh @@ -9,18 +9,18 @@ fi # allow easier reset home with `docker run -e RESET_HOME=true` if [[ "$RESET_HOME" = "true" ]]; then - echo 'Clearing VIVO HOME /opt/vivo/home' - rm -rf /opt/vivo/home/* + echo 'Clearing VIVO HOME $VIVO_DIR' + rm -rf $VIVO_DIR/* fi # ensure home config directory exists -mkdir -p /opt/vivo/home/config +mkdir -p $VIVO_DIR/config # generate digest.md5 for existing VIVO home if not already exist -if [ ! -f /opt/vivo/home/digest.md5 ]; then - find /opt/vivo/home -type f | grep -E '^/opt/vivo/home/bin/|^/opt/vivo/home/config/|^/opt/vivo/home/rdf/' | xargs md5sum > /opt/vivo/home/digest.md5 +if [ ! -f $VIVO_DIR/digest.md5 ]; then + find $VIVO_DIR -type f | grep -E "^$VIVO_DIR/bin/|^$VIVO_DIR/config/|^$VIVO_DIR/rdf/" | xargs md5sum > $VIVO_DIR/digest.md5 echo "Generated digest.md5 for VIVO home" - cat /opt/vivo/home/digest.md5 + cat $VIVO_DIR/digest.md5 fi # only move runtime.properties first time and if it does not already exist in target home directory @@ -29,23 +29,23 @@ if [ -f /runtime.properties ]; then echo "Templating runtime.properties vitro.local.solr.url = $SOLR_URL" sed -i "s,http://localhost:8983/solr/vivocore,$SOLR_URL,g" /runtime.properties - if [ ! -f /opt/vivo/home/config/runtime.properties ] + if [ ! -f $VIVO_DIR/config/runtime.properties ] then - echo "First time: moving /runtime.properties to /opt/vivo/home/config/runtime.properties" - mv -n /runtime.properties /opt/vivo/home/config/runtime.properties + echo "First time: moving /runtime.properties to $VIVO_DIR/config/runtime.properties" + mv -n /runtime.properties $VIVO_DIR/config/runtime.properties else - echo "Using existing /opt/vivo/home/config/runtime.properties" + echo "Using existing $VIVO_DIR/config/runtime.properties" fi fi # only move applicationSetup.n3 first time and if it does not already exist in target home directory if [ -f /applicationSetup.n3 ]; then - if [ ! -f /opt/vivo/home/config/applicationSetup.n3 ] + if [ ! -f $VIVO_DIR/config/applicationSetup.n3 ] then - echo "First time: moving /applicationSetup.n3 to /opt/vivo/home/config/applicationSetup.n3" - mv -n /applicationSetup.n3 /opt/vivo/home/config/applicationSetup.n3 + echo "First time: moving /applicationSetup.n3 to $VIVO_DIR/config/applicationSetup.n3" + mv -n /applicationSetup.n3 $VIVO_DIR/config/applicationSetup.n3 else - echo "Using existing /opt/vivo/home/config/applicationSetup.n3" + echo "Using existing $VIVO_DIR/config/applicationSetup.n3" fi fi From 68cb8faf2ac40edaf19fd439224be919f7531380 Mon Sep 17 00:00:00 2001 From: William Welling Date: Fri, 3 Mar 2023 08:53:44 -0600 Subject: [PATCH 14/18] Update README.md --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 7a9683ea71..a42e6cc2be 100644 --- a/README.md +++ b/README.md @@ -54,12 +54,16 @@ Build args are used at time of building the Docker image. | LANGUAGE_FILTER_ENABLED | Enable language filter to respect browser Accept-Language header | not defined | | FORCE_LOCALE | Ignore browser Accept-Language header | not defined | | SELECTABLE_LOCALES | Selectable locales | not defined | +| RESET_CORE | Reset VIVO Solr core | false | +| RESET_HOME | Reset VIVO home directory | false | | LOAD_SAMPLE_DATA | Load sample data | false | | SAMPLE_DATA_REPO_URL | Sample data GitHub repository | https://github.com/vivo-project/sample-data.git | | SAMPLE_DATA_BRANCH | Sample data GitHub repository branch | main | | SAMPLE_DATA_DIRECTORY | Sample data directory | openvivo | | RECONFIGURE | Whether to update runtime properties and application setup | false | +> Both RESET_HOME and LOAD_SAMPLE_DATA must be true in order to load sample data. + #### Running VIVO from published Docker images. Create a docker [network](https://docs.docker.com/engine/reference/commandline/network_create/). From f23b0a2731a07e1625b374c3fe8d718648bb1529 Mon Sep 17 00:00:00 2001 From: William Welling Date: Fri, 3 Mar 2023 08:56:56 -0600 Subject: [PATCH 15/18] Update docker-compose.yml --- docker-compose.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index db8ac54be3..e1e74f61e0 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -9,8 +9,8 @@ services: image: vivoweb/vivo-solr:latest hostname: solr environment: - - RESET_CORE=${RESET_CORE} - VERBOSE=${VERBOSE} + - RESET_CORE=true ports: - 8983:8983 volumes: @@ -25,8 +25,8 @@ services: context: ./ dockerfile: Dockerfile environment: - - RESET_HOME=${RESET_HOME} - VERBOSE=${VERBOSE} + - RESET_HOME=true - SOLR_URL=http://solr:8983/solr/vivocore - LANGUAGE_FILTER_ENABLED=true - SELECTABLE_LOCALES=en_US,de_DE,sr_Latn_RS,ru_RU,fr_CA,en_CA,es,pt_BR From 87a424f25fa2651d2c05c368f885dcc636bef23a Mon Sep 17 00:00:00 2001 From: William Welling Date: Mon, 6 Mar 2023 08:17:11 -0600 Subject: [PATCH 16/18] Remove spurious whitespace in log4j.properties --- .../src/main/webResources/WEB-INF/classes/log4j.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installer/webapp/src/main/webResources/WEB-INF/classes/log4j.properties b/installer/webapp/src/main/webResources/WEB-INF/classes/log4j.properties index dcf4b59502..5cdfd31cd8 100644 --- a/installer/webapp/src/main/webResources/WEB-INF/classes/log4j.properties +++ b/installer/webapp/src/main/webResources/WEB-INF/classes/log4j.properties @@ -24,7 +24,7 @@ # debug.log4j.properties exists will be used instead, if it exists, but is not stored in Subversion. log4j.appender.AllAppender=org.apache.log4j.RollingFileAppender -log4j.appender.AllAppender.File= ${catalina.base}/logs/${app-name}.all.log +log4j.appender.AllAppender.File=${catalina.base}/logs/${app-name}.all.log log4j.appender.AllAppender.MaxFileSize=10MB log4j.appender.AllAppender.MaxBackupIndex=10 log4j.appender.AllAppender.layout=org.apache.log4j.PatternLayout From 72e946607ff431cfcc4088ff2d50adddb8aaa75b Mon Sep 17 00:00:00 2001 From: William Welling Date: Mon, 6 Mar 2023 08:19:50 -0600 Subject: [PATCH 17/18] Move wait for solr to docker-compose --- docker-compose.yml | 7 +++++++ start.sh | 4 ---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 17022507e9..6bc22b2b01 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -33,6 +33,13 @@ services: - vivo depends_on: - solr + entrypoint: + - /bin/bash + - '-c' + - | + while (! /dev/null 2>&1; do sleep 1; done; + sleep 5 + /start.sh networks: vivo: diff --git a/start.sh b/start.sh index 049fa447bb..aeee24b1b3 100644 --- a/start.sh +++ b/start.sh @@ -49,8 +49,4 @@ if [ -f /applicationSetup.n3 ]; then fi fi -echo "Giving time for Solr to startup..." -sleep 15 -echo "Starting Tomcat" - catalina.sh run From dd98a1da5b6c0538a5d73d1d51b9b978f43a7a16 Mon Sep 17 00:00:00 2001 From: William Welling Date: Mon, 6 Mar 2023 08:24:45 -0600 Subject: [PATCH 18/18] Update docker-compose.yml --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index f36ff866fd..bb82c74c0a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -48,4 +48,4 @@ services: - | while (! /dev/null 2>&1; do sleep 1; done; sleep 5 - /start.sh + /usr/local/vivo/start.sh