Revert "revert deployment changes (#228)" (#229)

This reverts commit 7773db3394.
This commit is contained in:
Ralph O'Flinn 2021-03-24 01:41:41 -05:00 committed by GitHub
parent 7773db3394
commit 1dd2851e45
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 168 additions and 359 deletions

View file

@ -28,4 +28,4 @@ jobs:
java-version: 11 java-version: 11
- name: Maven Build - name: Maven Build
run: mvn clean package -s installer/example-settings.xml run: mvn clean install

View file

@ -35,7 +35,7 @@ jobs:
server-password: MAVEN_PASSWORD server-password: MAVEN_PASSWORD
- name: Maven Deploy - name: Maven Deploy
run: mvn --batch-mode deploy -Pskip run: mvn --batch-mode deploy
env: env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }} MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}

View file

@ -32,7 +32,7 @@ jobs:
java-version: 11 java-version: 11
- name: Maven Build - name: Maven Build
run: mvn clean package -s installer/example-settings.xml run: mvn clean install
- name: Set up QEMU - name: Set up QEMU
uses: docker/setup-qemu-action@v1 uses: docker/setup-qemu-action@v1

View file

@ -1,18 +1,20 @@
FROM tomcat:9-jdk11-openjdk FROM tomcat:9-jdk11-openjdk
ARG SOLR_URL=http://localhost:8983/solr/vivocore 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 ARG TDB_FILE_MODE=direct
ENV SOLR_URL=${SOLR_URL} 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 /opt/vivo
RUN mkdir /usr/local/vivo/home 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 ./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 COPY start.sh /start.sh
EXPOSE 8080 EXPOSE 8080

View file

@ -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. - `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_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_CORE`: Convinience to reset VIVO Solr core when starting container. **Caution** will require complete reindex.
Build and start VIVO. Build and start VIVO.
``` ```
mvn clean package -s installer/example-settings.xml mvn clean install
docker-compose up docker-compose up
``` ```

View file

@ -19,7 +19,7 @@ services:
context: ./ context: ./
dockerfile: Dockerfile dockerfile: Dockerfile
args: args:
- VIVO_DIR=/usr/local/vivo/home - VIVO_DIR=/opt/vivo/home
- TDB_FILE_MODE=direct - TDB_FILE_MODE=direct
- SOLR_URL=http://solr:8983/solr/vivocore - SOLR_URL=http://solr:8983/solr/vivocore
environment: environment:
@ -28,7 +28,7 @@ services:
ports: ports:
- 8080:8080 - 8080:8080
volumes: volumes:
- ${LOCAL_VIVO_HOME}:/usr/local/vivo/home - ${LOCAL_VIVO_HOME}:/opt/vivo/home
networks: networks:
- vivo - vivo

View file

@ -19,26 +19,6 @@
# BASIC PROPERTIES # 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 # Argon2 password hashing parameters for time, memory and parallelism required to
# compute a hash. # compute a hash.

View file

@ -1,21 +0,0 @@
<settings xmlns="http://maven.apache.org/SETTINGS/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd">
<profiles>
<profile>
<id>defaults</id>
<properties>
<app-name>vivo</app-name>
<vivo-dir>/usr/local/vivo/home</vivo-dir>
<tomcat-dir>/usr/local/tomcat</tomcat-dir>
<default-theme>wilma</default-theme>
</properties>
</profile>
</profiles>
<activeProfiles>
<activeProfile>defaults</activeProfile>
</activeProfiles>
</settings>

View file

@ -23,40 +23,6 @@
<default-theme>wilma</default-theme> <default-theme>wilma</default-theme>
</properties> </properties>
<profiles>
<profile>
<id>package</id>
<activation>
<property><name>vivo-dir</name></property>
</activation>
<build>
<finalName>${app-name}</finalName>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptors>
<descriptor>src/main/assembly/home.xml</descriptor>
</descriptors>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>install</id>
<activation>
<property><name>vivo-dir</name></property>
</activation>
<build> <build>
<plugins> <plugins>
<plugin> <plugin>
@ -76,56 +42,6 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>remove-webapp</id>
<phase>verify</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<delete dir="${vivo-dir}/rdf" />
</target>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>install</id>
<phase>install</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${vivo-dir}</outputDirectory>
<resources>
<resource>
<directory>${project.build.directory}/${project.build.finalName}</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<build>
<plugins>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins> </plugins>
</build> </build>

View file

@ -4,6 +4,7 @@
<id>home</id> <id>home</id>
<formats> <formats>
<format>dir</format> <format>dir</format>
<format>tar</format>
</formats> </formats>
<includeBaseDirectory>false</includeBaseDirectory> <includeBaseDirectory>false</includeBaseDirectory>
<dependencySets> <dependencySets>

