cluster/infrastructure/email/nomad.hcl
main 1c8ed3236a
Basic ver1 getmail, maildrop, dovecot setup
Signed-off-by: main <magic_rb@redalder.org>
2022-04-26 09:55:22 +02:00

160 lines
2.4 KiB
HCL

job "email" {
datacenters = [ "homelab-1" ]
type = "service"
constraint {
attribute = "${attr.unique.hostname}"
value = "blowhole"
}
group "getmail" {
count = 1
volume "dovecot_maildir" {
type = "csi"
source = "dovecot_maildir"
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"
}
network {
mode = "bridge"
}
service {
name = "getmail"
port = "666"
connect {
sidecar_service {
proxy {
upstreams {
destination_name = "dovecot-lmtp"
local_bind_port = 24
datacenter = "homelab-1"
}
}
}
}
}
task "app" {
driver = "docker"
volume_mount {
volume = "dovecot_maildir"
destination = "/maildir"
read_only = false
}
volume_mount {
volume = "getmail_getmail-d"
destination = "/getmail.d"
read_only = false
}
config {
image = "ra-systems-getmail:local"
}
env {
}
resources {
cpu = 256
memory = 512
}
}
}
group "dovecot" {
count = 1
volume "dovecot_maildir" {
type = "csi"
source = "dovecot_maildir"
read_only = false
attachment_mode = "file-system"
access_mode = "multi-node-multi-writer"
}
restart {
attempts = 5
delay = "5s"
}
network {
mode = "bridge"
}
service {
name = "dovecot-lmtp"
port = "24"
connect {
sidecar_service {}
}
}
service {
name = "dovecot-imap"
port = "143"
connect {
sidecar_service {}
}
}
task "app" {
driver = "docker"
volume_mount {
volume = "dovecot_maildir"
destination = "/maildir"
read_only = false
}
config {
image = "ra-systems-dovecot:local"
}
env {
}
resources {
cpu = 128
memory = 256
}
vault {
policies = ["dovecot-policy"]
}
template {
data = <<EOF
{{ with secret "kv/data/dovecot" }}{{ .Data.data.passwd }}{{ end }}
EOF
destination = "secrets/passwd.dovecot"
change_mode = "noop"
}
}
}
}