Mailman nixos module #167

Merged
b12f merged 14 commits from feature/mailman-nixos-module into infra 2023-02-26 13:44:31 +00:00
3 changed files with 124 additions and 105 deletions
Showing only changes of commit 8f948f70c7 - Show all commits

View file

@ -77,12 +77,7 @@
output discard
'';
extraConfig = ''
handle_path /static/* {
root * /var/lib/mailman/web
file_server
}
reverse_proxy :8000
reverse_proxy :${services.sourcehut.lists.port}
'';
};
"obs-portal.pub.solar" = {

View file

@ -49,95 +49,124 @@ in {
owner = "mailman";
};
virtualisation = {
docker = {
services.postfix = {
enable = true;
relayDomains = ["hash:/var/lib/mailman/data/postfix_domains"];
#sslCert = config.security.acme.certs."lists.example.org".directory + "/full.pem";
#sslKey = config.security.acme.certs."lists.example.org".directory + "/key.pem";
config = {
transport_maps = ["hash:/var/lib/mailman/data/postfix_lmtp"];
local_recipient_maps = ["hash:/var/lib/mailman/data/postfix_lmtp"];
};
};
services.mailman = {
enable = true;
#serve.enable = true;
hyperkitty.enable = true;
webHosts = ["list.pub.solar"];
siteOwner = "admins@pub.solar";
};
oci-containers = {
backend = "docker";
containers."mailman-core" = {
image = "maxking/mailman-core:0.4";
autoStart = true;
user = "993";
volumes = [
"/var/lib/mailman/core:/opt/mailman/"
];
extraOptions = [
"--network=mailman-net"
];
environment = {
DATABASE_TYPE = "postgres";
DATABASE_CLASS = "mailman.database.postgresql.PostgreSQLDatabase";
MTA = "postfix";
};
environmentFiles = [
config.age.secrets.mailman-core-secrets.path
];
ports = [
"127.0.0.1:8001:8001" # API
"127.0.0.1:8024:8024" # LMTP - incoming emails
];
};
#virtualisation = {
# docker = {
# enable = true;
# };
containers."mailman-web" = {
image = "maxking/mailman-web:0.4";
autoStart = true;
user = "993";
volumes = [
"/var/lib/mailman/web:/opt/mailman-web-data"
];
extraOptions = [
"--network=mailman-net"
];
environment = {
DATABASE_TYPE = "postgres";
SERVE_FROM_DOMAIN = "list.pub.solar";
MAILMAN_ADMIN_USER = "admin";
MAILMAN_ADMIN_EMAIL = "admins@pub.solar";
};
environmentFiles = [
config.age.secrets.mailman-web-secrets.path
];
ports = [
"127.0.0.1:8000:8000" # HTTP
# "127.0.0.1:8080:8080" # uwsgi
];
};
# oci-containers = {
# backend = "docker";
# containers."mailman-core" = {
# image = "maxking/mailman-core:0.4";
# autoStart = true;
# #user = "993";
# volumes = [
# "/var/lib/mailman/core:/opt/mailman/"
# ];
# extraOptions = [
# "--network=mailman-net"
# ];
# environment = {
# DATABASE_TYPE = "postgres";
# DATABASE_CLASS = "mailman.database.postgresql.PostgreSQLDatabase";
# MTA = "postfix";
# };
# environmentFiles = [
# config.age.secrets.mailman-core-secrets.path
# ];
# ports = [
# "127.0.0.1:8001:8001" # API
# "127.0.0.1:8024:8024" # LMTP - incoming emails
# ];
# };
containers."mailman-db" = {
image = "postgres:14-alpine";
autoStart = true;
user = "993";
extraOptions = [
"--network=mailman-net"
];
volumes = [
"/var/lib/mailman/database:/var/lib/postgresql/data"
];
environmentFiles = [
config.age.secrets.mailman-db-secrets.path
];
};
# containers."mailman-web" = {
# image = "maxking/mailman-web:0.4";
# autoStart = true;
# #user = "993:992";
# volumes = [
# "/var/lib/mailman/web:/opt/mailman-web-data"
# ];
# extraOptions = [
# "--network=mailman-net"
# ];
# environment = {
# DATABASE_TYPE = "postgres";
# SERVE_FROM_DOMAIN = "list.pub.solar";
# MAILMAN_ADMIN_USER = "admin";
# MAILMAN_ADMIN_EMAIL = "admins@pub.solar";
# };
# environmentFiles = [
# config.age.secrets.mailman-web-secrets.path
# ];
# ports = [
# "127.0.0.1:8000:8000" # HTTP
# # "127.0.0.1:8080:8080" # uwsgi
# ];
# };
containers."mailman-postfix" = {
image = "mailu/postfix:1.9.46";
autoStart = true;
user = "993";
extraOptions = [
"--network=mailman-net"
];
volumes = [
"/var/lib/mailman/postfix/overrides:/overrides:ro"
"/var/lib/mailman/postfix/mailqueue:/var/spool/postfix"
"/var/lib/mailman/postfix/data:/var/lib/postfix"
"/var/lib/mailman/core:/var/lib/mailman/core"
"${postfixConfig}:/etc/postfix/main.cf"
];
environmentFiles = [
config.age.secrets.mailman-db-secrets.path
];
};
};
};
# containers."mailman-db" = {
# image = "postgres:14-alpine";
# autoStart = true;
# user = "993";
# extraOptions = [
# "--network=mailman-net"
# ];
# volumes = [
# "/var/lib/mailman/database:/var/lib/postgresql/data"
# ];
# environmentFiles = [
# config.age.secrets.mailman-db-secrets.path
# ];
# };
# containers."mailman-postfix" = {
# image = "mailu/postfix:1.9.46";
# autoStart = true;
# #user = "993";
# extraOptions = [
# "--hostname=list.pub.solar"
# "--network=mailman-net"
# ];
# environment = {
# HOSTNAMES = "list.pub.solar";
# FRONT_ADDRESS = "localhost";
# ADMIN_ADDRESS = "localhost";
# ANTISPAM_MILTER_ADDRESS = "localhost:11332";
# LMTP_ADDRESS = "localhost:2525";
# };
# volumes = [
# # https://mailu.io/1.9/faq.html#how-can-i-override-settings
# # Docs contain the wrong path to override main.cf, this one works
# "${postfixConfig}:/overrides/postfix.cf"
# # Configured in main.cf
# "/var/lib/mailman/postfix/mailqueue:/var/spool/postfix"
# "/var/lib/mailman/postfix/data:/var/lib/postfix"
# # Contains postfix transport_maps generated by mailman-core
# "/var/lib/mailman/core:/var/lib/mailman/core"
# ];
# environmentFiles = [
# config.age.secrets.mailman-db-secrets.path
# ];
# };
# };
#};
}

View file

@ -99,7 +99,7 @@ myhostname = list.pub.solar
# $mydomain is used as a default value for many other configuration
# parameters.
#
#mydomain = domain.tld
mydomain = pub.solar
# SENDING MAIL
#
@ -609,9 +609,7 @@ debug_peer_level = 2
# the process marches on. If you use an X-based debugger, be sure to
# set up your XAUTHORITY environment variable before starting Postfix.
#
debugger_command =
PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
ddd $daemon_directory/$process_name $process_id & sleep 5
debugger_command = PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin ddd $daemon_directory/$process_name $process_id & sleep 5
# If you can't use X, use this to capture the call stack when a
# daemon crashes. The result is in a file in the configuration
@ -684,9 +682,6 @@ recipient_delimiter = +
unknown_local_recipient_reject_code = 550
owner_request_special = no
transport_maps =
regexp:/var/lib/mailman/core/var/data/postfix_lmtp
local_recipient_maps =
regexp:/var/lib/mailman/core/var/data/postfix_lmtp
relay_domains =
regexp:/var/lib/mailman/core/var/data/postfix_domains
transport_maps = regexp:/var/lib/mailman/core/var/data/postfix_lmtp
local_recipient_maps = regexp:/var/lib/mailman/core/var/data/postfix_lmtp
relay_domains = regexp:/var/lib/mailman/core/var/data/postfix_domains