Skip to content

Commit

Permalink
Update oai-pmh version
Browse files Browse the repository at this point in the history
  • Loading branch information
physikerwelt committed Oct 21, 2023
1 parent eb619d4 commit 4d2b90c
Show file tree
Hide file tree
Showing 4 changed files with 1,020 additions and 463 deletions.
10 changes: 5 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ x-extra-variables: &wikibase_extra_variables
services:
cassandra-oai:
hostname: cassandra-oai
image: cassandra:3.11
image: cassandra:4.1
environment:
LOG4J_FORMAT_MSG_NO_LOOKUPS: "true"
volumes:
Expand All @@ -37,7 +37,7 @@ services:
- ./oaipmh/jmxremote.password:/etc/cassandra/jmxremote.password
cassandra-oai-setup:
hostname: cassandra-oai-setup
image: cassandra:3.11
image: cassandra:4.1
depends_on:
- cassandra-oai
command: ["/wait-for-it.sh","cassandra-oai:9042","--", "sh", "/init-fizoai-database.sh"]
Expand All @@ -60,7 +60,7 @@ services:
- cassandra-oai
elasticsearch-oai:
hostname: elasticsearch-oai
image: docker.elastic.co/elasticsearch/elasticsearch:7.17.3
image: docker.elastic.co/elasticsearch/elasticsearch:7.17.13
environment:
# - bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Dlog4j2.formatMsgNoLookups=true -Xms2g -Xmx2g"
Expand Down Expand Up @@ -89,7 +89,7 @@ services:

oai-backend:
hostname: oai-backend
image: docker.dev.fiz-karlsruhe.de/oai-backend:1.2.4
image: docker.dev.fiz-karlsruhe.de/oai-backend:1.2.8
environment:
- "LOG4J_FORMAT_MSG_NO_LOOKUPS=true"
- "CATALINA_OPTS=-Dlog4j2.formatMsgNoLookups=true -Dorg.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH=true"
Expand All @@ -104,7 +104,7 @@ services:
- backend-logs:/usr/local/tomcat/logs
oai-provider:
hostname: oai-provider
image: docker.dev.fiz-karlsruhe.de/oai-provider:1.2.2
image: docker.dev.fiz-karlsruhe.de/oai-provider:1.2.6
environment:
- "LOG4J_FORMAT_MSG_NO_LOOKUPS=true"
- "CATALINA_OPTS=-Dlog4j2.formatMsgNoLookups=true -Dorg.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH=true"
Expand Down
122 changes: 60 additions & 62 deletions oaipmh/cassandra-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -86,60 +86,32 @@ calculate_heap_sizes()
fi
}

# Determine the sort of JVM we'll be running on.
java_ver_output=`"${JAVA:-java}" -version 2>&1`
jvmver=`echo "$java_ver_output" | grep '[openjdk|java] version' | awk -F'"' 'NR==1 {print $2}' | cut -d\- -f1`
JVM_VERSION=${jvmver%_*}
JVM_PATCH_VERSION=${jvmver#*_}

if [ "$JVM_VERSION" \< "1.8" ] ; then
echo "Cassandra 3.0 and later require Java 8u40 or later."
exit 1;
fi

if [ "$JVM_VERSION" \< "1.8" ] && [ "$JVM_PATCH_VERSION" -lt 40 ] ; then
echo "Cassandra 3.0 and later require Java 8u40 or later."
exit 1;
fi

jvm=`echo "$java_ver_output" | grep -A 1 '[openjdk|java] version' | awk 'NR==2 {print $1}'`
case "$jvm" in
OpenJDK)
JVM_VENDOR=OpenJDK
# this will be "64-Bit" or "32-Bit"
JVM_ARCH=`echo "$java_ver_output" | awk 'NR==3 {print $2}'`
;;
"Java(TM)")
JVM_VENDOR=Oracle
# this will be "64-Bit" or "32-Bit"
JVM_ARCH=`echo "$java_ver_output" | awk 'NR==3 {print $3}'`
;;
*)
# Help fill in other JVM values
JVM_VENDOR=other
JVM_ARCH=unknown
;;
esac

# Sets the path where logback and GC logs are written.
if [ "x$CASSANDRA_LOG_DIR" = "x" ] ; then
CASSANDRA_LOG_DIR="$CASSANDRA_HOME/logs"
fi

