Skip to content

Commit 8daeda0

Browse files
committed
Added FastCGI deployment info, updated Docker docs; docker-compose added
This moves the Docker files to the subdirectory scripts/Docker. Attempted to provide a slightly guided install of a tracker using the roundup_start script It include the docker-compose.yml file donated by Norbert Schlemmer. Hopefully I didn't break it when modifying it for it's new home.
1 parent 5d6b53e commit 8daeda0

File tree

6 files changed

+283
-52
lines changed

6 files changed

+283
-52
lines changed

CHANGES.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,11 @@ Features:
7777
faster response/loading. Also eliminates stalls when the front end web
7878
server uses http 1.1 but the roundup-server uses 1.0. New option
7979
"-V HTTP/1.0" can turn it off. (John Rouillard)
80-
- issue2551163 - add scripts/Dockerfile to provide basic support for
80+
- issue2551163 - add scripts/Docker/Dockerfile to provide basic support for
8181
containerization. See installation.txt for details. (John Rouillard)
82+
- issue2551163 - add scripts/Docker/docker-compose.yml to get a
83+
mysql/roundup deployment. (Norbert Schlemmer, modified by John
84+
Rouilard)
8285
- REST add openapi_doc decorator to add openapi_doc to
8386
endpoints. Decorate a couple of examples. (John Rouillard)
8487
- REST when incorrect method is used, report allowed methods in error

doc/installation.txt

Lines changed: 134 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Installing Roundup
55
==================
66

77
.. contents::
8-
:depth: 2
8+
:depth: 3
99
:local:
1010

1111

@@ -216,70 +216,144 @@ base directory, if you do not want to use administrator rights. If you
216216
choose to do this, you may have to change Python's search path (sys.path)
217217
yourself.
218218

219-
Creating a Docker Container
220-
~~~~~~~~~~~~~~~~~~~~~~~~~~~
219+
Docker Support
220+
~~~~~~~~~~~~~~
221221

222222
If you don't want to install it natively, you can create a Docker
223-
container. This uses the Dockerfile in the scripts directory. The
224-
roundup code in the distribuion and any changes will be used. The
225-
build command is::
223+
container. This installs roundup using the `stand-alone web server`_
224+
method. This is an http only install so we suggest putting an https
225+
terminating proxy in front of it.
226226

227-
docker build -t roundup-app --rm -f scripts/Dockerfile .
227+
This is a work in progress and patches to improve it are welcome. You
228+
can find the docker config files under the `scripts/Docker` directory
229+
of the source tree.
228230

229-
It supports the following backends: anydbm, sqlite, mysql and
230-
postgresql. Mysql and postgresql support hasn't been tested, but the
231-
Python modules are built and available. See scripts/requirement.txt
232-
for the additional modules that are installed.
231+
The dockerized Roundup includes database drivers for anydbm, sqlite,
232+
MySQL and Postgresql (Postgresl is untested). It also includes
233+
additional libraries that are listed in
234+
`scripts/Docker/requirements.txt`.
233235

234-
If you want to build a docker from the latest release on PyPI, you can
235-
use::
236+
Email support is a work in progress. Outgoing email should work given
237+
an external SMTP server. Reciving email should work by using a
238+
scheduled (cron) job to access email:
239+
240+
* `As a regular job using a mailbox source`_
241+
* `As a regular job using a POP source`_
242+
* `As a regular job using an IMAP source`_
243+
244+
Patches for better email support are welcome.
245+
246+
If you want to use a MySQL backend, the `docker-compose.yml` file will
247+
deploy a Roundup container and a MySQL container backend for use with
248+
Roundup.
249+
250+
Building a Docker Container
251+
^^^^^^^^^^^^^^^^^^^^^^^^^^^
252+
253+
To build a docker container using the code in the current directory,
254+
run this build command from the top of the source tree::
255+
256+
docker build -t roundup-app -f scripts/Docker/Dockerfile .
257+
258+
You can also build a container using the newest Roundup release on
259+
PyPI, by running::
236260

