Upgrade to latest Mailman 3 releases

New releases info:

https://lists.mailman3.org/archives/list/mailman-users@mailman3.org/thread/4U5AP7GZ76NYQONACUVPDHSJBLLBSENL/

Sync all our forked files from mailman-docker to the current
upstream state, except for our overridden hyperkitty->archives and
postorius->mailman3 URL routes in
docker/mailman/web/mailman-web/urls.py.

Change-Id: I3b3955c8b2b91f167510c8a1122d9d8e2d620082
This commit is contained in:
Jeremy Stanley 2023-10-25 19:37:06 +00:00
parent b79818feae
commit b312e15b57
8 changed files with 15 additions and 16 deletions

View File

@ -1,4 +1,3 @@
# 2023-08-25T16:35:09 UTC - trigger rebuild
# syntax = docker/dockerfile:1.3
# Use 3.15 for Core since it has Python 3.9
FROM alpine:3.18
@ -22,6 +21,7 @@ RUN --mount=type=cache,target=/root/.cache \
gunicorn==19.9.0 \
pymysql \
-r /tmp/requirements.txt \
'importlib-resources<6.0.0' \
&& apk del build-deps \
&& adduser -S mailman

View File

@ -67,7 +67,7 @@ function setup_database () {
# Translate mysql:// urls to mysql+mysql:// backend:
if [[ "$DATABASE_URL" == mysql://* ]]; then
DATABASE_URL="mysql+pymysql://${DATABASE_URL:8}"
echo "Database URL was automatically rewritten to: $DATABASE_URL"
echo "Database URL prefix was automatically rewritten to: mysql+pymysql://"
fi
# If DATABASE_CLASS is not set, guess it for common databases:

View File

@ -1,8 +1,5 @@
# This is a separate file from Dockerfile so that we can use dependabot
# for version updates that isn't supported for contents inside the
# Dockerfile.
mailman==3.3.8
mailman-hyperkitty==1.2.1
# mailman/config/config.py "from importlib_resources import path" ImportError
# remove when https://gitlab.com/mailman/mailman/-/issues/1093 is solved
importlib_resources<6
mailman==3.3.9
mailman-hyperkitty==1.2.1

View File

@ -1,5 +1,5 @@
# syntax = docker/dockerfile:1.3
FROM alpine:3.18.2
FROM alpine:3.18.4
# Add needed files for uwsgi server + settings for django
COPY mailman-web /opt/mailman-web

View File

@ -118,12 +118,12 @@ echo "Compiling locale files in $SITE_DIR"
cd $SITE_DIR && /opt/mailman-web/manage.py compilemessages && cd -
# Compress static files.
python3 manage.py compress --force
python3 /opt/mailman-web/manage.py compress --force
# Migrate all the data to the database if this is a new installation, otherwise
# this command will upgrade the database.
python3 manage.py migrate
python3 /opt/mailman-web/manage.py migrate
# If MAILMAN_ADMIN_USER and MAILMAN_ADMIN_EMAIL is defined create a new
# superuser for Django. There is no password setup so it can't login yet unless
@ -131,7 +131,7 @@ python3 manage.py migrate
if [[ -v MAILMAN_ADMIN_USER ]] && [[ -v MAILMAN_ADMIN_EMAIL ]];
then
echo "Creating admin user $MAILMAN_ADMIN_USER ..."
python3 manage.py createsuperuser --noinput --username "$MAILMAN_ADMIN_USER"\
python3 /opt/mailman-web/manage.py createsuperuser --noinput --username "$MAILMAN_ADMIN_USER"\
--email "$MAILMAN_ADMIN_EMAIL" 2> /dev/null || \
echo "Superuser $MAILMAN_ADMIN_USER already exists"
fi
@ -141,7 +141,7 @@ fi
if [[ -v SERVE_FROM_DOMAIN ]];
then
echo "Setting $SERVE_FROM_DOMAIN as the default domain ..."
python3 manage.py shell -c \
python3 /opt/mailman-web/manage.py shell -c \
"from django.contrib.sites.models import Site; Site.objects.filter(domain='example.com').update(domain='$SERVE_FROM_DOMAIN', name='$SERVE_FROM_DOMAIN')"
fi

View File

@ -107,6 +107,7 @@ MIDDLEWARE = (
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.security.SecurityMiddleware',
'allauth.account.middleware.AccountMiddleware',
'django_mailman3.middleware.TimezoneMiddleware',
'postorius.middleware.PostoriusMiddleware',
)

View File

@ -1,4 +1,4 @@
mailmanclient==3.3.5
postorius==1.3.8
hyperkitty==1.3.7
django-mailman3==1.3.9
postorius==1.3.10
hyperkitty==1.3.8
django-mailman3==1.3.11

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
#
# This file has been copied from:
# https://github.com/maxking/docker-mailman/blob/57a2f54/web/mailman-web/settings.py
# https://github.com/maxking/docker-mailman/blob/ab8dfb3/web/mailman-web/settings.py
# In order to override the ALLOWED_HOSTS and SITE_ID settings.
#
# Copyright (C) 1998-2016 by the Free Software Foundation, Inc.
@ -114,6 +114,7 @@ MIDDLEWARE = (
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.security.SecurityMiddleware',
'allauth.account.middleware.AccountMiddleware',
'django_mailman3.middleware.TimezoneMiddleware',
'postorius.middleware.PostoriusMiddleware',
)