Skip to content

Commit 0f145a6

Browse files
timschumiVladimir Kotal
authored andcommitted
docker: Rename OPENGROK_WEBAPP_CONTEXT to URL_ROOT
The original OPENGROK_WEBAPP_CONTEXT variable has been deprecated/not been in use since the deployment scripts have been rewritten in commit d5cc7b5. Rename the variable to URL_ROOT to avoid confusion and to keep the docker command a bit shorter. While we're at it, remove the OPENGROK_TOMCAT_BASE variable, which has been deprecated at the same time.
1 parent 055a54a commit 0f145a6

File tree

4 files changed

+11
-12
lines changed

4 files changed

+11
-12
lines changed

Dockerfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,7 @@ RUN python3 -m pip install /opengrok/tools/opengrok-tools*
5858
# environment variables
5959
ENV SRC_ROOT /opengrok/src
6060
ENV DATA_ROOT /opengrok/data
61-
ENV OPENGROK_WEBAPP_CONTEXT /
62-
ENV OPENGROK_TOMCAT_BASE /usr/local/tomcat
61+
ENV URL_ROOT /
6362
ENV CATALINA_HOME /usr/local/tomcat
6463
ENV CATALINA_BASE /usr/local/tomcat
6564
ENV CATALINA_TMPDIR /usr/local/tomcat/temp

docker/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ The volume mounted to `/opengrok/src` should contain the projects you want to ma
7575
`REINDEX: <time_in_minutes>`<br/> *Optional* *Default: 10* | Period of automatic mirroring/reindexing. Setting to `0` will disable automatic indexing. You can manually trigger an reindex using docker exec: `docker exec <container> /scripts/index.sh`
7676
`INDEXER_OPT` | pass extra options to opengrok-indexer. For example, "-i d:vendor" will remove all the `*/vendor/*` files from the index. You can check the indexer options on https://github.com/oracle/opengrok/wiki/Python-scripts-transition-guide
7777
`NOMIRROR` | To avoid the mirroring step, set the variable to non-empty value.
78-
`OPENGROK_WEBAPP_CONTEXT`<br/> *Default: /* | Override the sub-URL that OpenGrok should run on.
78+
`URL_ROOT`<br/> *Default: /* | Override the sub-URL that OpenGrok should run on.
7979

8080
To specify environment variable for `docker run`, use the `-e` option, e.g. `-e REINDEX=30`
8181

docker/index.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22

33
LOCKFILE=/var/run/opengrok-indexer
4-
URI="http://localhost:8080/${OPENGROK_WEBAPP_CONTEXT#/}"
4+
URI="http://localhost:8080/${URL_ROOT#/}"
55
# $OPS can be overwritten by environment variable
66
OPS=${INDEXER_FLAGS:='-H -P -S -G'}
77

docker/start.sh

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,19 @@ if [ -z "$REINDEX" ]; then
55
REINDEX=10
66
fi
77

8-
if [[ "${OPENGROK_WEBAPP_CONTEXT}" = *" "* ]]; then
8+
if [[ "${URL_ROOT}" = *" "* ]]; then
99
date +"%F %T Deployment path contains spaces. Deploying to root..."
10-
export OPENGROK_WEBAPP_CONTEXT="/"
10+
export URL_ROOT="/"
1111
fi
1212

1313
# Remove leading and trailing slashes
14-
OPENGROK_WEBAPP_CONTEXT="${OPENGROK_WEBAPP_CONTEXT#/}"
15-
OPENGROK_WEBAPP_CONTEXT="${OPENGROK_WEBAPP_CONTEXT%/}"
14+
URL_ROOT="${URL_ROOT#/}"
15+
URL_ROOT="${URL_ROOT%/}"
1616

17-
if [ "${OPENGROK_WEBAPP_CONTEXT}" = "" ]; then
17+
if [ "${URL_ROOT}" = "" ]; then
1818
WAR_NAME="ROOT.war"
1919
else
20-
WAR_NAME="${OPENGROK_WEBAPP_CONTEXT//\//#}.war"
20+
WAR_NAME="${URL_ROOT//\//#}.war"
2121
fi
2222

2323
if [ ! -f "/usr/local/tomcat/webapps/${WAR_NAME}" ]; then
@@ -30,13 +30,13 @@ if [ ! -f "/usr/local/tomcat/webapps/${WAR_NAME}" ]; then
3030

3131
# Set up redirect from /source
3232
mkdir "/usr/local/tomcat/webapps/source"
33-
echo "<% response.sendRedirect(\"/${OPENGROK_WEBAPP_CONTEXT}\"); %>" > "/usr/local/tomcat/webapps/source/index.jsp"
33+
echo "<% response.sendRedirect(\"/${URL_ROOT}\"); %>" > "/usr/local/tomcat/webapps/source/index.jsp"
3434
fi
3535

3636
indexer(){
3737
# Wait for Tomcat startup.
3838
date +"%F %T Waiting for Tomcat startup..."
39-
while [ "`curl --silent --write-out '%{response_code}' -o /dev/null 'http://localhost:8080/${OPENGROK_WEBAPP_CONTEXT#/}'`" == "000" ]; do
39+
while [ "`curl --silent --write-out '%{response_code}' -o /dev/null 'http://localhost:8080/${URL_ROOT}'`" == "000" ]; do
4040
sleep 1;
4141
done
4242
date +"%F %T Startup finished"

0 commit comments

Comments
 (0)