237261
docker build -t roundup-app --build-arg="source=pypi" \
238-
--rm -f scripts/Dockerfile .
262+
-f scripts/Docker/Dockerfile .
239263

240-
Once the docker is created, run it with::
264+
The docker declares a single volume mounted at
265+
``/usr/src/app/tracker`` inside the container. You will mount your
266+
tracker home directory at this location.
241267

242-
docker run --rm -p 9017:8080 \
243-
-v /.../issue.tracker:/usr/src/app/tracker \
244-
roundup-app:latest
245268

246-
This will make the tracker available at:
247-
``http://yourhost:9017/issues/``.
269+
Configuring Roundup in the Container
270+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
271+
272+
Once the docker is created using one of the build commands above, run
273+
an interactive session it with::
274+
275+
docker run -it --rm -p 9017:8080 \
276+
-v $PWD/tracker:/usr/src/app/tracker roundup-app:latest
277+
278+
The ``-v`` option maps a directory from the host into the docker
279+
container. Note that uid 1000 is used by roundup. So the uid of the
280+
directory (and all files under it) must be uid 1000. This example
281+
assumes your tracker configs are in the tracker subdirectory. Replace
282+
``$PWD/tracker`` with the full path name to the directory where the
283+
tracker home(s) are to be stored.
248284

249285
The ``-p`` option maps an external port (9017) to proxy the roundup
250-
server running at port 8080 to the outside. The ``-v`` option maps a
251-
directory from the host into the docker container. It should be a
252-
tracker home directory. Note that uid 1000 is used by roundup. So the
253-
uid of the directory must be 1000.
286+
server running at port 8080 to the outside.
254287

255-
If you want to run multiple trackers, create a subdirectory for each
256-
tracker home under the volume mount point. Then invoke ``docker run``
257-
passing the roundup-server tracker specifications like::
288+
If the tracker directory is empty, the docker container will prompt
289+
you to install a tracker template and prompt you for the database
290+
type.
258291

259-
docker run --rm -p 9017:8080 \
260-
-v /.../issue.tracker:/usr/src/app/tracker \
261-
roundup-app:latest tracker1=tracker1_home tracker2=tracker2_home
292+
Once you have edited and configured ``template/config.ini``, (see
293+
`Configuring your first tracker`) run another interactive session
294+
with::
262295

296+
docker run --rm -it -p 9017:8080 \
297+
-v $PWD/tracker:/usr/src/app/tracker roundup-app:latest
263298

264-
This will set up two trackers that can be reached at
265-
``http://yourhost:9017/tracker1/`` and ``http://yourhost:9017/tracker2/``.
299+
this will initialize the database and attempt to start the server. If
300+
that is successful, use control-c to exit the server.
266301

267-
If you need to install and initialize the trackers, you can get a
268-
shell without starting the roundup-server using::
302+
Now start the server non-interactively (note no `-it` option) with::
269303

270-
docker run -it \
271-
-v /.../issue.tracker:/usr/src/app/tracker \
272-
--entrypoint sh roundup-app:latest
304+
docker run -p 9017:8080 \
305+
-v $PWD/tracker:/usr/src/app/tracker roundup-app:latest
273306

274-
Now you can configure your tracker using ``roundup-admin -i tracker``
275-
using the directions below.
307+
Your tracker will be available at: ``http://yourhost:9017/issues/``.
276308

277309
If you need to access your container while the server is running you
278310
can use::
279311

280312
docker exec -it c0d5 sh
281313

