Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
Samitha Liyanage authored and Samitha Liyanage committed Dec 7, 2023
2 parents 0d5f528 + d52c20c commit 6cb57f5
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 9 deletions.
23 changes: 23 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM docker-registry.htrc.indiana.edu/tomcat9

MAINTAINER Data to Insight Center <d2i@indiana.edu>

# tomcat9 sets USER to tomcat, and WORKDIR to /opt/tomcat

USER root

# environment variables
ENV ARTIFACT_ID=rights-api
ENV TOMCAT_DIR=/opt/tomcat

# identity-helper.war should exist in the dir containing this
# Dockerfile
ADD target/$ARTIFACT_ID*.war $TOMCAT_DIR/webapps/$ARTIFACT_ID.war

RUN unzip -qq $TOMCAT_DIR/webapps/$ARTIFACT_ID.war -d $TOMCAT_DIR/webapps/$ARTIFACT_ID

RUN chown -R tomcat $TOMCAT_DIR/webapps/
RUN chmod 755 $TOMCAT_DIR/logs/


USER tomcat
14 changes: 14 additions & 0 deletions docker-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env bash

if [ "$#" -eq 0 ]; then
echo "No arguments supplied."
echo "Usage: bash docker-build.sh dockerImageTag"
echo "dockerImageTag - The image tag for the docker-registry.htrc.indiana.edu/rights-api image name"
echo "Examples: bash docker-build.sh dev"
exit 1
fi

mvn clean install

docker build --no-cache -t docker-registry.htrc.indiana.edu/rights-api:$1 .
docker push docker-registry.htrc.indiana.edu/rights-api:$1
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20140107</version>
<version>20231013</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
Expand Down Expand Up @@ -70,12 +70,12 @@
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.2.10</version>
<version>1.2.13</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>1.2.10</version>
<version>1.2.13</version>
</dependency>
</dependencies>

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/edu/indiana/d2i/htrc/rights/Hub.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public static void init(ServletConfig servletConfig) {
LevelsProcessor.initParams();
RedisClient.initParams();

redisClient = new RedisClient(initParams.getParamValue(ParamValues.REDIS_HOST_PARAM));
redisClient = new RedisClient(initParams.getParamValue(ParamValues.REDIS_HOST_PARAM), Integer.parseInt(initParams.getParamValue(ParamValues.REDIS_PORT_PARAM)), Integer.parseInt(initParams.getParamValue(ParamValues.REDIS_TIMEOUT_PARAM)), initParams.getParamValue(ParamValues.REDIS_PASSWORD_PARAM));
}

public static ParamValues getInitParams() {
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/edu/indiana/d2i/htrc/rights/ParamValues.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@

public class ParamValues {
public static final String REDIS_HOST_PARAM = "redis.host";
public static final String REDIS_PORT_PARAM = "redis.port";
public static final String REDIS_PASSWORD_PARAM = "redis.password";
public static final String REDIS_TIMEOUT_PARAM = "redis.timeout";
public static final String REDIS_NUM_KEYS_PER_MGET_PARAM = "redis.num.keys.per.mget";
public static final String REDIS_NUM_MGETS_PER_PIPELINE_PARAM = "redis.num.mgets.per.pipeline";
public static final String REDIS_NUM_HMGETS_PER_PIPELINE_PARAM = "redis.num.hmgets.per.pipeline";
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/edu/indiana/d2i/htrc/rights/RedisClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ public static void initParams() {
numHmgetsPerPipeline = Integer.parseInt(Hub.getInitParams().getParamValue(ParamValues.REDIS_NUM_HMGETS_PER_PIPELINE_PARAM, DEFAULT_NUM_HMGETS_PER_PIPELINE));
}

public RedisClient(String redisHost) {
this.jedisPool = new JedisPool(new JedisPoolConfig(), redisHost);
public RedisClient(String redisHost, int redisPort, int redisTimeout, String redisPassword) {
this.jedisPool = new JedisPool(new JedisPoolConfig(), redisHost,redisPort, redisTimeout,redisPassword);
}

public List<String> getKeyValues(List<String> keys) {
Expand Down
19 changes: 16 additions & 3 deletions src/main/webapp/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,22 @@

<init-param>
<param-name>redis.host</param-name>
<!-- <param-value>localhost</param-value> -->
<!-- <param-value>htc4.carbonate.uits.iu.edu</param-value> -->
<param-value>htc5.carbonate.uits.iu.edu</param-value>
<param-value>htc6.carbonate.uits.iu.edu</param-value>
</init-param>

<init-param>
<param-name>redis.port</param-name>
<param-value>6379</param-value>
</init-param>

<init-param>
<param-name>redis.timeout</param-name>
<param-value>2000</param-value>
</init-param>

<init-param>
<param-name>redis.password</param-name>
<param-value>PASSWORD</param-value>
</init-param>

<init-param>
Expand Down

0 comments on commit 6cb57f5

Please sign in to comment.