Mercurial > p > roundup > code
changeset 6797:a24ec63759f6
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.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Thu, 21 Jul 2022 00:54:52 -0400 |
| parents | 5ded9d537eb9 |
| children | 863c63b73315 |
| files | doc/installation.txt scripts/Docker/Dockerfile scripts/Docker/roundup_healthcheck |
| diffstat | 3 files changed, 31 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/doc/installation.txt Tue Jul 19 22:53:35 2022 -0400 +++ b/doc/installation.txt Thu Jul 21 00:54:52 2022 -0400 @@ -279,8 +279,14 @@ The docker declares a single volume mounted at ``/usr/src/app/tracker`` inside the container. You will mount your -tracker home directory at this location. +tracker home directory at this location. The ``/usr/src/app`` path can +be changed by using ``--build-args=/new/path``. +You can also add additional modules to the docker container by using +`--build-args="pip_mod=requests setproctitle"`. + +By default the container runs Roundup using UID 1000. By setting +`--build-args="roundup_uid=2000"` you can change the UID. Configuring Roundup in the Container ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -292,11 +298,12 @@ -v $PWD/tracker:/usr/src/app/tracker roundup-app:latest The ``-v`` option maps a directory from the host into the docker -container. Note that uid 1000 is used by roundup. So the uid of the -directory (and all files under it) must be uid 1000. This example -assumes your tracker configs are in the tracker subdirectory. Replace -``$PWD/tracker`` with the full path name to the directory where the -tracker home(s) are to be stored. +container. Note that uid 1000 is used by roundup by default. The uid +of the directory (and all files under it) must match the uid. You can +set the UID at image build time, see above. This +example assumes your tracker configs are in the tracker +subdirectory. Replace ``$PWD/tracker`` with the full path name to the +directory where the tracker home(s) are to be stored. The ``-p`` option maps an external port (9017) to proxy the roundup server running at port 8080 to the outside.
--- a/scripts/Docker/Dockerfile Tue Jul 19 22:53:35 2022 -0400 +++ b/scripts/Docker/Dockerfile Thu Jul 21 00:54:52 2022 -0400 @@ -56,6 +56,7 @@ pip --no-cache-dir install sphinx && \ ./configure --prefix=/usr/local --with-python3 --disable-documentation && \ make && make install && \ + pip uninstall --no-cache-dir -y sphinx && \ pip uninstall --no-cache-dir -y -r $CWD/sphinxdeps.txt # add requirements for pip here, e.g. Whoosh, gpg, zstd or other @@ -64,6 +65,10 @@ COPY scripts/Docker/requirements.txt . RUN pip install --no-cache-dir -r requirements.txt +# Allow user to add more modules during build +ARG pip_mod +RUN if [ -n "$pip_mod" ]; then pip install --no-cache-dir ${pip_mod}; fi + # copy the elements of the release directory to the docker image COPY setup.py install/ COPY doc install/doc/ @@ -118,19 +123,21 @@ COPY --from=build /usr/local/bin/roundup* /usr/local/bin/ COPY --from=build /usr/local/share /usr/local/share/ COPY scripts/Docker/roundup_start . +COPY scripts/Docker/roundup_healthcheck . + +# make roundup scripts execuable and mount a trackerdir on tracker location +RUN chmod +x roundup_start roundup_healthcheck; mkdir tracker +VOLUME $appdir/tracker # map port 8080 to your local port EXPOSE 8080/tcp -# mount a trackerdir on tracker location -RUN mkdir tracker -VOLUME $appdir/tracker - HEALTHCHECK --start-period=1m \ - CMD wget -q -O /dev/null --no-verbose http://localhost:8080/issues/ + CMD ./roundup_healthcheck # do not run roundup as root. This creates roundup user and group. -RUN adduser -D -h /usr/src/app roundup +ARG roundup_uid +RUN adduser -D -h ${appdir} -u ${roundup_uid:-1000} roundup USER roundup # run the server, disable output buffering so we can see logs.
