mirror of
https://git.sr.ht/~magic_rb/cluster
synced 2024-11-21 15:54:21 +01:00
Redo email
Signed-off-by: Magic_RB <magic_rb@redalder.org>
This commit is contained in:
parent
accdf3676c
commit
38940ad5a9
|
@ -30,16 +30,7 @@ nglib.makeSystem {
|
|||
};
|
||||
|
||||
plugin."" = {
|
||||
sieve = pkgs.writeText "filter.sieve" ''
|
||||
require "variables";
|
||||
require "fileinto";
|
||||
|
||||
if header :matches "X-MAILBOX" "*" {
|
||||
set "DESIRED_MAILBOX" "''${0}";
|
||||
}
|
||||
|
||||
fileinto "''${DESIRED_MAILBOX}";
|
||||
'';
|
||||
sieve = "/mail-configuration/entry.sieve";
|
||||
};
|
||||
|
||||
mail_plugin_dir = pkgs.symlinkJoin {
|
||||
|
|
|
@ -68,11 +68,10 @@ nglib.makeSystem {
|
|||
|
||||
set -m
|
||||
|
||||
for rcfile in /getmail.d/getmail.*.rc
|
||||
for rcfile in /mail-configuration/getmail.d/*.rc
|
||||
do
|
||||
foo="$(basename "''${rcfile}")"
|
||||
bar="''${foo#"getmail."}"
|
||||
email="''${bar%".rc"}"
|
||||
filename="$(basename "''${rcfile}")"
|
||||
email="''${filename%".rc"}"
|
||||
|
||||
mkdir -p "/getmail.d/''${email}"
|
||||
chown vmail:vmail -R "/getmail.d/''${email}"
|
||||
|
@ -80,7 +79,7 @@ nglib.makeSystem {
|
|||
(
|
||||
while true
|
||||
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
|
||||
done
|
||||
) &
|
||||
|
|
|
@ -41,12 +41,12 @@ resource "nomad_volume" "dovecot_maildir" {
|
|||
}
|
||||
}
|
||||
|
||||
resource "nomad_volume" "getmail_getmail-d" {
|
||||
resource "nomad_volume" "mail-configuration" {
|
||||
type = "csi"
|
||||
plugin_id = "org.democratic-csi.nfs"
|
||||
volume_id = "getmail_getmail-d"
|
||||
name = "getmail_getmail-d"
|
||||
external_id = "getmail_getmail-d"
|
||||
volume_id = "mail-configuration"
|
||||
name = "mail-configuration"
|
||||
external_id = "mail-configuration"
|
||||
|
||||
capability {
|
||||
access_mode = "single-node-writer"
|
||||
|
@ -55,7 +55,7 @@ resource "nomad_volume" "getmail_getmail-d" {
|
|||
|
||||
context = {
|
||||
server = "blowhole.hosts.in.redalder.org"
|
||||
share = "/var/nfs/getmail/getmail.d"
|
||||
share = "/var/nfs/mail-configuration"
|
||||
node_attach_driver = "nfs"
|
||||
provisioner_driver = "node-manual"
|
||||
}
|
||||
|
|
|
@ -18,24 +18,15 @@ job "email" {
|
|||
group "getmail" {
|
||||
count = 1
|
||||
|
||||
volume "dovecot_maildir" {
|
||||
volume "mail-configuration" {
|
||||
type = "csi"
|
||||
source = "dovecot_maildir"
|
||||
source = "mail-configuration"
|
||||
read_only = false
|
||||
|
||||
attachment_mode = "file-system"
|
||||
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 {
|
||||
attempts = 5
|
||||
delay = "5s"
|
||||
|
@ -66,14 +57,8 @@ job "email" {
|
|||
driver = "docker"
|
||||
|
||||
volume_mount {
|
||||
volume = "dovecot_maildir"
|
||||
destination = "/maildir"
|
||||
read_only = false
|
||||
}
|
||||
|
||||
volume_mount {
|
||||
volume = "getmail_getmail-d"
|
||||
destination = "/getmail.d"
|
||||
volume = "mail-configuration"
|
||||
destination = "/mail-configuration"
|
||||
read_only = false
|
||||
}
|
||||
|
||||
|
@ -105,6 +90,15 @@ job "email" {
|
|||
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 {
|
||||
attempts = 5
|
||||
delay = "5s"
|
||||
|
@ -141,6 +135,12 @@ job "email" {
|
|||
read_only = false
|
||||
}
|
||||
|
||||
volume_mount {
|
||||
volume = "mail-configuration"
|
||||
destination = "/mail-configuration"
|
||||
read_only = false
|
||||
}
|
||||
|
||||
config {
|
||||
nix_flake_ref = "${var.flake_ref}#nixngSystems.dovecot.config.system.build.toplevel"
|
||||
nix_flake_sha = var.flake_sha
|
||||
|
|
Loading…
Reference in a new issue