Fixes for Postorius-only deployment

This commit is contained in:
Danil Smirnov
2021-02-28 13:28:04 +02:00
parent 17b041c926
commit 18bb115947
3 changed files with 30 additions and 21 deletions

View File

@@ -125,11 +125,6 @@ admin_user: $MAILMAN_REST_USER
admin_pass: $MAILMAN_REST_PASSWORD
configuration: /etc/gunicorn.cfg
[archiver.hyperkitty]
class: mailman_hyperkitty.Archiver
enable: yes
configuration: /etc/mailman-hyperkitty.cfg
EOF
# Generate a basic gunicorn.cfg.
@@ -197,11 +192,17 @@ then
cat /opt/mailman/gunicorn-extra.cfg > /etc/gunicorn.cfg
fi
if [[ ! -v HYPERKITTY_API_KEY ]]; then
echo "HYPERKITTY_API_KEY not defined, please set this environment variable..."
echo "exiting..."
exit 1
fi
if [[ -v HYPERKITTY_API_KEY ]]; then
echo "HYPERKITTY_API_KEY found, setting up HyperKitty archiver..."
cat >> /etc/mailman.cfg << EOF
[archiver.hyperkitty]
class: mailman_hyperkitty.Archiver
enable: yes
configuration: /etc/mailman-hyperkitty.cfg
EOF
if [[ ! -v HYPERKITTY_URL ]]; then
echo "HYPERKITTY_URL not set, using the default value of http://mailman-web:8000/hyperkitty"
@@ -215,6 +216,8 @@ base_url: $HYPERKITTY_URL
api_key: $HYPERKITTY_API_KEY
EOF
fi
# Generate the LMTP files for postfix if needed.
mailman aliases

View File

@@ -16,7 +16,6 @@ services:
- DATABASE_URL=postgres://mailman:mailmanpass@database/mailmandb
- DATABASE_TYPE=postgres
- DATABASE_CLASS=mailman.database.postgresql.PostgreSQLDatabase
- HYPERKITTY_API_KEY=someapikey
networks:
mailman:
ipv4_address: 172.19.199.2
@@ -35,7 +34,6 @@ services:
environment:
- DATABASE_TYPE=postgres
- DATABASE_URL=postgres://mailman:mailmanpass@database/mailmandb
- HYPERKITTY_API_KEY=someapikey
- SECRET_KEY=ksjdbaksdba
- UWSGI_STATIC_MAP=/static=/opt/mailman-web-data/static
networks:

View File

@@ -27,7 +27,6 @@ https://docs.djangoproject.com/en/1.8/ref/settings/
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
import socket
import dj_database_url
import sys
@@ -57,8 +56,6 @@ ALLOWED_HOSTS = [
os.environ.get('DJANGO_ALLOWED_HOSTS'),
]
# Try to get the address of Mailman Core automatically.
# Mailman API credentials
MAILMAN_REST_API_URL = os.environ.get('MAILMAN_REST_URL', 'http://mailman-core:8001')
MAILMAN_REST_API_USER = os.environ.get('MAILMAN_REST_USER', 'restadmin')
@@ -67,7 +64,7 @@ MAILMAN_ARCHIVER_FROM = (os.environ.get('MAILMAN_HOST_IP', '172.19.199.2'),)
# Application definition
INSTALLED_APPS = (
INSTALLED_APPS = [
'postorius',
'django_mailman3',
# Uncomment the next line to enable the admin:
@@ -89,9 +86,9 @@ INSTALLED_APPS = (
'allauth.socialaccount.providers.github',
'allauth.socialaccount.providers.gitlab',
'allauth.socialaccount.providers.google',
)
]
MIDDLEWARE = (
_MIDDLEWARE = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
@@ -104,8 +101,17 @@ MIDDLEWARE = (
'postorius.middleware.PostoriusMiddleware',
)
# Use old-style Middleware class in Python 2 and released versions of
# Django-mailman3 don't support new style middlewares.
if sys.version_info < (3, 0):
MIDDLEWARE_CLASSES = _MIDDLEWARE
else:
MIDDLEWARE = _MIDDLEWARE
ROOT_URLCONF = 'urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
@@ -213,9 +219,10 @@ SERVER_EMAIL = 'root@{}'.format(hostname)
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = os.environ.get('SMTP_HOST', '172.19.199.1')
EMAIL_PORT = os.environ.get('SMTP_PORT', 25)
EMAIL_HOST_USER = ''
EMAIL_HOST_PASSWORD = ''
EMAIL_USE_TLS = False
EMAIL_HOST_USER = os.environ.get('SMTP_HOST_USER', '')
EMAIL_HOST_PASSWORD = os.environ.get('SMTP_HOST_PASSWORD', '')
EMAIL_USE_TLS = os.environ.get('SMTP_USE_TLS', False)
# Compatibility with Bootstrap 3
from django.contrib.messages import constants as messages # flake8: noqa
@@ -339,6 +346,7 @@ LOGGING = {
if os.environ.get('LOG_TO_CONSOLE') == 'yes':
LOGGING['loggers']['django']['handlers'].append('console')
LOGGING['loggers']['django.request']['handlers'].append('console')
POSTORIUS_TEMPLATE_BASE_URL = os.environ.get('POSTORIUS_TEMPLATE_BASE_URL', 'http://mailman-web:8000')
try:
from settings_local import *