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";
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 = { #virtualisation = {
backend = "docker"; # docker = {
containers."mailman-core" = { # enable = true;
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" = { # oci-containers = {
image = "maxking/mailman-web:0.4"; # backend = "docker";
autoStart = true; # containers."mailman-core" = {
user = "993"; # image = "maxking/mailman-core:0.4";
volumes = [ # autoStart = true;
"/var/lib/mailman/web:/opt/mailman-web-data" # #user = "993";
]; # volumes = [
extraOptions = [ # "/var/lib/mailman/core:/opt/mailman/"
"--network=mailman-net" # ];
]; # extraOptions = [
environment = { # "--network=mailman-net"
DATABASE_TYPE = "postgres"; # ];
SERVE_FROM_DOMAIN = "list.pub.solar"; # environment = {
MAILMAN_ADMIN_USER = "admin"; # DATABASE_TYPE = "postgres";
MAILMAN_ADMIN_EMAIL = "admins@pub.solar"; # DATABASE_CLASS = "mailman.database.postgresql.PostgreSQLDatabase";
}; # MTA = "postfix";
environmentFiles = [ # };
config.age.secrets.mailman-web-secrets.path # environmentFiles = [
]; # config.age.secrets.mailman-core-secrets.path
ports = [ # ];
"127.0.0.1:8000:8000" # HTTP # ports = [
# "127.0.0.1:8080:8080" # uwsgi # "127.0.0.1:8001:8001" # API
]; # "127.0.0.1:8024:8024" # LMTP - incoming emails
}; # ];
# };
containers."mailman-db" = { # containers."mailman-web" = {
image = "postgres:14-alpine"; # image = "maxking/mailman-web:0.4";
autoStart = true; # autoStart = true;
user = "993"; # #user = "993:992";
extraOptions = [ # volumes = [
"--network=mailman-net" # "/var/lib/mailman/web:/opt/mailman-web-data"
]; # ];
volumes = [ # extraOptions = [
"/var/lib/mailman/database:/var/lib/postgresql/data" # "--network=mailman-net"
]; # ];
environmentFiles = [ # environment = {
config.age.secrets.mailman-db-secrets.path # 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" = { # containers."mailman-db" = {
image = "mailu/postfix:1.9.46"; # image = "postgres:14-alpine";
autoStart = true; # autoStart = true;
user = "993"; # user = "993";
extraOptions = [ # extraOptions = [
"--network=mailman-net" # "--network=mailman-net"
]; # ];
volumes = [ # volumes = [
"/var/lib/mailman/postfix/overrides:/overrides:ro" # "/var/lib/mailman/database:/var/lib/postgresql/data"
"/var/lib/mailman/postfix/mailqueue:/var/spool/postfix" # ];
"/var/lib/mailman/postfix/data:/var/lib/postfix" # environmentFiles = [
"/var/lib/mailman/core:/var/lib/mailman/core" # config.age.secrets.mailman-db-secrets.path
"${postfixConfig}:/etc/postfix/main.cf" # ];
]; # };
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