282-
where ``c0d5`` is the id prefix for the running container.
314+
where ``c0d5`` is the id prefix for the running container obtained
315+
from ``docker container ls``.
316+
317+
Non-Guided Installation
318+
'''''''''''''''''''''''
319+
320+
If you got a tracker installed using the automatic setup above, you
321+
can skip this section. To manually install and initialize the
322+
trackers, you can get a shell without starting the roundup-server
323+
using::
324+
325+
docker run -it \
326+
-v $PWD/tracker:/usr/src/app/tracker \
327+
--entrypoint sh roundup-app:latest
328+
329+
Now you can configure your tracker using ``roundup-admin -i tracker``
330+
using the directions for `Configuring your first tracker`.
331+
332+
Defining Multiple Trackers
333+
^^^^^^^^^^^^^^^^^^^^^^^^^^
334+
335+
If you want to run multiple trackers, create a subdirectory for each
336+
tracker home under the volume mount point (``$PWD/tracker``). Then
337+
invoke ``docker run`` passing the roundup-server tracker
338+
specifications like::
339+
340+
docker run --rm -p 9017:8080 \
341+
-v /.../issue.tracker:/usr/src/app/tracker \
342+
roundup-app:latest tracker1=tracker/tracker1_home \
343+
tracker2=tracker/tracker2_home
344+
345+
This will set up two trackers that can be reached at
346+
``http://yourhost:9017/tracker1/`` and ``http://yourhost:9017/tracker2/``.
347+
The arguments after roundup-app:latest are tracker paths that are
348+
passed to roundup-server.
349+
350+
Docker-compose Deployment
351+
^^^^^^^^^^^^^^^^^^^^^^^^^
352+
353+
If you want to run using the mysql backend, you can use docker-compose
354+
with ``scripts/Docker/docker-compose.yml``. This will run Roundup and
355+
MySQL in containers. Directions for building using docker-compose are
356+
at the top of the yml file.
283357

284358
Configuring your first tracker
285359
------------------------------
@@ -452,14 +526,9 @@ Configure a Web Interface
452526

453527
There are multiple web interfaces to choose from:
454528

455-
1. `web server cgi-bin`_
456-
2. `cgi-bin for limited-access hosting`_
457-
3. `stand-alone web server`_
458-
4. `Zope product - ZRoundup`_
459-
5. `Apache HTTP Server with mod_wsgi`_
460-
6. `Apache HTTP Server with mod_python`_ (deprecated)
461-
7. `Nginx HTTP Server`_
462-
8. `WSGI Variations`_
529+
.. contents::
530+
:depth: 1
531+
:local:
463532

464533
You may need to give the web server user permission to access the tracker home
465534
- see the `UNIX environment steps`_ for information. You may also need to
@@ -1005,6 +1074,23 @@ in config.ini should be ``https://tracker.example.org``.
10051074
}
10061075

10071076

1077+
FastCGI (Cherokee, Hiawatha, lighttpd)
1078+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1079+
1080+
The Hiawatha and lighttpd web servers can run Roundup using FastCGI.
1081+
Cherokee can run FastCGI but it also supports wsgi directly using a
1082+
uWSGI, Gnuicorn etc.
1083+
1084+
To run Roundup suing FastCGI, the flup_ package can be used under
1085+
Python 2 and Python 3. We don't have a detailed config for this, but
1086+
the basic idea can be found at:
1087+
https://flask.palletsprojects.com/en/2.0.x/deploying/fastcgi/
1088+
1089+
If you have deployed Roundup using FastCGI and flup we welcome example
1090+
configuration files and instructions.
1091+
1092+
.. _flup: https://pypi.org/project/flup/
1093+
10081094
WSGI Variations
10091095
~~~~~~~~~~~~~~~
10101096

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ RUN apk add \
4141
# add requirements for pip here, e.g. Whoosh, gpg, zstd or other
4242
# modules not installed in the base library.
4343
# ignore warnings from pip to use virtualenv
44-
COPY scripts/requirements.txt .
44+
COPY scripts/Docker/requirements.txt .
4545
RUN pip install --no-cache-dir -r requirements.txt
4646

4747
# copy the elements of the release directory to the docker image
@@ -66,7 +66,7 @@ RUN set -xv && if [ "$source" = "local" ] || \
6666
if [ "$source" = "local_pip" ]; then cd install && pip install \
6767
--use-feature=in-tree-build . ; fi; \
6868
if [ "$source" = "pypi" ]; then pip install roundup; \
69-
cp -ril /usr/local/lib/python3.10/site-packages/usr/local/share/* \
69+
cp -ril /usr/local/lib/python3.10/site-packages/usr/local/share/* \
7070
/usr/local/share; fi
7171

7272
# build a new smaller docker image for execution. Build image above
@@ -94,6 +94,7 @@ LABEL "org.roundup-tracker.vendor"="Roundup Issue Tracker Team" \
9494
COPY --from=build /usr/local/lib/python3.10/site-packages /usr/local/lib/python3.10/site-packages/
9595
COPY --from=build /usr/local/bin/roundup* /usr/local/bin/
9696
COPY --from=build /usr/local/share /usr/local/share/
97+
COPY scripts/Docker/roundup_start .
9798

9899
# map port 8080 to your local port
99100
EXPOSE 8080/tcp
@@ -111,7 +112,8 @@ USER roundup
111112

112113
# run the server, disable output buffering so we can see logs.
113114
ENV PYTHONUNBUFFERED=1
114-
ENTRYPOINT [ "roundup-server", "-n", "0.0.0.0" ]
115+
#ENTRYPOINT [ "roundup-server", "-n", "0.0.0.0" ]
116+
ENTRYPOINT [ "./roundup_start" ]
115117

116118
# allow the invoker to override cmd with multiple trackers
117119
# in each subdirectory under $appdir/tracker. E.G.

scripts/Docker/docker-compose.yml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# docker-roundup
2+
# roundup issue tracker application with mariadb running as docker container
3+
#
4+
# docker-compose.yml
5+
#
6+
# Build components:
7+
# docker-compose -f scripts/Docker/docker-compose.yml build
8+
#
9+
# Install tracker template:
10+
# $ docker-compose -f scripts/Docker/docker-compose.yml run \
11+
# --rm --entrypoint roundup-admin --no-deps roundup-app \
12+
# -i tracker install
13+
#
14+
# Edit scripts/Docker/tracker/config.ini configure database settings
15+
# and any NO DEFAULT settings.
16+
#
17+
# Initialize the database, wait 1 minute so
18+
#
19+
# $ docker-compose -f scripts/Docker/docker-compose.yml run \
20+
# --rm --entrypoint roundup-admin roundup-app \
21+
# -i tracker
22+
#
23+
# wait 1 minute for mariadb to initialize
24+
# init tracker at roundup prompt
25+
#
26+
# roundup> init
27+
# roundup> exit
28+
#
29+
# may need ^\ to get roundup-admin to exit.
30+
#
31+
# run
32+
# docker-compose -f scripts/Docker/docker-compose.yml up
33+
#
34+
# tracker should be running at port 9017.
35+
36+
# Note: mysql volume and tracker directories will be put in the
37+
# scripts/Docker subdir.
38+
# Paths for volumes are relative to docker-compose.yml location not
39+
# docker-compose cwd or build context directory.
40+
41+
version: '3'
42+
services:
43+
mariadb:
44+
image: lscr.io/linuxserver/mariadb
45+
container_name: mariadb
46+
restart: unless-stopped
47+
environment:
48+
- PUID=1000
49+
- PGID=1000
50+
- TZ=America/New_York
51+
- MYSQL_ROOT_PASSWORD=myPassword
52+
- MYSQL_DATABASE=roundup
53+
- MYSQL_USER=roundup_user
54+
- MYSQL_PASSWORD=roundup_pass
55+
# ports:
56+
# - 3306:3306
57+
volumes:
58+
- ./dbData:/config
59+
60+
roundup-app:
61+
container_name: roundup-app
62+
build:
63+
context: ../..
64+
dockerfile: scripts/Docker/Dockerfile
65+
args:
66+
source: local_pip
67+
#source: local
68+
#source: pypi
69+
command: "issues=tracker"
70+
restart: unless-stopped
71+
environment:
72+
- TZ=America/New_York
73+
ports:
74+
- 9017:8080
75+
links:
76+
- mariadb
77+
depends_on:
78+
- mariadb
79+
volumes:
80+
# will be placed in Docker subdir next to this file
81+
- ./tracker:/usr/src/app/tracker

0 commit comments

Comments
 (0)