diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a2515869..09b5b3bd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -28,4 +28,4 @@ jobs: java-version: 11 - name: Maven Build - run: mvn clean package -s installer/example-settings.xml + run: mvn clean install diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 82012b89..84431d85 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -35,7 +35,7 @@ jobs: server-password: MAVEN_PASSWORD - name: Maven Deploy - run: mvn --batch-mode deploy -Pskip + run: 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 26a2cf4a..602ae6b1 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -32,7 +32,7 @@ jobs: java-version: 11 - name: Maven Build - run: mvn clean package -s installer/example-settings.xml + run: mvn clean install - name: Set up QEMU uses: docker/setup-qemu-action@v1 diff --git a/Dockerfile b/Dockerfile index 6632d8b3..ccfe74a7 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 3b7f6598..0deb596c 100644 --- a/README.md +++ b/README.md @@ -37,13 +37,13 @@ RESET_CORE=false ``` - `LOCAL_VIVO_HOME`: VIVO home directory on your host machine which will mount to volume in docker container. -- `RESET_HOME`: Convinience to reset VIVO home when starting container. **Caution**, will delete local configuration, content, and configuration model. -- `RESET_CORE`: Convinience to reset VIVO Solr core when starting container. **Caution**, will require complete reindex. +- `RESET_HOME`: Convinience to reset VIVO home when starting container. **Caution** will delete local configuration, content, and configuration model. +- `RESET_CORE`: Convinience to reset VIVO Solr core when starting container. **Caution** will require complete reindex. Build and start VIVO. ``` -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 d47dcf7d..e6386a71 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,7 +28,7 @@ services: ports: - 8080:8080 volumes: - - ${LOCAL_VIVO_HOME}:/usr/local/vivo/home + - ${LOCAL_VIVO_HOME}:/opt/vivo/home networks: - vivo 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 95% rename from home/src/main/resources/config/example.runtime.properties rename to home/src/main/resources/config/default.runtime.properties index e5a9da9d..6b6f8bf8 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 0007c79c..00000000 --- a/installer/example-settings.xml +++ /dev/null @@ -1,21 +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 059daab3..e57789a4 100644 --- a/installer/home/pom.xml +++ b/installer/home/pom.xml @@ -23,108 +23,24 @@ wilma - - - package - - vivo-dir - - - ${app-name} - - - maven-assembly-plugin - - - src/main/assembly/home.xml - - false - - - - package - - single - - - - - - - - - install - - vivo-dir - - - - - 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 6de97e21..34f447c0 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 2c966aa8..75ca4250 100644 --- a/installer/pom.xml +++ b/installer/pom.xml @@ -29,12 +29,6 @@ UTF-8 - - maven-install-plugin - - true - - org.apache.maven.plugins maven-gpg-plugin @@ -148,12 +142,6 @@ - - maven-dependency-plugin - - true - - maven-resources-plugin 2.6 @@ -177,60 +165,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) - - - - - - - - - - - skip - - - - org.apache.maven.plugins - maven-deploy-plugin - 2.8.2 - - true - - diff --git a/installer/webapp/pom.xml b/installer/webapp/pom.xml index 78973a34..68993625 100644 --- a/installer/webapp/pom.xml +++ b/installer/webapp/pom.xml @@ -19,117 +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 @@ -140,6 +32,75 @@ + + 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 + + + + org.vivoweb + vitro-languages-webapp-core + war + + + org.vivoweb + vivo-languages-webapp-core + 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 f4af100a..ea944913 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 @@ + + + + + + + + + + + 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 1d3c0c4a..17c0c8ff 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 0665c5f2..dfd2c427 100644 --- a/pom.xml +++ b/pom.xml @@ -56,6 +56,7 @@ + vivo ${project.version} ${basedir} yyyy-MM-dd HH:mm:ss diff --git a/start.sh b/start.sh index 0f9ef7d9..90e76f60 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 +# ensure home config directory exists +mkdir -p /opt/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 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 -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 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 - -# 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