Redo email

Signed-off-by: Magic_RB <magic_rb@redalder.org>
This commit is contained in:
Magic_RB 2023-02-11 22:48:11 +01:00
parent 11dbee082b
commit 84d26be719
No known key found for this signature in database
GPG key ID: 08D5287CC5DDCA0E
4 changed files with 29 additions and 39 deletions

View file

@ -30,16 +30,7 @@ nglib.makeSystem {
}; };
plugin."" = { plugin."" = {
sieve = pkgs.writeText "filter.sieve" '' sieve = "/mail-configuration/entry.sieve";
require "variables";
require "fileinto";
if header :matches "X-MAILBOX" "*" {
set "DESIRED_MAILBOX" "''${0}";
}
fileinto "''${DESIRED_MAILBOX}";
'';
}; };
mail_plugin_dir = pkgs.symlinkJoin { mail_plugin_dir = pkgs.symlinkJoin {

View file

@ -68,11 +68,10 @@ nglib.makeSystem {
set -m set -m
for rcfile in /getmail.d/getmail.*.rc for rcfile in /mail-configuration/getmail.d/*.rc
do do
foo="$(basename "''${rcfile}")" filename="$(basename "''${rcfile}")"
bar="''${foo#"getmail."}" email="''${filename%".rc"}"
email="''${bar%".rc"}"
mkdir -p "/getmail.d/''${email}" mkdir -p "/getmail.d/''${email}"
chown vmail:vmail -R "/getmail.d/''${email}" chown vmail:vmail -R "/getmail.d/''${email}"
@ -80,7 +79,7 @@ nglib.makeSystem {
( (
while true while true
do do
chpst -u vmail:vmail getmail -i INBOX -n -r "/getmail.d/getmail.''${email}.rc" --getmaildir "/getmail.d/''${email}" chpst -u vmail:vmail getmail -i INBOX -n -r "$rcfile" --getmaildir "/mail-configuration/getmail.d/''${email}"
sleep 10 sleep 10
done done
) & ) &

View file

@ -41,12 +41,12 @@ resource "nomad_volume" "dovecot_maildir" {
} }
} }
resource "nomad_volume" "getmail_getmail-d" { resource "nomad_volume" "mail-configuration" {
type = "csi" type = "csi"
plugin_id = "org.democratic-csi.nfs" plugin_id = "org.democratic-csi.nfs"
volume_id = "getmail_getmail-d" volume_id = "mail-configuration"
name = "getmail_getmail-d" name = "mail-configuration"
external_id = "getmail_getmail-d" external_id = "mail-configuration"
capability { capability {
access_mode = "single-node-writer" access_mode = "single-node-writer"
@ -55,7 +55,7 @@ resource "nomad_volume" "getmail_getmail-d" {
context = { context = {
server = "blowhole.hosts.in.redalder.org" server = "blowhole.hosts.in.redalder.org"
share = "/var/nfs/getmail/getmail.d" share = "/var/nfs/mail-configuration"
node_attach_driver = "nfs" node_attach_driver = "nfs"
provisioner_driver = "node-manual" provisioner_driver = "node-manual"
} }

View file

@ -18,24 +18,15 @@ job "email" {
group "getmail" { group "getmail" {
count = 1 count = 1
volume "dovecot_maildir" { volume "mail-configuration" {
type = "csi" type = "csi"
source = "dovecot_maildir" source = "mail-configuration"
read_only = false read_only = false
attachment_mode = "file-system" attachment_mode = "file-system"
access_mode = "multi-node-multi-writer" access_mode = "multi-node-multi-writer"
} }
volume "getmail_getmail-d" {
type = "csi"
source = "getmail_getmail-d"
read_only = false
attachment_mode = "file-system"
access_mode = "single-node-writer"
}
restart { restart {
attempts = 5 attempts = 5
delay = "5s" delay = "5s"
@ -66,14 +57,8 @@ job "email" {
driver = "docker" driver = "docker"
volume_mount { volume_mount {
volume = "dovecot_maildir" volume = "mail-configuration"
destination = "/maildir" destination = "/mail-configuration"
read_only = false
}
volume_mount {
volume = "getmail_getmail-d"
destination = "/getmail.d"
read_only = false read_only = false
} }
@ -105,6 +90,15 @@ job "email" {
access_mode = "multi-node-multi-writer" access_mode = "multi-node-multi-writer"
} }
volume "mail-configuration" {
type = "csi"
source = "mail-configuration"
read_only = false
attachment_mode = "file-system"
access_mode = "multi-node-multi-writer"
}
restart { restart {
attempts = 5 attempts = 5
delay = "5s" delay = "5s"
@ -141,6 +135,12 @@ job "email" {
read_only = false read_only = false
} }
volume_mount {
volume = "mail-configuration"
destination = "/mail-configuration"
read_only = false
}
config { config {
nix_flake_ref = "${var.flake_ref}#nixngSystems.dovecot.config.system.build.toplevel" nix_flake_ref = "${var.flake_ref}#nixngSystems.dovecot.config.system.build.toplevel"
nix_flake_sha = var.flake_sha nix_flake_sha = var.flake_sha