View file

@ -29,12 +29,6 @@
<encoding>UTF-8</encoding> <encoding>UTF-8</encoding>
</configuration> </configuration>
</plugin> </plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId> <artifactId>maven-gpg-plugin</artifactId>
@ -148,12 +142,6 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin> <plugin>
<artifactId>maven-resources-plugin</artifactId> <artifactId>maven-resources-plugin</artifactId>
<version>2.6</version> <version>2.6</version>
@ -177,60 +165,6 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<executions>
<execution>
<id>default-war</id>
<phase/>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>install</id>
<activation>
<property><name>vivo-dir</name></property>
</activation>
<build>
<plugins>
<plugin>
<artifactId>maven-enforcer-plugin</artifactId>
<executions>
<execution>
<id>enforce-properties</id>
<phase>validate</phase>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireProperty>
<property>app-name</property>
<message>You must provide an application name (app-name)</message>
</requireProperty>
</rules>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>skip</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins> </plugins>
</build> </build>
</profile> </profile>

View file

@ -19,15 +19,48 @@
<name>VIVO Install Web App</name> <name>VIVO Install Web App</name>
<profiles>
<profile>
<id>package</id>
<activation>
<property><name>app-name</name></property>
</activation>
<build> <build>
<finalName>${app-name}</finalName> <finalName>${app-name}</finalName>
<plugins> <plugins>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<configuration>
<filesets>
<fileset>
<directory>overlays</directory>
</fileset>
</filesets>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<configuration>
<skip>false</skip>
</configuration>
<executions>
<execution>
<id>include-home</id>
<phase>process-resources</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.vivoweb</groupId>
<artifactId>vivo-installer-home</artifactId>
<version>${project.version}</version>
<type>tar</type>
<destFileName>vivo-home.tar</destFileName>
<outputDirectory>${project.build.directory}/home-files</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId> <artifactId>maven-war-plugin</artifactId>
@ -45,103 +78,31 @@
<type>war</type> <type>war</type>
</overlay> </overlay>
<!-- Overlays for multilingual support --> <!-- Overlays for multilingual support -->
<!-- overlay> <overlay>
<groupId>org.vivoweb</groupId> <groupId>org.vivoweb</groupId>
<artifactId>vitro-languages-webapp</artifactId> <artifactId>vitro-languages-webapp-core</artifactId>
<type>war</type> <type>war</type>
</overlay> </overlay>
<overlay> <overlay>
<groupId>org.vivoweb</groupId> <groupId>org.vivoweb</groupId>
<artifactId>vivo-languages-webapp</artifactId> <artifactId>vivo-languages-webapp-core</artifactId>
<type>war</type> <type>war</type>
</overlay --> </overlay>
</overlays> </overlays>
<webResources> <webResources>
<resource> <resource>
<directory>src/main/webResources</directory> <directory>src/main/webResources</directory>
<filtering>true</filtering> <filtering>true</filtering>
</resource> </resource>
<resource>
<directory>${project.build.directory}/home-files/</directory>
<targetPath>WEB-INF/resources/home-files/</targetPath>
</resource>
</webResources> </webResources>
</configuration> </configuration>
</plugin> </plugin>
</plugins> </plugins>
</build> </build>
</profile>
<profile>
<id>install</id>
<activation>
<property><name>tomcat-dir</name></property>
</activation>
<build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>remove-webapp</id>
<phase>verify</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<delete dir="${tomcat-dir}/webapps/${project.build.finalName}" />
</target>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>install</id>
<phase>install</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>${project.groupId}</groupId>
<artifactId>${project.artifactId}</artifactId>
<version>${project.version}</version>
<type>war</type>
<overWrite>true</overWrite>
<outputDirectory>${tomcat-dir}/webapps/${project.build.finalName}</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<build>
<finalName>${app-name}</finalName>
<plugins>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<configuration>
<filesets>
<fileset>
<directory>overlays</directory>
</fileset>
</filesets>
</configuration>
</plugin>
</plugins>
</build>
<dependencies> <dependencies>
<dependency> <dependency>

View file

