Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Postorius fixes #438

Merged
merged 7 commits into from
Feb 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ These are the settings that you MUST change before deploying:
(with SITE_ID=1).

- `HYPERKITTY_API_KEY`: Hyperkitty's API Key, should be set to the same value
as set for the mailman-core.
as set for the mailman-core. (Not needed in case of Postorius-only version.)

- `MAILMAN_ADMIN_USER`: The username for the admin user to be created by default.

Expand Down Expand Up @@ -234,7 +234,7 @@ For more details on how to configure this image, please look at
These are the variables that you MUST change before deploying:

- `HYPERKITTY_API_KEY`: Hyperkitty's API Key, should be set to the same value as
set for the mailman-web.
set for the mailman-web. Skip the variable in case of non-Hyperkitty deployment.

- `DATABASE_URL`: URL of the type
`driver://user:password@hostname:port/databasename` for the django to use. If
Expand Down
27 changes: 17 additions & 10 deletions core/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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"
Expand All @@ -215,6 +216,12 @@ base_url: $HYPERKITTY_URL
api_key: $HYPERKITTY_API_KEY
EOF

else

echo "HYPERKITTY_API_KEY not defined, skipping HyperKitty setup..."

fi

# Generate the LMTP files for postfix if needed.
mailman aliases

Expand Down
2 changes: 0 additions & 2 deletions docker-compose-postorius.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down
15 changes: 7 additions & 8 deletions postorius/mailman-web/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
import socket
import dj_database_url
import sys

Expand Down Expand Up @@ -57,8 +56,6 @@
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')
Expand All @@ -67,7 +64,7 @@

# Application definition

INSTALLED_APPS = (
INSTALLED_APPS = [
'postorius',
'django_mailman3',
# Uncomment the next line to enable the admin:
Expand All @@ -89,7 +86,7 @@
'allauth.socialaccount.providers.github',
'allauth.socialaccount.providers.gitlab',
'allauth.socialaccount.providers.google',
)
]

MIDDLEWARE = (
'django.contrib.sessions.middleware.SessionMiddleware',
Expand Down Expand Up @@ -213,9 +210,10 @@
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
Expand Down Expand Up @@ -339,6 +337,7 @@
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 *
Expand Down