-
Notifications
You must be signed in to change notification settings - Fork 1
[DSNYHD-84] fix memory settings #125
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| #!/bin/bash | ||
|
|
||
| if [[ $JMX_ENABLED == true ]] | ||
| then | ||
| JMX_RMI_HOST=${JMX_RMI_HOST:-'0.0.0.0'} | ||
| JAVA_OPTS_JMX="-Dcom.sun.management.jmxremote.authenticate=false \ | ||
| -Dcom.sun.management.jmxremote.local.only=false \ | ||
| -Dcom.sun.management.jmxremote.ssl=false \ | ||
| -Dcom.sun.management.jmxremote \ | ||
| -Dcom.sun.management.jmxremote.rmi.port=5000 \ | ||
| -Dcom.sun.management.jmxremote.port=5000 \ | ||
| -Djava.rmi.server.hostname=${JMX_RMI_HOST}" | ||
| export JAVA_OPTS_JMX | ||
| fi | ||
|
|
||
| if [[ $DEBUG == true ]] | ||
| then | ||
| JAVA_OPTS_DEBUG="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=0.0.0.0:8000" | ||
| export JAVA_OPTS_DEBUG | ||
| fi | ||
|
|
||
| if [[ -n $JAVA_XMX ]] | ||
| then | ||
| JAVA_OPTS_XMX="-Xmx${JAVA_XMX}" | ||
| export JAVA_OPTS_XMX | ||
| fi | ||
|
|
||
| if [[ -n $JAVA_XMS ]] | ||
| then | ||
| JAVA_OPTS_XMS="-Xms${JAVA_XMS}" | ||
| export JAVA_OPTS_XMS | ||
| fi | ||
|
|
||
| IFS=$'\n' | ||
| for I in $(env); do | ||
| if [[ $I == JAVA_OPTS_* ]]; then | ||
| echo "-- collecting $I" | ||
| VALUE=$(echo $I | cut -d '=' -f 2-) | ||
| JAVA_OPTS="$JAVA_OPTS $VALUE" | ||
| fi | ||
| done | ||
|
|
||
| # Trim leading/trailing whitespace | ||
| export JAVA_OPTS=$(echo $JAVA_OPTS | xargs echo) | ||
|
|
||
| echo "Result: JAVA_OPTS=${JAVA_OPTS}" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| #!/bin/bash | ||
|
|
||
| currentDate=`date +%s` | ||
| if [ -z "${BUILD_DATE}" ] | ||
| then | ||
| 1>&2 echo "$(tput -Txterm setaf 3)****************************************************$(tput -Txterm sgr0)" | ||
| 1>&2 echo "$(tput -Txterm setaf 3)Unable to determine image age: BUILD_DATE is not set$(tput -Txterm sgr0)" | ||
| 1>&2 echo "$(tput -Txterm setaf 3)****************************************************$(tput -Txterm sgr0)" | ||
| else | ||
| timeelapsed=`expr ${currentDate} - ${BUILD_DATE}` | ||
| if [ $timeelapsed -ge 2592000 ] # 30 days | ||
| then | ||
| 1>&2 echo "$(tput -Txterm setaf 3)****************************************************************************************$(tput -Txterm sgr0)" | ||
| 1>&2 echo "$(tput -Txterm setaf 3)This is an old image: BUILD_DATE=$(date -d @$BUILD_DATE +"%Y-%m-%d %H:%M:%S") and currentDate=$(date -d @$currentDate +"%Y-%m-%d %H:%M:%S")$(tput -Txterm sgr0)" | ||
| 1>&2 echo "$(tput -Txterm setaf 3)****************************************************************************************$(tput -Txterm sgr0)" | ||
| fi | ||
| fi |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,9 +23,6 @@ TEMPLATE=${TEMPLATE:-'rerank'} | |
| ALFRESCO_SOLR_SUGGESTER_ENABLED=${ALFRESCO_SOLR_SUGGESTER_ENABLED:-'true'} | ||
| ALFRESCO_SOLR_FACETABLE_CATEGORIES_ENABLED=${ALFRESCO_SOLR_FACETABLE_CATEGORIES_ENABLED:-'false'} | ||
|
|
||
| JAVA_XMS=${JAVA_XMS:-'512M'} | ||
| JAVA_XMX=${JAVA_XMX:-'2048M'} | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wait to low for Solr anyway. Drop it + give a warning. |
||
|
|
||
| CONFIG_FILE_SOLR_START="$SOLR_INSTALL_HOME/solr.in.sh" | ||
|
|
||
| CUSTOM_SCHEMA=${CUSTOM_SCHEMA:-'false'} | ||
|
|
@@ -39,6 +36,11 @@ function setJavaOption { | |
| } | ||
|
|
||
| function setOption { | ||
| if [[ -z "$3" ]]; then | ||
| echo "setOption failed (parameters: $1, $2, $3)" | ||
| exit 1 | ||
| fi | ||
|
|
||
| if grep --quiet -e "$1\s*=" "$3"; then | ||
| # replace option | ||
| sed -i "s#^\s*\($1\s*=\s*\).*\$#\1$2#" $3 | ||
|
|
@@ -64,8 +66,12 @@ function setGlobalOptions { | |
| envCoreName=$(echo $i | cut -d '=' -f 1 | cut -d '_' -f 2) | ||
| if [[ $envCoreName = $coreName ]] || [[ $envCoreName = "ALL" ]] || [[ $envCoreName = "WORKSPACE" && $coreName =~ alfresco ]]; then | ||
| key=$(echo $i | cut -d '=' -f 1 | cut -d '_' -f 3-) | ||
| value=$(echo $i | cut -d '=' -f 2-) | ||
| setOption $key $value "$file" | ||
| if [[ -z "$key" ]]; then | ||
| echo "Skipping env. variable ($i), since the resulting key is empty." | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Example: Because this initialization script thinks that |
||
| else | ||
| value=$(echo $i | cut -d '=' -f 2-) | ||
| setOption $key $value "$file" | ||
| fi | ||
| fi | ||
| done | ||
| } | ||
|
|
@@ -277,6 +283,12 @@ fi | |
| # fix permissions for config folders | ||
| chown -R "$user":"$user" "${SOLR_DIR_ROOT}" | ||
|
|
||
| echo "exec gosu ${user} ${SOLR_INSTALL_HOME}/solr/bin/solr start -f -m ${JAVA_XMX} -p ${PORT} -h ${SOLR_HOST} -s ${SOLR_DIR_ROOT} -a \"${JAVA_OPTS}\"" >"${SOLR_INSTALL_HOME}/startup.sh" | ||
| if [[ -n ${JAVA_XMX} ]]; then | ||
| echo "Found the (JAVA_XMX) environment variable; falling back to the default Solr bootup command." | ||
| echo "exec gosu ${user} ${SOLR_INSTALL_HOME}/solr/bin/solr start -f -m ${JAVA_XMX} -p ${PORT} -h ${SOLR_HOST} -s ${SOLR_DIR_ROOT} -a \"${JAVA_OPTS}\"" >"${SOLR_INSTALL_HOME}/startup.sh" | ||
| else | ||
| echo "Could not find the (JAVA_XMX) environment variable; falling back to the Solr bootup command without -m parameter. Make sure to specify the memory settings via JAVA_OPTS." | ||
| echo "exec gosu ${user} ${SOLR_INSTALL_HOME}/solr/bin/solr start -f -p ${PORT} -h ${SOLR_HOST} -s ${SOLR_DIR_ROOT} -a \"${JAVA_OPTS}\"" >"${SOLR_INSTALL_HOME}/startup.sh" | ||
| fi | ||
|
|
||
| echo "Solr init done" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| #!/bin/bash | ||
|
|
||
| DIR=/docker-entrypoint.d | ||
|
|
||
| BOLD="\033[1m" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This might not work in K8S, but this gives a nice representation of what the container is actually doing locally. |
||
| RESET="\033[0m" | ||
| BLUE="\033[34m" | ||
|
|
||
| echo -e "${BOLD}Running all initialization scripts in ${DIR}..." | ||
| if [ -d "${DIR}" ]; then | ||
| for f in ${DIR}/*; do | ||
| case "$f" in | ||
| *.sh) echo -e "${RESET}${BOLD}$0: running $f${BLUE}"; . "$f" ;; | ||
| *) echo -e "${RESET}${BOLD}$0: ignoring $f${BLUE}" ;; | ||
| esac | ||
| echo | ||
| done | ||
| echo -e "${RESET}${BOLD}$0: done running all initialization scripts in ${DIR}." | ||
| else | ||
| echo -e "${BOLD}$0: ${DIR} does not exist, skipping initialization scripts." | ||
| fi | ||
|
|
||
| echo -e "Starting Solr...${RESET}" | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This property does not seem to be used?