@ -1,9 +1,52 @@
<Context> <!-- useHttpOnly="false" --> <Context> <!-- useHttpOnly="false" -->
<!--
# The 'home' property specifies the location of VIVO HOME.
# The system user used to run the VIVO web application must have write access
# to the parent directory of the directory defined in this property, if VIVO HOME
# does not already exist.
# If this directory already exists, the system user used to run the VIVO web application
# must have write access to this directory.
-->
<Environment <Environment
type="java.lang.String" type="java.lang.String"
name="vitro/home" name="vitro/home"
value="${vivo-dir}" override="true"/> value="${vivo-dir}" override="true"/>
<!--
# The name of the application (possibly not used).
-->
<Environment
type="java.lang.String"
name="vitro/appName"
value="${app-name}" override="true"/>
<!--
# 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.
-->
<Environment
type="java.lang.String"
name="vitro/rootUserAddress"
value="vivo_root@mydomain.edu" override="true"/>
<!--
# 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/
-->
<Environment
type="java.lang.String"
name="vitro/defaultNamespace"
value="http://vivo.mydomain.edu/individual/" override="true"/>
<!-- Disable persist sessions on shut down.--> <!-- Disable persist sessions on shut down.-->
<Manager pathname="" /> <Manager pathname="" />
</Context> </Context>

View file

@ -24,7 +24,7 @@
# debug.log4j.properties exists will be used instead, if it exists, but is not stored in Subversion. # 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=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.MaxFileSize=10MB
log4j.appender.AllAppender.MaxBackupIndex=10 log4j.appender.AllAppender.MaxBackupIndex=10
log4j.appender.AllAppender.layout=org.apache.log4j.PatternLayout log4j.appender.AllAppender.layout=org.apache.log4j.PatternLayout

View file

@ -56,6 +56,7 @@
</scm> </scm>
<properties> <properties>
<app-name>vivo</app-name>
<vitro-version>${project.version}</vitro-version> <vitro-version>${project.version}</vitro-version>
<vivo-dir>${basedir}</vivo-dir> <vivo-dir>${basedir}</vivo-dir>
<maven.build.timestamp.format>yyyy-MM-dd HH:mm:ss</maven.build.timestamp.format> <maven.build.timestamp.format>yyyy-MM-dd HH:mm:ss</maven.build.timestamp.format>

View file

@ -9,51 +9,43 @@ fi
# allow easier reset home with `docker run -e RESET_HOME=true` # allow easier reset home with `docker run -e RESET_HOME=true`
if [[ "$RESET_HOME" = "true" ]]; then if [[ "$RESET_HOME" = "true" ]]; then
echo 'Clearing VIVO HOME /usr/local/vivo/home' echo 'Clearing VIVO HOME /opt/vivo/home'
rm -rf /usr/local/vivo/home/* rm -rf /opt/vivo/home/*
fi fi
# copy home bin if not exists # ensure home config directory exists
if [ ! -d /usr/local/vivo/home/bin ]; then mkdir -p /opt/vivo/home/config
echo "Copying home bin directory to /usr/local/vivo/home/bin"
cp -r /vivo-home/bin /usr/local/vivo/home/bin # 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 fi
# copy home config if not exists # only move runtime.properties first time and if it does not already exist in target home directory
if [ ! -d /usr/local/vivo/home/config ]; then if [ -f /runtime.properties ]; then
echo "Copying home config directory to /usr/local/vivo/home/config"
cp -r /vivo-home/config /usr/local/vivo/home/config
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
# 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 ]
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 # template runtime.properties vitro.local.solr.url value to $SOLR_URL value
echo "Templating runtime.properties vitro.local.solr.url = $SOLR_URL" 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 sed -i "s,http://localhost:8983/solr/vivocore,$SOLR_URL,g" /runtime.properties
if [ ! -f /opt/vivo/home/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
else else
echo "Using existing /usr/local/vivo/home/config/runtime.properties" echo "Using existing /opt/vivo/home/config/runtime.properties"
fi fi
fi fi
# copy applicationSetup.n3 if it does not already exist in target home directory # only move applicationSetup.n3 first time and if it does not already exist in target home directory
if [ -f /usr/local/vivo/home/config/example.applicationSetup.n3 ]; then if [ -f /applicationSetup.n3 ]; then
if [ ! -f /usr/local/vivo/home/config/applicationSetup.n3 ] if [ ! -f /opt/vivo/home/config/applicationSetup.n3 ]
then then
echo "Copying example.applicationSetup.n3 to /usr/local/vivo/home/config/applicationSetup.n3" echo "First time: moving /applicationSetup.n3 to /opt/vivo/home/config/applicationSetup.n3"
cp /usr/local/vivo/home/config/example.applicationSetup.n3 /usr/local/vivo/home/config/applicationSetup.n3 mv -n /applicationSetup.n3 /opt/vivo/home/config/applicationSetup.n3
else else
echo "Using existing /usr/local/vivo/home/config/applicationSetup.n3" echo "Using existing /opt/vivo/home/config/applicationSetup.n3"
fi fi
fi fi