2023-06-29 17:11:13 +02:00
|
|
|
{ elib, tflib, vars, ... }:
|
2023-06-15 23:10:07 +02:00
|
|
|
let
|
|
|
|
inherit (elib)
|
|
|
|
nfsVolume
|
|
|
|
nomadJob;
|
2023-06-29 17:11:13 +02:00
|
|
|
inherit (tflib)
|
|
|
|
tf;
|
2023-06-15 23:10:07 +02:00
|
|
|
in
|
|
|
|
{
|
2023-06-29 17:11:13 +02:00
|
|
|
variable."dont_deploy_containers" = {
|
|
|
|
type = "boolean";
|
|
|
|
description = "Whether the data to deploy containers properly is available.";
|
|
|
|
};
|
|
|
|
|
2023-06-15 23:10:07 +02:00
|
|
|
resource."vault_policy"."dovecot-policy" = nfsVolume {
|
|
|
|
name = "dovecot-policy";
|
|
|
|
policy = ''
|
|
|
|
path "kv/data/cluster/dovecot" {
|
|
|
|
capabilities = ["read"]
|
|
|
|
}
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
resource."vault_policy"."getmail-policy" = nfsVolume {
|
|
|
|
name = "getmail-policy";
|
|
|
|
policy = ''
|
|
|
|
path "kv/data/cluster/getmail" {
|
|
|
|
capabilities = ["read"]
|
|
|
|
}
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
resource."nomad_volume"."dovecot_maildir" = {
|
|
|
|
volume_name = "org.democratic-csi.nfs";
|
|
|
|
access_mode = "multi-node-multi-writer";
|
|
|
|
server = "blowhole.hosts.in.redalder.org";
|
|
|
|
share = "/var/nfs/dovecot/maildir";
|
|
|
|
mount_flags = [ "nfsvers=3" "hard" "async" ];
|
|
|
|
};
|
|
|
|
|
|
|
|
resource."nomad_volume"."mail-configuration" = {
|
|
|
|
volume_name = "mail-configuration";
|
|
|
|
access_mode = "single-node-writer";
|
|
|
|
server = "blowhole.hosts.in.redalder.org";
|
|
|
|
share = "/var/nfs/mail-configuration";
|
|
|
|
mount_flags = [ "nfsvers=3" "hard" "async" ];
|
|
|
|
};
|
|
|
|
|
|
|
|
resource."nomad_job"."email" = {
|
2023-06-29 17:11:13 +02:00
|
|
|
count = tf "var.dont_deploy_containers ? 0 : 1";
|
2023-06-15 23:10:07 +02:00
|
|
|
jobspec = ./job.hcl;
|
|
|
|
vars = {
|
2023-06-19 00:41:49 +02:00
|
|
|
flake_ref = "${vars.flake_host}?rev=${vars.flake_rev}&ref=${vars.flake_ref}";
|
|
|
|
flake_sha = vars.flake_sha;
|
2023-06-15 23:10:07 +02:00
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|