#GC log path has to be defined here because it needs to access CASSANDRA_HOME
JVM_OPTS="$JVM_OPTS -Xloggc:${CASSANDRA_LOG_DIR}/gc.log"

# Here we create the arguments that will get passed to the jvm when
# starting cassandra.

# Read user-defined JVM options from jvm.options file
JVM_OPTS_FILE=$CASSANDRA_CONF/jvm.options
for opt in `grep "^-" $JVM_OPTS_FILE`
do
JVM_OPTS="$JVM_OPTS $opt"
done
if [ $JAVA_VERSION -ge 11 ] ; then
# See description of https://bugs.openjdk.java.net/browse/JDK-8046148 for details about the syntax
# The following is the equivalent to -XX:+PrintGCDetails -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=10M
echo "$JVM_OPTS" | grep -qe "-[X]log:gc"
if [ "$?" = "1" ] ; then # [X] to prevent ccm from replacing this line
# only add -Xlog:gc if it's not mentioned in jvm-server.options file
mkdir -p ${CASSANDRA_LOG_DIR}
JVM_OPTS="$JVM_OPTS -Xlog:gc=info,heap*=trace,age*=debug,safepoint=info,promotion*=trace:file=${CASSANDRA_LOG_DIR}/gc.log:time,uptime,pid,tid,level:filecount=10,filesize=10485760"
fi
else
# Java 8
echo "$JVM_OPTS" | grep -qe "-[X]loggc"
if [ "$?" = "1" ] ; then # [X] to prevent ccm from replacing this line
# only add -Xlog:gc if it's not mentioned in jvm-server.options file
mkdir -p ${CASSANDRA_LOG_DIR}
JVM_OPTS="$JVM_OPTS -Xloggc:${CASSANDRA_LOG_DIR}/gc.log"
fi
fi

# Check what parameters were defined on jvm.options file to avoid conflicts
# Check what parameters were defined on jvm-server.options file to avoid conflicts
echo $JVM_OPTS | grep -q Xmn
DEFINED_XMN=$?
echo $JVM_OPTS | grep -q Xmx
Expand All @@ -148,7 +120,7 @@ echo $JVM_OPTS | grep -q Xms
DEFINED_XMS=$?
echo $JVM_OPTS | grep -q UseConcMarkSweepGC
USING_CMS=$?
echo $JVM_OPTS | grep -q UseG1GC
echo $JVM_OPTS | grep -q +UseG1GC
USING_G1=$?

# Override these to set the amount of memory to allocate to the JVM at
Expand Down Expand Up @@ -184,26 +156,33 @@ if [ "x$MALLOC_ARENA_MAX" = "x" ] ; then
export MALLOC_ARENA_MAX=4
fi

# We only set -Xms and -Xmx if they were not defined on jvm.options file
# We only set -Xms and -Xmx if they were not defined on jvm-server.options file
# If defined, both Xmx and Xms should be defined together.
if [ $DEFINED_XMX -ne 0 ] && [ $DEFINED_XMS -ne 0 ]; then
JVM_OPTS="$JVM_OPTS -Xms${MAX_HEAP_SIZE}"
JVM_OPTS="$JVM_OPTS -Xmx${MAX_HEAP_SIZE}"
elif [ $DEFINED_XMX -ne 0 ] || [ $DEFINED_XMS -ne 0 ]; then
echo "Please set or unset -Xmx and -Xms flags in pairs on jvm.options file."
echo "Please set or unset -Xmx and -Xms flags in pairs on jvm-server.options file."
exit 1
fi

# We only set -Xmn flag if it was not defined in jvm.options file
# We only set -Xmn flag if it was not defined in jvm-server.options file
# and if the CMS GC is being used
# If defined, both Xmn and Xmx should be defined together.
if [ $DEFINED_XMN -eq 0 ] && [ $DEFINED_XMX -ne 0 ]; then
echo "Please set or unset -Xmx and -Xmn flags in pairs on jvm.options file."
echo "Please set or unset -Xmx and -Xmn flags in pairs on jvm-server.options file."
exit 1
elif [ $DEFINED_XMN -ne 0 ] && [ $USING_CMS -eq 0 ]; then
JVM_OPTS="$JVM_OPTS -Xmn${HEAP_NEWSIZE}"
fi

