Compare commits
9 Commits
Author | SHA1 | Date | |
---|---|---|---|
12f2bdbc07 | |||
412e75ea2c | |||
8157cd16c9 | |||
5e941cb055 | |||
f6f4066532 | |||
4e59191fd7 | |||
8090bf3bc0 | |||
5d24e8b688 | |||
3702f51514 |
11
.env.sample
11
.env.sample
@ -1,14 +1,16 @@
|
|||||||
TYPE=mailman3
|
TYPE=mailman3
|
||||||
|
|
||||||
DOMAIN=lists.example.com
|
DOMAIN=mailman3.example.com
|
||||||
LETS_ENCRYPT_ENV=production
|
LETS_ENCRYPT_ENV=production
|
||||||
|
|
||||||
SERVE_FROM_DOMAIN=${DOMAIN}
|
SERVE_FROM_DOMAIN=${DOMAIN}
|
||||||
|
|
||||||
MAILMAN_ADMIN_EMAIL=admin@example.com
|
MAILMAN_ADMIN_EMAIL=admin@example.com
|
||||||
|
|
||||||
SMTP_HOST=mail_example_com_smtp # mailu smtp
|
# mailu smtp
|
||||||
SMTP_NETWORK=mail_example_com_default # mailu network
|
SMTP_HOST=mail_example_com_smtp
|
||||||
|
# mailu network
|
||||||
|
SMTP_NETWORK=mail_example_com_default
|
||||||
SMTP_PORT=25
|
SMTP_PORT=25
|
||||||
|
|
||||||
SECRET_DB_PASSWORD_VERSION=v1
|
SECRET_DB_PASSWORD_VERSION=v1
|
||||||
@ -24,3 +26,6 @@ SECRET_MAILMAN_REST_PASSWORD_VERSION=v1
|
|||||||
# KEYCLOAK_SSO_ENABLED=1
|
# KEYCLOAK_SSO_ENABLED=1
|
||||||
# KEYCLOAK_DOMAIN=login.example.com
|
# KEYCLOAK_DOMAIN=login.example.com
|
||||||
# KEYCLOAK_REALM=sso-queens-united
|
# KEYCLOAK_REALM=sso-queens-united
|
||||||
|
|
||||||
|
# DEV_MODE_ENABLED=1
|
||||||
|
# DEV_MODE_EMAIL=email@example.com
|
||||||
|
11
README.md
11
README.md
@ -40,6 +40,17 @@ This configuration assumes the following:
|
|||||||
5. `abra app deploy YOURAPPDOMAIN`
|
5. `abra app deploy YOURAPPDOMAIN`
|
||||||
6. Open the configured domain in your browser to finish set-up
|
6. Open the configured domain in your browser to finish set-up
|
||||||
|
|
||||||
|
|
||||||
|
## Creating users / superusers and running manage.py in general for posterous.
|
||||||
|
|
||||||
|
1. Go to the `web` container `abra app run lists.example.com web bash`
|
||||||
|
2. Set up the enivronment for the `manage.py` to work:
|
||||||
|
a. `export SECRET_KEY=$(cat /run/secrets/django_secret_key)`
|
||||||
|
b. `export DATABASE_PASSWORD=$(cat /run/secrets/db_password)`
|
||||||
|
c. `export DATABASE_URL="postgres://${DATABASE_USER}:${DATABASE_PASSWORD}@${DATABASE_HOST}/${DATABASE_NAME}"`
|
||||||
|
3. Then `manage.py` should work. For example, create a superuser with `python3 manage.py createsuperuser`.
|
||||||
|
|
||||||
|
|
||||||
[`abra`]: https://git.autonomic.zone/autonomic-cooperative/abra
|
[`abra`]: https://git.autonomic.zone/autonomic-cooperative/abra
|
||||||
[`coop-cloud/traefik`]: https://git.autonomic.zone/coop-cloud/traefik
|
[`coop-cloud/traefik`]: https://git.autonomic.zone/coop-cloud/traefik
|
||||||
[`coop-cloud/mailu`]: https://git.autonomic.zone/coop-cloud/mailu
|
[`coop-cloud/mailu`]: https://git.autonomic.zone/coop-cloud/mailu
|
||||||
|
44
abra.sh
44
abra.sh
@ -1,5 +1,47 @@
|
|||||||
export CORE_ENTRYPOINT_CONF_VERSION=v1
|
export CORE_ENTRYPOINT_CONF_VERSION=v6
|
||||||
export MAILMAN_EXTRA_CFG_VERSION=v1
|
export MAILMAN_EXTRA_CFG_VERSION=v1
|
||||||
export NGINX_CONF_VERSION=v1
|
export NGINX_CONF_VERSION=v1
|
||||||
export SETTINGS_LOCAL_VERSION=v2
|
export SETTINGS_LOCAL_VERSION=v2
|
||||||
export WEB_ENTRYPOINT_CONF_VERSION=v1
|
export WEB_ENTRYPOINT_CONF_VERSION=v1
|
||||||
|
|
||||||
|
|
||||||
|
file_env() {
|
||||||
|
local var="$1"
|
||||||
|
local fileVar="${var}_FILE"
|
||||||
|
local def="${2:-}"
|
||||||
|
|
||||||
|
if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then
|
||||||
|
echo >&2 "error: both $var and $fileVar are set (but are exclusive)"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
local val="$def"
|
||||||
|
if [ "${!var:-}" ]; then
|
||||||
|
val="${!var}"
|
||||||
|
elif [ "${!fileVar:-}" ]; then
|
||||||
|
val="$(< "${!fileVar}")"
|
||||||
|
fi
|
||||||
|
|
||||||
|
declare -x -g "$var"="$val"
|
||||||
|
unset "$fileVar"
|
||||||
|
}
|
||||||
|
|
||||||
|
environment() {
|
||||||
|
file_env "DATABASE_PASSWORD"
|
||||||
|
file_env "HYPERKITTY_API_KEY"
|
||||||
|
file_env "MAILMAN_REST_PASSWORD"
|
||||||
|
file_env "SECRET_KEY"
|
||||||
|
|
||||||
|
declare -x -g "DATABASE_URL"="postgres://${DATABASE_USER}:${DATABASE_PASSWORD}@${DATABASE_HOST}/${DATABASE_NAME}"
|
||||||
|
}
|
||||||
|
|
||||||
|
shell() {
|
||||||
|
## Run a shell with proper environment
|
||||||
|
environment
|
||||||
|
bash $@
|
||||||
|
}
|
||||||
|
|
||||||
|
manage() {
|
||||||
|
environment
|
||||||
|
python3 manage.py $@
|
||||||
|
}
|
||||||
|
20
compose.yml
20
compose.yml
@ -3,7 +3,7 @@ version: "3.8"
|
|||||||
|
|
||||||
services:
|
services:
|
||||||
core:
|
core:
|
||||||
image: "maxking/mailman-core:0.3"
|
image: "maxking/mailman-core:0.5"
|
||||||
hostname: mailman-core
|
hostname: mailman-core
|
||||||
volumes:
|
volumes:
|
||||||
- "mailman-core:/opt/mailman/"
|
- "mailman-core:/opt/mailman/"
|
||||||
@ -16,20 +16,22 @@ services:
|
|||||||
- hyperkitty_api_key
|
- hyperkitty_api_key
|
||||||
- mailman_rest_password
|
- mailman_rest_password
|
||||||
environment:
|
environment:
|
||||||
|
- MM_HOSTNAME=core.${SMTP_NETWORK}
|
||||||
- DATABASE_CLASS=mailman.database.postgresql.PostgreSQLDatabase
|
- DATABASE_CLASS=mailman.database.postgresql.PostgreSQLDatabase
|
||||||
- DATABASE_DB=mailman
|
- DATABASE_DB=mailman
|
||||||
- DATABASE_HOST=db
|
- DATABASE_HOST=${STACK_NAME}_db
|
||||||
- DATABASE_NAME=mailman
|
- DATABASE_NAME=mailman
|
||||||
- DATABASE_PASSWORD_FILE=/run/secrets/db_password
|
- DATABASE_PASSWORD_FILE=/run/secrets/db_password
|
||||||
- DATABASE_TYPE=postgres
|
- DATABASE_TYPE=postgresql
|
||||||
- DATABASE_USER=mailman
|
- DATABASE_USER=mailman
|
||||||
- HYPERKITTY_API_KEY_FILE=/run/secrets/hyperkitty_api_key
|
- HYPERKITTY_API_KEY_FILE=/run/secrets/hyperkitty_api_key
|
||||||
- MAILMAN_HOSTNAME=mailman-core
|
|
||||||
- MAILMAN_REST_PASSWORD_FILE=/run/secrets/mailman_rest_password
|
- MAILMAN_REST_PASSWORD_FILE=/run/secrets/mailman_rest_password
|
||||||
- MAILMAN_REST_USER=restadmin
|
- MAILMAN_REST_USER=restadmin
|
||||||
- MTA=postfix
|
- MTA=postfix
|
||||||
- SMTP_HOST
|
- SMTP_HOST
|
||||||
- SMTP_PORT
|
- SMTP_PORT
|
||||||
|
- DEV_MODE_ENABLED
|
||||||
|
- DEV_MODE_EMAIL
|
||||||
configs:
|
configs:
|
||||||
- source: mailman_extra_cfg
|
- source: mailman_extra_cfg
|
||||||
target: /opt/mailman/core/mailman-extra.cfg
|
target: /opt/mailman/core/mailman-extra.cfg
|
||||||
@ -38,9 +40,11 @@ services:
|
|||||||
mode: 0555
|
mode: 0555
|
||||||
entrypoint: /usr/local/bin/docker-entrypoint-custom.sh
|
entrypoint: /usr/local/bin/docker-entrypoint-custom.sh
|
||||||
command: master --force
|
command: master --force
|
||||||
|
deploy:
|
||||||
|
endpoint_mode: dnsrr
|
||||||
|
|
||||||
web:
|
web:
|
||||||
image: "maxking/mailman-web:0.3"
|
image: "maxking/mailman-web:0.5"
|
||||||
hostname: mailman-web
|
hostname: mailman-web
|
||||||
networks:
|
networks:
|
||||||
- internal
|
- internal
|
||||||
@ -53,7 +57,7 @@ services:
|
|||||||
- hyperkitty_api_key
|
- hyperkitty_api_key
|
||||||
- mailman_rest_password
|
- mailman_rest_password
|
||||||
environment:
|
environment:
|
||||||
- DATABASE_HOST=db
|
- DATABASE_HOST=${STACK_NAME}_db
|
||||||
- DATABASE_NAME=mailman
|
- DATABASE_NAME=mailman
|
||||||
- DATABASE_PASSWORD_FILE=/run/secrets/db_password
|
- DATABASE_PASSWORD_FILE=/run/secrets/db_password
|
||||||
- DATABASE_TYPE=postgres
|
- DATABASE_TYPE=postgres
|
||||||
@ -75,7 +79,7 @@ services:
|
|||||||
command: uwsgi --ini /opt/mailman-web/uwsgi.ini
|
command: uwsgi --ini /opt/mailman-web/uwsgi.ini
|
||||||
|
|
||||||
app:
|
app:
|
||||||
image: "nginx:1.21.1"
|
image: "nginx:1.28.0"
|
||||||
environment:
|
environment:
|
||||||
- DOMAIN
|
- DOMAIN
|
||||||
- STACK_NAME
|
- STACK_NAME
|
||||||
@ -96,7 +100,7 @@ services:
|
|||||||
- "traefik.http.routers.${STACK_NAME}.rule=Host(`${DOMAIN}`)"
|
- "traefik.http.routers.${STACK_NAME}.rule=Host(`${DOMAIN}`)"
|
||||||
- "traefik.http.routers.${STACK_NAME}.entrypoints=web-secure"
|
- "traefik.http.routers.${STACK_NAME}.entrypoints=web-secure"
|
||||||
- "traefik.http.routers.${STACK_NAME}.tls.certresolver=${LETS_ENCRYPT_ENV}"
|
- "traefik.http.routers.${STACK_NAME}.tls.certresolver=${LETS_ENCRYPT_ENV}"
|
||||||
- "coop-cloud.${STACK_NAME}.version=0.1.0+1.21.1"
|
- "coop-cloud.${STACK_NAME}.version=0.2.1+1.28.0"
|
||||||
|
|
||||||
db:
|
db:
|
||||||
image: "postgres:13-alpine"
|
image: "postgres:13-alpine"
|
||||||
|
15
entrypoint.core.sh.tmpl
Normal file → Executable file
15
entrypoint.core.sh.tmpl
Normal file → Executable file
@ -32,7 +32,7 @@ file_env "DATABASE_PASSWORD"
|
|||||||
file_env "HYPERKITTY_API_KEY"
|
file_env "HYPERKITTY_API_KEY"
|
||||||
file_env "MAILMAN_REST_PASSWORD"
|
file_env "MAILMAN_REST_PASSWORD"
|
||||||
|
|
||||||
export DATABASE_URL="postgres://${DATABASE_USER}:${DATABASE_PASSWORD}@${DATABASE_HOST}/${DATABASE_NAME}"
|
export DATABASE_URL="postgresql://${DATABASE_USER}:${DATABASE_PASSWORD}@${DATABASE_HOST}/${DATABASE_NAME}"
|
||||||
|
|
||||||
# Diabolical hack to remove duplicate hostnames due to Docker shared networks
|
# Diabolical hack to remove duplicate hostnames due to Docker shared networks
|
||||||
# See https://git.autonomic.zone/coop-cloud/mailu/src/branch/main/compose.yml for more
|
# See https://git.autonomic.zone/coop-cloud/mailu/src/branch/main/compose.yml for more
|
||||||
@ -161,7 +161,7 @@ cat >> /etc/mailman.cfg << EOF
|
|||||||
sleep_time: 10s
|
sleep_time: 10s
|
||||||
|
|
||||||
[webservice]
|
[webservice]
|
||||||
hostname: $MM_HOSTNAME
|
hostname: 0.0.0.0
|
||||||
port: $MAILMAN_REST_PORT
|
port: $MAILMAN_REST_PORT
|
||||||
admin_user: $MAILMAN_REST_USER
|
admin_user: $MAILMAN_REST_USER
|
||||||
admin_pass: $MAILMAN_REST_PASSWORD
|
admin_pass: $MAILMAN_REST_PASSWORD
|
||||||
@ -234,6 +234,15 @@ then
|
|||||||
cat /opt/mailman/gunicorn-extra.cfg > /etc/gunicorn.cfg
|
cat /opt/mailman/gunicorn-extra.cfg > /etc/gunicorn.cfg
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ $DEV_MODE_ENABLED == "1" ]; then
|
||||||
|
cat >> /etc/mailman.cfg <<__EOF
|
||||||
|
[devmode]
|
||||||
|
enabled: yes
|
||||||
|
recipient: $DEV_MODE_EMAIL
|
||||||
|
|
||||||
|
__EOF
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ -v HYPERKITTY_API_KEY ]]; then
|
if [[ -v HYPERKITTY_API_KEY ]]; then
|
||||||
|
|
||||||
echo "HYPERKITTY_API_KEY found, setting up HyperKitty archiver..."
|
echo "HYPERKITTY_API_KEY found, setting up HyperKitty archiver..."
|
||||||
@ -265,7 +274,7 @@ echo "HYPERKITTY_API_KEY not defined, skipping HyperKitty setup..."
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Generate the LMTP files for postfix if needed.
|
# Generate the LMTP files for postfix if needed.
|
||||||
mailman aliases
|
su-exec mailman mailman aliases
|
||||||
|
|
||||||
# Now chown the places where mailman wants to write stuff.
|
# Now chown the places where mailman wants to write stuff.
|
||||||
chown -Rf mailman /opt/mailman || true
|
chown -Rf mailman /opt/mailman || true
|
||||||
|
Loading…
x
Reference in New Issue
Block a user