Merge "Use magic domain guessing in Mailman 3"

This commit is contained in:
Zuul 2023-08-15 22:58:42 +00:00 committed by Gerrit Code Review
commit 920afd7087
2 changed files with 61 additions and 2 deletions

View File

@ -1,6 +1,6 @@
# This file has been copied from:
# https://github.com/maxking/docker-mailman/blob/2693386453ff3865b7c106c6aa456b683bd3bf08/web/mailman-web/settings.py
# In order to override the ALLOWED_HOSTS setting.
# In order to override the ALLOWED_HOSTS and SITE_ID settings.
#
# -*- coding: utf-8 -*-
# Copyright (C) 1998-2016 by the Free Software Foundation, Inc.
@ -47,7 +47,8 @@ ADMINS = (
('Mailman Suite Admin', 'root@localhost'),
)
SITE_ID = 1
# Magic value to perform automatic domain guessing
SITE_ID = 0
# Hosts/domain names that are valid for this site; required if DEBUG is False
# See https://docs.djangoproject.com/en/3.1/ref/settings/#allowed-hosts

View File

@ -77,6 +77,21 @@
group: 101
mode: '0644'
- name: Check for initial setup flag file
stat:
path: /var/lib/mailman/bootstrapped
register: _mailman_bootstrapped
# https://docs.mailman3.org/en/latest/faq.html#the-domain-name-displayed-in-hyperkitty-shows-example-com-or-something-else
- name: Temporarily turn off magic domain guessing
lineinfile:
state: present
backrefs: yes
path: /var/lib/mailman/web/settings.py
regexp: '^SITE_ID = 0$'
line: 'SITE_ID = 1'
when: not _mailman_bootstrapped.stat.exists
- name: Copy our settings_local.py for mailman-web
copy:
src: web-settings_local.py
@ -228,6 +243,49 @@
--email '{{ mailman3_admin_email }}'"
no_log: true
- name: Complete new server bootstrapping
when: not _mailman_bootstrapped.stat.exists
block:
- name: Run docker-compose down
shell:
cmd: docker-compose down
chdir: /etc/mailman-compose/
- name: Turn magic domain guessing back on
lineinfile:
state: present
backrefs: yes
path: /var/lib/mailman/web/settings.py
regexp: '^SITE_ID = 0$'
line: 'SITE_ID = 1'
- name: Create the bootstrapped flag file
copy:
content: ""
dest: /var/lib/mailman/bootstrapped
force: no
owner: 100
group: 101
mode: '0644'
- name: Run docker-compose up
shell:
cmd: docker-compose up -d
chdir: /etc/mailman-compose/
- name: Wait for mm3 REST API to be up and running
uri:
url: 'http://localhost:8001/3.1/domains'
url_username: restadmin
url_password: "{{ mailman3_rest_password }}"
force_basic_auth: yes
method: GET
register: mm_rest_api_up
delay: 1
retries: 300
until: mm_rest_api_up and mm_rest_api_up.status == 200
no_log: true
- name: Create lists in mm3
include_tasks: create_lists.yaml
loop: "{{ mailman_sites }}"