Configuration variables in Docker
Hey there, we installed the latest Docker version of Mailman3 and it seems to work for now. But I have 2 problems with configuration:
## DJANGO_ALLOWED_HOSTS
Here it says, that allowed hosts can be added: https://asynchronous.in/docker-mailman/web/
How de we add multiple hosts? Did I miss something? When we set 1 URL, everything works (with 2(!) Domains, since SERVE_FROM_DOMAIN is the first one). Is there a way I miss to input multiple hosts, that the variable is an array? We tried:
- DJANGO_ALLOWED_HOSTS=example1.com,example2.com
- DJANGO_ALLOWED_HOSTS='example1.com, example2.com'
- DJANGO_ALLOWED_HOSTS=example1.com example2.com
- DJANGO_ALLOWED_HOSTS=example1.com,\nexample2.com
And I think some more, but never works. The corresponding config file says:
ALLOWED_HOSTS = [ "localhost", # Archiving API from Mailman, keep it. # "lists.your-domain.org", # Add here all production URLs you may have. "mailman-web", "172.19.199.3", os.environ.get('SERVE_FROM_DOMAIN'), os.environ.get('DJANGO_ALLOWED_HOSTS'), ]
-> how is it possible to add an array for multiple Domains? -> if not possible, shall we provide a fix that it is?
## FILTER_VHOST
I want this variable to be true in my container. When I set it as a starting variable like the other configuration options, then the variable in the container seems to be set:
<code> # export | grep FILTER_VHOST= declare -x FILTER_VHOST="True" </code>
But surely it still is set to false in mm-web-container:
<code> # cat settings.py | grep FILTER_VHOST FILTER_VHOST = False </code>
-> is it ok to put the variable like that!? -> if not, how can it be done, that it is preserved on restarting the container? -> if I see it right, it could be then something like: <code> FILTER_VHOST = os.environ.get('FILTER_VHOST_DOCKER'), </code> -> with some more exceptions-handling, it might work?
Thanks in advance, Jens.
On Apr 8, 2021, at 6:49 AM, Jens Günther <jens.guenther@posteo.de> wrote:
Hey there, we installed the latest Docker version of Mailman3 and it seems to work for now. But I have 2 problems with configuration:
## DJANGO_ALLOWED_HOSTS
Here it says, that allowed hosts can be added: https://asynchronous.in/docker-mailman/web/
How de we add multiple hosts? Did I miss something? When we set 1 URL, everything works (with 2(!) Domains, since SERVE_FROM_DOMAIN is the first one). Is there a way I miss to input multiple hosts, that the variable is an array? We tried:
- DJANGO_ALLOWED_HOSTS=example1.com,example2.com
- DJANGO_ALLOWED_HOSTS='example1.com, example2.com'
- DJANGO_ALLOWED_HOSTS=example1.com example2.com
- DJANGO_ALLOWED_HOSTS=example1.com,\nexample2.com
Multiple hosts aren’t allowed in the env var as you can already see from the config file that you added below.
Although, comma separated multiple values are something we can add as an extension if you are willing to implement and create a Pull Request on the Github Repo. You have already found the place to make the change.
If you want to add multiple hosts, you can override ALLOWED_HOSTS in your /opt/mailman/web/settings_local.py.
And I think some more, but never works. The corresponding config file says:
ALLOWED_HOSTS = [ "localhost", # Archiving API from Mailman, keep it. # "lists.your-domain.org", # Add here all production URLs you may have. "mailman-web", "172.19.199.3", os.environ.get('SERVE_FROM_DOMAIN'), os.environ.get('DJANGO_ALLOWED_HOSTS'), ]
-> how is it possible to add an array for multiple Domains? -> if not possible, shall we provide a fix that it is?
## FILTER_VHOST
I want this variable to be true in my container. When I set it as a starting variable like the other configuration options, then the variable in the container seems to be set:
<code> # export | grep FILTER_VHOST= declare -x FILTER_VHOST="True" </code>
But surely it still is set to false in mm-web-container:
<code> # cat settings.py | grep FILTER_VHOST FILTER_VHOST = False </code>
-> is it ok to put the variable like that!?
Not all variables are accepted as environment variables. Except the ones documented, all the Mailman settings would need to go in the configuration file mentioned above.
-> if not, how can it be done, that it is preserved on restarting the container?
You do want to restart the container regardless of how you set it. Applications that are already running won’t pick up any dynamic changes you made in the environment of your shell after logging in.
-> if I see it right, it could be then something like: <code> FILTER_VHOST = os.environ.get('FILTER_VHOST_DOCKER'),
This would work, except you need to provide a default value in the .get() call
and the environment variable should be pre-pended with MAILMAN_
instead
of _DOCKER
suffix.
FILTER_VHOST = os.environ.get(‘MAILMAN_FILTER_VHOST’, False)
You can open a Pull Request, this can also go into the images from next release.
-- thanks, Abhilash Raj (maxking)
participants (2)
-
Abhilash Raj
-
Jens Günther