Skip to content

Commit

Permalink
refactor: Removed TOMCAT_REVERSEPROXY variables
Browse files Browse the repository at this point in the history
DEPLOYMENT_CONTEXT and SHARE_URL should be enough
  • Loading branch information
torbrenner committed Sep 7, 2021
1 parent 59a3e7a commit f5bcdcd
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 61 deletions.
4 changes: 1 addition & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,10 @@ RUN ["rm", "-fr", "/usr/local/tomcat/webapps"]
COPY --from=extract /connector/extracted/ /usr/local/tomcat/webapps/ROOT/

# Adding fontconfig and libfreetype6 for rendering the BK Export, cf. https://stackoverflow.com/questions/55454036
# Patch is needed for reverse proxy configuration
RUN apt-get update && apt-get install -y fontconfig libfreetype6 patch && \
RUN apt-get update && apt-get install -y fontconfig libfreetype6 && \
rm -rf /var/lib/apt/lists/*

ADD src/docker/context.xml ${CATALINA_HOME}/conf/Catalina/localhost/ROOT.xml
ADD src/docker/server.reverseproxy.patch ${CATALINA_HOME}/conf/server.reverseproxy.patch

ADD src/docker/samply_common_urls.xml ${CATALINA_HOME}/conf/${PROJECT}_common_urls.xml
ADD src/docker/samply_common_operator.xml ${CATALINA_HOME}/conf/${PROJECT}_common_operator.xml
Expand Down
2 changes: 0 additions & 2 deletions docs/deployment/docker-deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,6 @@ If postgres connection errors occur, try your ip for POSTGRES_HOST. For all Envi
| feature_DKTK_CENTRAL_SEARCH | false | Feature toggle for the DKTK central search |
| feature_NNGM_CTS | false | Feature toggle for the NNGM CTS |
| CATALINA_OPTS | | JVM options |
| TOMCAT_REVERSEPROXY_FQDN | | The FQDN of share-client then run behind a reverse proxy. See [Tomcat Connector](https://tomcat.apache.org/tomcat-8.5-doc/config/http.html) "proxyName" for more information.|
| TOMCAT_REVERSEPROXY_SSL | | Whether the reverse proxy is running SSL or not. Set either to true or false. Automatically configures [Tomcat Connector](https://tomcat.apache.org/tomcat-8.5-doc/config/http.html) "proxyPort", "scheme" and "secure".|
| DEPLOYMENT_CONTEXT | | The subpath of the bridgehead installation. Normally bridgehead will be deployed to ROOT, but with this variable you can change it for example to "connector". It is not possible to pass multiple subdirectories like "connector/samply".|

*necessary
26 changes: 0 additions & 26 deletions src/docker/server.reverseproxy.patch

This file was deleted.

30 changes: 0 additions & 30 deletions src/docker/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -96,36 +96,6 @@ sed -i "s|{nngm-mainzelliste-apikey}|${NNGM_MAINZELLISTE_APIKEY}|" "$fi
sed -i "s|{nngm-mainzelliste-url}|${NNGM_MAINZELLISTE_URL}|" "$file"
sed -i "s|{nngm-cryptkey}|${NNGM_CRYPTKEY}|" "$file"

if [ -n "$TOMCAT_REVERSEPROXY_FQDN" ]; then
echo "Info: Configuring reverse proxy for URL ${TOMCAT_REVERSEPROXY_FQDN}";
mv "${CATALINA_HOME}/conf/server.xml" "${CATALINA_HOME}/conf/server.xml.ori";
## Apply add reverse proxy configuration to
echo "Info: applying ${CATALINA_HOME}/conf/server.reverseproxy.patch on ${CATALINA_HOME}/conf/server.xml"
patch -i "${CATALINA_HOME}/conf/server.reverseproxy.patch" -o "${CATALINA_HOME}/conf/server.xml" "${CATALINA_HOME}/conf/server.xml.ori"
if [ -z "$TOMCAT_REVERSEPROXY_PORT" ]; then
case "$TOMCAT_REVERSEPROXY_SSL" in
true)
TOMCAT_REVERSEPROXY_PORT=443
TOMCAT_REVERSEPROXY_SCHEME=https
;;
false)
TOMCAT_REVERSEPROXY_PORT=80
TOMCAT_REVERSEPROXY_SCHEME=http
;;
*)
echo "Error: Please set TOMCAT_REVERSEPROXY_SSL to either true or false."
exit 1
esac
fi
echo "Info: Applying configuration for ReverseProxy with settings: TOMCAT_REVERSEPROXY_FQDN=$TOMCAT_REVERSEPROXY_FQDN TOMCAT_REVERSEPROXY_PORT=${TOMCAT_REVERSEPROXY_PORT} TOMCAT_REVERSEPROXY_SSL=${TOMCAT_REVERSEPROXY_SSL}"
sed -i -e "s|{tomcat_reverseproxy_fqdn}|${TOMCAT_REVERSEPROXY_FQDN}|g ; \
s|{tomcat_reverseproxy_scheme}|${TOMCAT_REVERSEPROXY_SCHEME}|g ; \
s|{tomcat_reverseproxy_port}|${TOMCAT_REVERSEPROXY_PORT}|g ; \
s|{tomcat_reverseproxy_ssl}|${TOMCAT_REVERSEPROXY_SSL}|g" \
"${CATALINA_HOME}"/conf/server.xml;
echo "Info: ReverseProxy configuration is finished"
fi

export CATALINA_OPTS="${CATALINA_OPTS} -javaagent:/docker/jmx_prometheus_javaagent-0.3.1.jar=9100:/docker/jmx-exporter.yml"

# SSL Certs
Expand Down

0 comments on commit f5bcdcd

Please sign in to comment.