# We fail to start if -Xmn is used with G1 GC is being used
# See comments for -Xmn in jvm-server.options
if [ $DEFINED_XMN -eq 0 ] && [ $USING_G1 -eq 0 ]; then
echo "It is not recommended to set -Xmn with the G1 garbage collector. See comments for -Xmn in jvm-server.options for details."
exit 1
fi

if [ "$JVM_ARCH" = "64-Bit" ] && [ $USING_CMS -eq 0 ]; then
JVM_OPTS="$JVM_OPTS -XX:+UseCondCardMark"
fi
Expand All @@ -212,7 +191,7 @@ fi
JVM_OPTS="$JVM_OPTS -XX:CompileCommandFile=$CASSANDRA_CONF/hotspot_compiler"

# add the jamm javaagent
JVM_OPTS="$JVM_OPTS -javaagent:$CASSANDRA_HOME/lib/jamm-0.3.0.jar"
JVM_OPTS="$JVM_OPTS -javaagent:$CASSANDRA_HOME/lib/jamm-0.3.2.jar"

# set jvm HeapDumpPath with CASSANDRA_HEAPDUMP_DIR
if [ "x$CASSANDRA_HEAPDUMP_DIR" != "x" ]; then
Expand Down Expand Up @@ -241,13 +220,14 @@ JVM_ON_OUT_OF_MEMORY_ERROR_OPT="-XX:OnOutOfMemoryError=kill -9 %p"
# for more on configuring JMX through firewalls, etc. (Short version:
# get it working with no firewall first.)
#
# Cassandra ships with JMX accessible *only* from localhost.
# Cassandra ships with JMX accessible *only* from localhost.
# To enable remote JMX connections, uncomment lines below
# with authentication and/or ssl enabled. See https://wiki.apache.org/cassandra/JmxSecurity
# with authentication and/or ssl enabled. See https://wiki.apache.org/cassandra/JmxSecurity
#
#if [ "x$LOCAL_JMX" = "x" ]; then
# LOCAL_JMX=yes
# LOCAL_JMX=yes
#fi
LOCAL_JMX=no

# Specifies the default port over which Cassandra will be available for
# JMX connections.
Expand Down Expand Up @@ -296,17 +276,35 @@ JVM_OPTS="$JVM_OPTS -Dcom.sun.management.jmxremote.password.file=/etc/cassandra/

# To use mx4j, an HTML interface for JMX, add mx4j-tools.jar to the lib/
# directory.
# See http://cassandra.apache.org/doc/3.11/operating/metrics.html#jmx
# By default mx4j listens on 0.0.0.0:8081. Uncomment the following lines
# See http://cassandra.apache.org/doc/latest/operating/metrics.html#jmx
# By default mx4j listens on the broadcast_address, port 8081. Uncomment the following lines
# to control its listen address and port.
#MX4J_ADDRESS="-Dmx4jaddress=127.0.0.1"
#MX4J_PORT="-Dmx4jport=8081"
#MX4J_ADDRESS="127.0.0.1"
#MX4J_PORT="8081"

# Cassandra uses SIGAR to capture OS metrics CASSANDRA-7838
# for SIGAR we have to set the java.library.path
# to the location of the native libraries.
JVM_OPTS="$JVM_OPTS -Djava.library.path=$CASSANDRA_HOME/lib/sigar-bin"

JVM_OPTS="$JVM_OPTS $MX4J_ADDRESS"
JVM_OPTS="$JVM_OPTS $MX4J_PORT"
if [ "x$MX4J_ADDRESS" != "x" ]; then
if [[ "$MX4J_ADDRESS" == \-Dmx4jaddress* ]]; then
# Backward compatible with the older style #13578
JVM_OPTS="$JVM_OPTS $MX4J_ADDRESS"
else
JVM_OPTS="$JVM_OPTS -Dmx4jaddress=$MX4J_ADDRESS"
fi
fi
if [ "x$MX4J_PORT" != "x" ]; then
if [[ "$MX4J_PORT" == \-Dmx4jport* ]]; then
# Backward compatible with the older style #13578
JVM_OPTS="$JVM_OPTS $MX4J_PORT"
else
JVM_OPTS="$JVM_OPTS -Dmx4jport=$MX4J_PORT"
fi
fi

JVM_OPTS="$JVM_OPTS $JVM_EXTRA_OPTS"



Loading

0 comments on commit 4d2b90c

Please sign in to comment.