Merge pull request #397 from danil-smirnov/gunicorn-configurable
Allow configuring Gunicorn configuration for Mailman Core easily using a special gunicorn-extra.cfg config file.
This commit is contained in:
@@ -61,6 +61,18 @@ standard version of docker-compose.yaml from this repository.
|
|||||||
|
|
||||||
- `HYPERKITTY_URL`: Default value is `http://mailman-web:8000/hyperkitty`
|
- `HYPERKITTY_URL`: Default value is `http://mailman-web:8000/hyperkitty`
|
||||||
|
|
||||||
|
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
|
Running Mailman-Core
|
||||||
====================
|
====================
|
||||||
|
|
||||||
@@ -103,6 +115,7 @@ hostname: $MM_HOSTNAME
|
|||||||
port: $MAILMAN_REST_PORT
|
port: $MAILMAN_REST_PORT
|
||||||
admin_user: $MAILMAN_REST_USER
|
admin_user: $MAILMAN_REST_USER
|
||||||
admin_pass: $MAILMAN_REST_PASSWORD
|
admin_pass: $MAILMAN_REST_PASSWORD
|
||||||
|
configuration: /etc/gunicorn.cfg
|
||||||
|
|
||||||
[archiver.hyperkitty]
|
[archiver.hyperkitty]
|
||||||
class: mailman_hyperkitty.Archiver
|
class: mailman_hyperkitty.Archiver
|
||||||
|
|||||||
@@ -123,6 +123,7 @@ hostname: $MM_HOSTNAME
|
|||||||
port: $MAILMAN_REST_PORT
|
port: $MAILMAN_REST_PORT
|
||||||
admin_user: $MAILMAN_REST_USER
|
admin_user: $MAILMAN_REST_USER
|
||||||
admin_pass: $MAILMAN_REST_PASSWORD
|
admin_pass: $MAILMAN_REST_PASSWORD
|
||||||
|
configuration: /etc/gunicorn.cfg
|
||||||
|
|
||||||
[archiver.hyperkitty]
|
[archiver.hyperkitty]
|
||||||
class: mailman_hyperkitty.Archiver
|
class: mailman_hyperkitty.Archiver
|
||||||
@@ -131,6 +132,10 @@ configuration: /etc/mailman-hyperkitty.cfg
|
|||||||
|
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
# Generate a basic 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
|
# Generate a basic configuration to use exim
|
||||||
cat > /tmp/exim-mailman.cfg <<EOF
|
cat > /tmp/exim-mailman.cfg <<EOF
|
||||||
[mta]
|
[mta]
|
||||||
@@ -186,6 +191,11 @@ then
|
|||||||
cat /opt/mailman/mailman-extra.cfg >> /etc/mailman.cfg
|
cat /opt/mailman/mailman-extra.cfg >> /etc/mailman.cfg
|
||||||
fi
|
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
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ ! -v HYPERKITTY_API_KEY ]]; then
|
if [[ ! -v HYPERKITTY_API_KEY ]]; then
|
||||||
echo "HYPERKITTY_API_KEY not defined, please set this environment variable..."
|
echo "HYPERKITTY_API_KEY not defined, please set this environment variable..."
|
||||||
|
|||||||
Reference in New Issue
Block a user