Trying basic install of mailman3 in docker, but how do you set allowed hosts?
I am starting small, My goal is just to get mailman3 running in docker and test the website access via curl from the host, then I will move on from there
In the docker instructions it says
SERVE_FROM_DOMAIN: The domain name from which Django will be served. To be added to ALLOWED_HOSTS in django settings. Default value is not set. This also replaces Django's default example.com SITE and becomes the default SITE (with SITE_ID=1).
But where do I set the ALLOWED_HOSTS I added this to the yaml file - ALLOWED_HOSTS=127.0.0.1 under environments
mailman-web:
image: maxking/mailman-web:0.3
container_name: mailman-web
hostname: mailman-web
depends_on:
- database
links:
- mailman-core:mailman-core
- database:database
volumes:
- /opt/mailman/web:/opt/mailman-web-data
environment:
- UWSGI_STATIC_MAP=/static=/opt/mailman-web-data/static
- ALLOWED_HOSTS=127.0.0.1
- DATABASE_TYPE=postgres
- DATABASE_URL=postgres://mailman:mailmanpass@database/mailmandb
- SECRET_KEY=333blah-blah-secret
- HYPERKITTY_API_KEY=333someapikey
ports:
- "127.0.0.1:8000:8000" # HTTP
- "127.0.0.1:8080:8080" # uwsgi
networks:
mailman:
But when I try: [docker-mailman]# curl 127.0.0.1:8000 <h1>Bad Request (400)</h1>[root@bmimailmandr1 docker-mailman]# [root@bmimailmandr1 docker-mailman]#
I see this in the logs
[docker-mailman]# cat /opt/mailman/web/logs/mailmanweb.log
WARNING 2021-07-08 17:40:46,979 1642 django.request Bad Request: /
ERROR 2021-07-08 19:20:58,416 1641 django.security.DisallowedHost Invalid HTTP_HOST header: '127.0.0.1:8000'. You may need to add '127.0.0.1' to ALLOWED_HOSTS.
WARNING 2021-07-08 19:20:59,032 1641 django.request Bad Request: /
WARNING 2021-07-08 19:20:59,032 1641 django.request Bad Request: /
On Thu, Jul 8, 2021, at 12:23 PM, bob B wrote:
I am starting small, My goal is just to get mailman3 running in docker and test the website access via curl from the host, then I will move on from there
In the docker instructions it says
SERVE_FROM_DOMAIN: The domain name from which Django will be served. To be added to ALLOWED_HOSTS in django settings. Default value is not set. This also replaces Django's default example.com SITE and becomes the default SITE (with SITE_ID=1).
Perhaps that is my English there, but what it really meant to say was you should set "SERVE_FROM_DOMAIN" in your "environment" section of the docker-compose.yaml file and it will add the value of that variable to Django's ALLOWED_HOSTS settings for you 1.
If you think it could be re-worded for clarity, please feel free to let me know or open a PR in the Github repo.
Also, "localhost" is already added to the list of ALLOWED_HOSTS, so if you are able to point to the container using that, it should work without setting the SERVE_FROM_DOMAIN.
Abhilash
But where do I set the ALLOWED_HOSTS I added this to the yaml file
ALLOWED_HOSTS=127.0.0.1 under environments
mailman-web: image: maxking/mailman-web:0.3 container_name: mailman-web hostname: mailman-web depends_on: - database links: - mailman-core:mailman-core - database:database volumes: - /opt/mailman/web:/opt/mailman-web-data environment: - UWSGI_STATIC_MAP=/static=/opt/mailman-web-data/static - ALLOWED_HOSTS=127.0.0.1 - DATABASE_TYPE=postgres - DATABASE_URL=postgres://mailman:mailmanpass@database/mailmandb - SECRET_KEY=333blah-blah-secret - HYPERKITTY_API_KEY=333someapikey ports: - "127.0.0.1:8000:8000" # HTTP - "127.0.0.1:8080:8080" # uwsgi networks: mailman:
But when I try: [docker-mailman]# curl 127.0.0.1:8000 <h1>Bad Request (400)</h1>[root@bmimailmandr1 docker-mailman]# [root@bmimailmandr1 docker-mailman]#
I see this in the logs
[docker-mailman]# cat /opt/mailman/web/logs/mailmanweb.log WARNING 2021-07-08 17:40:46,979 1642 django.request Bad Request: / ERROR 2021-07-08 19:20:58,416 1641 django.security.DisallowedHost
Invalid HTTP_HOST header: '127.0.0.1:8000'. You may need to add '127.0.0.1' to ALLOWED_HOSTS. WARNING 2021-07-08 19:20:59,032 1641 django.request Bad Request: / WARNING 2021-07-08 19:20:59,032 1641 django.request Bad Request: /
Mailman-users mailing list -- mailman-users@mailman3.org To unsubscribe send an email to mailman-users-leave@mailman3.org https://lists.mailman3.org/mailman3/lists/mailman-users.mailman3.org/
-- thanks, Abhilash Raj (maxking)
participants (2)
-
Abhilash Raj
-
bob B