Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[110] Upgrade Weaver-Webservice-Core (2.1.1-RC8). #111

Merged
merged 18 commits into from
May 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
b514f56
Issue 110: Upgrade Weaver-Webservice-Core (2.1.1-RC8).
kaladay Apr 26, 2022
f7fdf98
Issue 110: Upgrade from Java 1.8 to Java 11 in Github Actions.
kaladay Apr 27, 2022
de89578
Issue 110: Remove version, Github test fails.
kaladay Apr 27, 2022
6c0d532
Issue 110: Remove JDK11 incompatible cobertura and update coveralls.
kaladay Apr 27, 2022
02834a1
Issue 110: Add comment why remaining deprecated function is not remov…
kaladay Apr 28, 2022
4430fa2
Issue 110: Pom file improvements.
kaladay Apr 28, 2022
88e497f
Issue 110: Add Dockerfile.
kaladay Apr 28, 2022
1cf4bfd
Issue 110: Get docker working, including working with safer privileges.
kaladay Apr 28, 2022
a3e1e8d
Issue 110: Remove unintended code added to pom.
kaladay Apr 28, 2022
3c0c458
Issue 110: Move the UID/GID into USER_ID argument and other Dockerfil…
kaladay Apr 29, 2022
175920f
Issue 110: When building Jar files, must specify repackage.
kaladay Apr 29, 2022
e13b9e3
Issue 110: The CMD docker command is doing nothing.
kaladay Apr 29, 2022
081b5b8
Issue 110: The CMD docker command is intended to be run at container …
kaladay Apr 29, 2022
94dbbe4
Issue 110: Circular reference is no longer happening.
kaladay Apr 29, 2022
2007755
Issue 110: Tweak log settings.
kaladay May 2, 2022
84ef278
Issue 110: Remove `as runtime`.
kaladay May 2, 2022
e647e96
Issue 110: Remove spurious COPY command that is sometimes causing pro…
kaladay May 2, 2022
5f624af
Issue 110: Remove bracket notation from RUN mvn command.
kaladay May 3, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ jobs:
- name: "Setup Java"
uses: actions/setup-java@v1
with:
java-version: 1.8
java-version: 11

- name: "Maven Tests"
run: mvn clean test cobertura:cobertura jacoco:report coveralls:report -DdryRun=true
run: mvn clean test jacoco:report coveralls:report -DdryRun=true

- name: "Coverage Report"
uses: MikeEdgar/github-action@raw_coverage_file
Expand Down
62 changes: 62 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Settings.
ARG USER_ID=3001
ARG USER_NAME=iriifservice
ARG HOME_DIR=/$USER_NAME
ARG SOURCE_DIR=$HOME_DIR/source

# Maven stage.
FROM maven:3-openjdk-11-slim as maven
ARG USER_ID
ARG USER_NAME
ARG HOME_DIR
ARG SOURCE_DIR

# Create the group (use a high ID to attempt to avoid conflits).
RUN groupadd -g $USER_ID $USER_NAME

# Create the user (use a high ID to attempt to avoid conflits).
RUN useradd -d $HOME_DIR -m -u $USER_ID -g $USER_ID $USER_NAME

# Update the system.
RUN apt-get update && apt-get upgrade -y

# Set deployment directory.
WORKDIR $SOURCE_DIR

# Copy files over.
COPY ./pom.xml ./pom.xml
COPY ./src ./src

# Assign file permissions.
RUN chown -R ${USER_ID}:${USER_ID} ${SOURCE_DIR}

# Login as user.
USER $USER_NAME

# Build.
RUN mvn package -Pjar -DskipTests=true

# Switch to Normal JRE Stage.
FROM openjdk:11-jre-slim
ARG USER_ID
ARG USER_NAME
ARG HOME_DIR
ARG SOURCE_DIR

# Create the group (use a high ID to attempt to avoid conflits).
RUN groupadd -g $USER_ID $USER_NAME

# Create the user (use a high ID to attempt to avoid conflits).
RUN useradd -d $HOME_DIR -m -u $USER_ID -g $USER_ID $USER_NAME

# Login as user.
USER $USER_NAME

# Set deployment directory.
WORKDIR $HOME_DIR

# Copy over the built artifact from the maven image.
COPY --from=maven $SOURCE_DIR/target/ROOT.jar ./iriif.jar

# Run java command.
CMD ["java", "-jar", "./iriif.jar"]
170 changes: 129 additions & 41 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
<groupId>edu.tamu</groupId>
<artifactId>ir-iiif-service</artifactId>
<version>0.5.5</version>
<packaging>war</packaging>

<name>IR IIIF Service</name>

Expand All @@ -16,23 +15,44 @@
<parent>
<groupId>edu.tamu.weaver</groupId>
<artifactId>webservice-parent</artifactId>
<version>2.0.3</version>
<version>2.1.1-RC8</version>
<relativePath/>
</parent>

<properties>
<start-class>edu.tamu.iiif.IrIiifServiceInitializer</start-class>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<jena-libs.version>3.2.0</jena-libs.version>
<java.version>11</java.version>
<jena-libs.version>4.4.0</jena-libs.version>
<iiif-presentation.version>3.2.6</iiif-presentation.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<maven-plugins.version>2.22.2</maven-plugins.version>
<!-- must be valid uri with scheme file or classpath -->
<!-- e.g. file:/var/ir-iiif-service/config, classpath:/config -->
<config.uri>classpath:/config/</config.uri>
<maven.packaging>war</maven.packaging>
</properties>

