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 output discard
''; '';
extraConfig = '' extraConfig = ''
handle_path /static/* { reverse_proxy :${services.sourcehut.lists.port}
root * /var/lib/mailman/web
file_server
}
reverse_proxy :8000
''; '';
}; };
"obs-portal.pub.solar" = { "obs-portal.pub.solar" = {

View file

@ -49,95 +49,124 @@ in {
owner = "mailman"; owner = "mailman";
}; };
virtualisation = { services.postfix = {
docker = { enable = true;
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";
oci-containers = { config = {
backend = "docker"; transport_maps = ["hash:/var/lib/mailman/data/postfix_lmtp"];
containers."mailman-core" = { local_recipient_maps = ["hash:/var/lib/mailman/data/postfix_lmtp"];
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-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
];
};
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 = [
"--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
];
};
}; };
}; };
services.mailman = {
enable = true;
#serve.enable = true;
hyperkitty.enable = true;
webHosts = ["list.pub.solar"];
siteOwner = "admins@pub.solar";
};
#virtualisation = {
# docker = {
# enable = true;
# };
# 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-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-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 # $mydomain is used as a default value for many other configuration
# parameters. # parameters.
# #
#mydomain = domain.tld mydomain = pub.solar
# SENDING MAIL # SENDING MAIL
# #
@ -609,9 +609,7 @@ debug_peer_level = 2
# the process marches on. If you use an X-based debugger, be sure to # the process marches on. If you use an X-based debugger, be sure to
# set up your XAUTHORITY environment variable before starting Postfix. # set up your XAUTHORITY environment variable before starting Postfix.
# #
debugger_command = debugger_command = PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin ddd $daemon_directory/$process_name $process_id & sleep 5
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 # 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 # daemon crashes. The result is in a file in the configuration
@ -684,9 +682,6 @@ recipient_delimiter = +
unknown_local_recipient_reject_code = 550 unknown_local_recipient_reject_code = 550
owner_request_special = no owner_request_special = no
transport_maps = transport_maps = regexp:/var/lib/mailman/core/var/data/postfix_lmtp
regexp:/var/lib/mailman/core/var/data/postfix_lmtp local_recipient_maps = regexp:/var/lib/mailman/core/var/data/postfix_lmtp
local_recipient_maps = relay_domains = regexp:/var/lib/mailman/core/var/data/postfix_domains
regexp:/var/lib/mailman/core/var/data/postfix_lmtp
relay_domains =
regexp:/var/lib/mailman/core/var/data/postfix_domains