From 6774539d2957a53126470e208ccc6e099d8c19b9 Mon Sep 17 00:00:00 2001 From: Danil Smirnov Date: Sun, 23 Aug 2020 11:06:18 +0000 Subject: [PATCH 1/7] Making Gunicorn configurable --- core/docker-entrypoint.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/core/docker-entrypoint.sh b/core/docker-entrypoint.sh index cda6cbc..73800d4 100755 --- a/core/docker-entrypoint.sh +++ b/core/docker-entrypoint.sh @@ -123,6 +123,7 @@ hostname: $MM_HOSTNAME port: $MAILMAN_REST_PORT admin_user: $MAILMAN_REST_USER admin_pass: $MAILMAN_REST_PASSWORD +configuration: /etc/gunicorn.cfg [archiver.hyperkitty] class: mailman_hyperkitty.Archiver @@ -131,6 +132,9 @@ configuration: /etc/mailman-hyperkitty.cfg EOF +# Generate a basic gunicorn.cfg. +echo '[gunicorn]' > /etc/gunicorn.cfg + # Generate a basic configuration to use exim cat > /tmp/exim-mailman.cfg <> /etc/mailman.cfg fi +if [[ -e /opt/mailman/gunicorn-extra.cfg ]] +then + echo "Found configuration file at /opt/mailman/gunicorn-extra.cfg" + cat /opt/mailman/gunicorn-extra.cfg >> /etc/gunicorn.cfg +fi if [[ ! -v HYPERKITTY_API_KEY ]]; then echo "HYPERKITTY_API_KEY not defined, please set this environment variable..." From 06d36659215cc7a47fe5afffc35cb512e9eda525 Mon Sep 17 00:00:00 2001 From: Danil Smirnov Date: Sun, 23 Aug 2020 11:21:47 +0000 Subject: [PATCH 2/7] Updating README --- core/README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/README.md b/core/README.md index fcee306..ad16ca9 100644 --- a/core/README.md +++ b/core/README.md @@ -61,6 +61,9 @@ standard version of docker-compose.yaml from this repository. - `HYPERKITTY_URL`: Default value is `http://mailman-web:8000/hyperkitty` +In case of a need for fine tuning of Gunicorn web-server (e.g. for raising of timeouts) +`/opt/mailman/gunicorn-extra.cfg` file could be provided holding necessary parameters. + Running Mailman-Core ==================== From 071737f72d8549b00fbba8b29043a443e89f447d Mon Sep 17 00:00:00 2001 From: Danil Smirnov <27999539+danil-smirnov@users.noreply.github.com> Date: Mon, 24 Aug 2020 16:51:49 +0300 Subject: [PATCH 3/7] Suggested change in core/README.md Co-authored-by: Abhilash Raj --- core/README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/core/README.md b/core/README.md index ad16ca9..ba09e53 100644 --- a/core/README.md +++ b/core/README.md @@ -61,8 +61,7 @@ standard version of docker-compose.yaml from this repository. - `HYPERKITTY_URL`: Default value is `http://mailman-web:8000/hyperkitty` -In case of a need for fine tuning of Gunicorn web-server (e.g. for raising of timeouts) -`/opt/mailman/gunicorn-extra.cfg` file could be provided holding necessary parameters. +In case of a need for fine tuning of REST API web-server that uses [Gunicorn](https://docs.gunicorn.org/en/stable/settings.html) (e.g. for raising of timeouts) `/opt/mailman/core/gunicorn-extra.cfg` file could be provided holding necessary configuration options. Running Mailman-Core ==================== From 20fbfe6e77aae7f5710a54fb569d6c711ce7388e Mon Sep 17 00:00:00 2001 From: Danil Smirnov <27999539+danil-smirnov@users.noreply.github.com> Date: Mon, 24 Aug 2020 16:52:00 +0300 Subject: [PATCH 4/7] Suggested change in core/docker-entrypoint.sh Co-authored-by: Abhilash Raj --- core/docker-entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/docker-entrypoint.sh b/core/docker-entrypoint.sh index 73800d4..056390c 100755 --- a/core/docker-entrypoint.sh +++ b/core/docker-entrypoint.sh @@ -192,7 +192,7 @@ fi if [[ -e /opt/mailman/gunicorn-extra.cfg ]] then - echo "Found configuration file at /opt/mailman/gunicorn-extra.cfg" + echo "Found [webserver] configuration file at /opt/mailman/gunicorn-extra.cfg" cat /opt/mailman/gunicorn-extra.cfg >> /etc/gunicorn.cfg fi From 828493645410e8124ed5357209b87deda0882ef3 Mon Sep 17 00:00:00 2001 From: Danil Smirnov Date: Mon, 24 Aug 2020 14:07:09 +0000 Subject: [PATCH 5/7] Respect gunicorn.cfg shipped with Mailman core --- core/docker-entrypoint.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/docker-entrypoint.sh b/core/docker-entrypoint.sh index 056390c..1f5e23d 100755 --- a/core/docker-entrypoint.sh +++ b/core/docker-entrypoint.sh @@ -133,7 +133,8 @@ configuration: /etc/mailman-hyperkitty.cfg EOF # Generate a basic gunicorn.cfg. -echo '[gunicorn]' > /etc/gunicorn.cfg +SITE_DIR=$(python3 -c 'import site; print(site.getsitepackages()[0])') +cp "${SITE_DIR}/mailman/config/gunicorn.cfg" /etc/gunicorn.cfg # Generate a basic configuration to use exim cat > /tmp/exim-mailman.cfg < Date: Tue, 25 Aug 2020 13:08:14 +0000 Subject: [PATCH 6/7] Won't append configuration to avoid parameters duplication --- core/docker-entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/docker-entrypoint.sh b/core/docker-entrypoint.sh index 1f5e23d..c0d8d38 100755 --- a/core/docker-entrypoint.sh +++ b/core/docker-entrypoint.sh @@ -194,7 +194,7 @@ fi if [[ -e /opt/mailman/gunicorn-extra.cfg ]] then echo "Found [webserver] configuration file at /opt/mailman/gunicorn-extra.cfg" - cat /opt/mailman/gunicorn-extra.cfg >> /etc/gunicorn.cfg + cat /opt/mailman/gunicorn-extra.cfg > /etc/gunicorn.cfg fi if [[ ! -v HYPERKITTY_API_KEY ]]; then From 2b84aea40fb434350e61e31183b45ba6a23b76d2 Mon Sep 17 00:00:00 2001 From: Danil Smirnov <27999539+danil-smirnov@users.noreply.github.com> Date: Tue, 25 Aug 2020 16:18:25 +0300 Subject: [PATCH 7/7] Update README.md --- core/README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/core/README.md b/core/README.md index ba09e53..9c54ab4 100644 --- a/core/README.md +++ b/core/README.md @@ -63,6 +63,16 @@ standard version of docker-compose.yaml from this repository. In case of a need for fine tuning of REST API web-server that uses [Gunicorn](https://docs.gunicorn.org/en/stable/settings.html) (e.g. for raising of timeouts) `/opt/mailman/core/gunicorn-extra.cfg` file could be provided holding necessary configuration options. +Configuration file, [shipped with Mailman Core](https://gitlab.com/mailman/mailman/-/blob/master/src/mailman/config/gunicorn.cfg), is used by default. + +For example, to increase the default 30 sec timeout, which won't work for some API calls to highly populated lists, provide the following `gunicorn-extra.cfg` file: + +``` +[gunicorn] +graceful_timeout = 30 +timeout = 300 +``` + Running Mailman-Core ==================== @@ -105,6 +115,7 @@ hostname: $MM_HOSTNAME port: $MAILMAN_REST_PORT admin_user: $MAILMAN_REST_USER admin_pass: $MAILMAN_REST_PASSWORD +configuration: /etc/gunicorn.cfg [archiver.hyperkitty] class: mailman_hyperkitty.Archiver