<packaging>${maven.packaging}</packaging>

<profiles>
<profile>
<id>war</id>
<properties>
<maven.packaging>war</maven.packaging>
</properties>
</profile>
<profile>
<id>jar</id>
<properties>
<maven.packaging>jar</maven.packaging>
</properties>
</profile>
</profiles>

<dependencies>

<dependency>
<groupId>edu.tamu.weaver</groupId>
<artifactId>messaging</artifactId>
Expand All @@ -52,6 +72,12 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
<exclusions>
<exclusion>
<groupId>io.lettuce</groupId>
<artifactId>lettuce-core</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
Expand All @@ -78,35 +104,55 @@
</dependency>

<dependency>
<groupId>org.springframework.restdocs</groupId>
<artifactId>spring-restdocs-mockmvc</artifactId>
<scope>test</scope>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>

<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId>
<scope>test</scope>
<groupId>commons-validator</groupId>
<artifactId>commons-validator</artifactId>
<version>1.7</version>
</dependency>

<dependency>
<groupId>it.ozimov</groupId>
<artifactId>embedded-redis</artifactId>
<version>0.7.2</version>
<scope>test</scope>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.11.0</version>
</dependency>

<dependency>
<groupId>commons-validator</groupId>
<artifactId>commons-validator</artifactId>
<version>1.6</version>
<groupId>org.apache.commons</groupId>
<artifactId>commons-text</artifactId>
<version>1.9</version>
</dependency>

<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>31.1-jre</version>
</dependency>

<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
</dependency>

<dependency>
<groupId>org.apache.jena</groupId>
<artifactId>apache-jena-libs</artifactId>
<type>pom</type>
<version>${jena-libs.version}</version>
<exclusions>
<exclusion>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</exclusion>
<exclusion>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
Expand All @@ -122,16 +168,63 @@
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
<groupId>org.springframework.restdocs</groupId>
<artifactId>spring-restdocs-mockmvc</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>it.ozimov</groupId>
<artifactId>embedded-redis</artifactId>
<version>0.7.3</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</exclusion>
<exclusion>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<finalName>ROOT</finalName>
<plugins>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-plugins.version}</version>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${maven-plugins.version}</version>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
Expand All @@ -145,6 +238,13 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
Expand All @@ -156,25 +256,6 @@
</configuration>
</plugin>

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<configuration>
<quiet>true</quiet>
<instrumentation>
<ignoreTrivial>true</ignoreTrivial>
<ignores>
<ignore>java.util.logging.*</ignore>
</ignores>
</instrumentation>
<formats>
<format>html</format>
<format>xml</format>
</formats>
<aggregate>true</aggregate>
</configuration>
</plugin>

<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
Expand All @@ -194,6 +275,13 @@
<configuration>
<repoToken></repoToken>
</configuration>
<dependencies>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.1</version>
</dependency>
</dependencies>
</plugin>

<plugin>
Expand Down Expand Up @@ -268,7 +356,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>2.7</version>
<version>3.2.2</version>
<configuration>
<dependencyLocationsEnabled>false</dependencyLocationsEnabled>
</configuration>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/edu/tamu/iiif/IrIiifServiceInitializer.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.support.SpringBootServletInitializer;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;

/**
* Entry point to the IR IIIF service initializer.
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/edu/tamu/iiif/config/WebMvcConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

import org.springframework.context.annotation.Configuration;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import edu.tamu.iiif.controller.resolver.ManifestRequestArgumentResolver;

@Configuration
public class WebMvcConfig extends WebMvcConfigurerAdapter {
public class WebMvcConfig implements WebMvcConfigurer {

@Override
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/edu/tamu/iiif/constants/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ public class Constants {
public final static String IMAGE_IDENTIFIER = "image";

// Manifest Controller Mappings
public final static String COLLECTION_MAPPING = "/" + COLLECTION_IDENTIFIER + "/**/*";
public final static String PRESENTATION_MAPPING = "/" + PRESENTATION_IDENTIFIER + "/**/*";
public final static String SEQUENCE_MAPPING = "/" + SEQUENCE_IDENTIFIER + "/**/*";
public final static String CANVAS_MAPPING = "/" + CANVAS_IDENTIFIER + "/**/*";
public final static String IMAGE_MAPPING = "/" + IMAGE_IDENTIFIER + "/**/*";
public final static String COLLECTION_MAPPING = "/" + COLLECTION_IDENTIFIER + "/**";
public final static String PRESENTATION_MAPPING = "/" + PRESENTATION_IDENTIFIER + "/**";
public final static String SEQUENCE_MAPPING = "/" + SEQUENCE_IDENTIFIER + "/**";
public final static String CANVAS_MAPPING = "/" + CANVAS_IDENTIFIER + "/**";
public final static String IMAGE_MAPPING = "/" + IMAGE_IDENTIFIER + "/**";

// Fedora
public final static String FEDORA_FCR_METADATA = "/fcr:metadata";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringEscapeUtils;
import org.apache.commons.text.StringEscapeUtils;
import org.springframework.beans.factory.annotation.Autowired;

import edu.tamu.iiif.service.ManifestService;
Expand Down
Loading