Skip to content

Commit 2bce056

Browse files
committed
Docker fix healthcheck; allow modules; cleanup; set uid
The docker healthcheck was hardcoded to check the /issues/ tracker. Replace healthcheck with one that looks for the tracker names on the roundup-server command line and checks the first one. During build, additional modules can be specified using --build-arg="pip_mod=requests setproctitle". This lets the user add modules unique to the tracker without having to 'docker commit' a new image from a running container. Use --build-arg="roundup_uid=2000" to change the uid roundup runs as. The default is 1000. This is done at build time, not run time. Remove the sphinx package. All the dependent packages were removed before, but sphinx wasn't. This led to spurious warnings fom the pip dependency resolver. Update docs with changes.
1 parent 797e830 commit 2bce056

File tree

3 files changed

+31
-12
lines changed

3 files changed

+31
-12
lines changed

doc/installation.txt

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -279,8 +279,14 @@ PyPI, by running::
279279

280280
The docker declares a single volume mounted at
281281
``/usr/src/app/tracker`` inside the container. You will mount your
282-
tracker home directory at this location.
282+
tracker home directory at this location. The ``/usr/src/app`` path can
283+
be changed by using ``--build-args=/new/path``.
283284

285+
You can also add additional modules to the docker container by using
286+
`--build-args="pip_mod=requests setproctitle"`.
287+
288+
By default the container runs Roundup using UID 1000. By setting
289+
`--build-args="roundup_uid=2000"` you can change the UID.
284290

285291
Configuring Roundup in the Container
286292
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -292,11 +298,12 @@ an interactive session it with::
292298
-v $PWD/tracker:/usr/src/app/tracker roundup-app:latest
293299

294300
The ``-v`` option maps a directory from the host into the docker
295-
container. Note that uid 1000 is used by roundup. So the uid of the
296-
directory (and all files under it) must be uid 1000. This example
297-
assumes your tracker configs are in the tracker subdirectory. Replace
298-
``$PWD/tracker`` with the full path name to the directory where the
299-
tracker home(s) are to be stored.
301+
container. Note that uid 1000 is used by roundup by default. The uid
302+
of the directory (and all files under it) must match the uid. You can
303+
set the UID at image build time, see above. This
304+
example assumes your tracker configs are in the tracker
305+
subdirectory. Replace ``$PWD/tracker`` with the full path name to the
306+
directory where the tracker home(s) are to be stored.
300307

301308
The ``-p`` option maps an external port (9017) to proxy the roundup
302309
server running at port 8080 to the outside.

scripts/Docker/Dockerfile

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ RUN set -xv && CWD=$PWD && \
5656
pip --no-cache-dir install sphinx && \
5757
./configure --prefix=/usr/local --with-python3 --disable-documentation && \
5858
make && make install && \
59+
pip uninstall --no-cache-dir -y sphinx && \
5960
pip uninstall --no-cache-dir -y -r $CWD/sphinxdeps.txt
6061

6162
# add requirements for pip here, e.g. Whoosh, gpg, zstd or other
@@ -64,6 +65,10 @@ RUN set -xv && CWD=$PWD && \
6465
COPY scripts/Docker/requirements.txt .
6566
RUN pip install --no-cache-dir -r requirements.txt
6667

68+
# Allow user to add more modules during build
69+
ARG pip_mod
70+
RUN if [ -n "$pip_mod" ]; then pip install --no-cache-dir ${pip_mod}; fi
71+
6772
# copy the elements of the release directory to the docker image
6873
COPY setup.py install/
6974
COPY doc install/doc/
@@ -118,19 +123,21 @@ COPY --from=build /usr/local/lib/python3.10/site-packages /usr/local/lib/python3
118123
COPY --from=build /usr/local/bin/roundup* /usr/local/bin/
119124
COPY --from=build /usr/local/share /usr/local/share/
120125
COPY scripts/Docker/roundup_start .
126+
COPY scripts/Docker/roundup_healthcheck .
127+
128+
# make roundup scripts execuable and mount a trackerdir on tracker location
129+
RUN chmod +x roundup_start roundup_healthcheck; mkdir tracker
130+
VOLUME $appdir/tracker
121131

122132
# map port 8080 to your local port
123133
EXPOSE 8080/tcp
124134

125-
# mount a trackerdir on tracker location
126-
RUN mkdir tracker
127-
VOLUME $appdir/tracker
128-
129135
HEALTHCHECK --start-period=1m \
130-
CMD wget -q -O /dev/null --no-verbose http://localhost:8080/issues/
136+
CMD ./roundup_healthcheck
131137

132138
# do not run roundup as root. This creates roundup user and group.
133-
RUN adduser -D -h /usr/src/app roundup
139+
ARG roundup_uid
140+
RUN adduser -D -h ${appdir} -u ${roundup_uid:-1000} roundup
134141
USER roundup
135142

136143
# run the server, disable output buffering so we can see logs.

scripts/Docker/roundup_healthcheck

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#! /bin/sh
2+
3+
tracker=$(ps -ef | sed -ne '/roundup-server/s/^.*\s\(\w*\)=.*$/\1/p')
4+
wget -q -O /dev/null --no-verbose http://localhost:8080/$tracker/
5+

0 commit comments

Comments
 (0)