Migrate Synapse + Email hack

Nomad seemed to dislike the 'auth_port' label, replaced by 'zauthentication_port'
This commit is contained in:
Quentin 2020-12-22 18:24:33 +01:00
parent b29028405d
commit 9117616f02
2 changed files with 63 additions and 159 deletions

View file

@ -7,7 +7,7 @@ job "email" {
count = 1 count = 1
network { network {
port "auth_port" { port "zauthentication_port" {
static = 1337 static = 1337
to = 1337 to = 1337
} }
@ -31,7 +31,7 @@ job "email" {
config { config {
image = "superboum/amd64_dovecot:v2" image = "superboum/amd64_dovecot:v2"
readonly_rootfs = false readonly_rootfs = false
ports = [ "auth_port", "imaps_port", "imap_port", "lmtp_port" ] ports = [ "zauthentication_port", "imaps_port", "imap_port", "lmtp_port" ]
command = "dovecot" command = "dovecot"
args = [ "-F" ] args = [ "-F" ]
volumes = [ volumes = [
@ -51,30 +51,9 @@ job "email" {
memory = 200 memory = 200
} }
service {
name = "dovecot-auth"
port = "auth_port"
address_mode = "host"
tags = [
"dovecot",
]
check {
type = "tcp"
port = "auth_port"
interval = "60s"
timeout = "5s"
check_restart {
limit = 3
grace = "90s"
ignore_warnings = false
}
}
}
service { service {
name = "dovecot-imap" name = "dovecot-imap"
port = "imap_port" port = "imap_port"
address_mode = "host"
tags = [ tags = [
"dovecot" "dovecot"
] ]
@ -94,7 +73,6 @@ job "email" {
service { service {
name = "dovecot-imaps" name = "dovecot-imaps"
port = "imaps_port" port = "imaps_port"
address_mode = "host"
tags = [ tags = [
"dovecot", "dovecot",
"(diplonat (tcp_port 993))" "(diplonat (tcp_port 993))"
@ -116,7 +94,6 @@ job "email" {
service { service {
name = "dovecot-lmtp" name = "dovecot-lmtp"
port = "lmtp_port" port = "lmtp_port"
address_mode = "host"
tags = [ tags = [
"dovecot", "dovecot",
] ]
@ -134,6 +111,25 @@ job "email" {
} }
} }
service {
name = "dovecot-auth"
port = "zauthentication_port"
tags = [
"dovecot",
]
check {
type = "tcp"
port = "zauthentication_port"
interval = "60s"
timeout = "5s"
check_restart {
limit = 3
grace = "90s"
ignore_warnings = false
}
}
}
template { template {
data = file("../config/configuration/email/dovecot/dovecot-ldap.conf.tpl") data = file("../config/configuration/email/dovecot/dovecot-ldap.conf.tpl")
destination = "secrets/conf/dovecot-ldap.conf" destination = "secrets/conf/dovecot-ldap.conf"

View file

@ -5,6 +5,12 @@ job "im" {
group "matrix" { group "matrix" {
count = 1 count = 1
network {
port "client_port" { static = 8008 }
port "federation_port" { static = 8448 }
}
task "synapse" { task "synapse" {
driver = "docker" driver = "docker"
@ -12,6 +18,7 @@ job "im" {
image = "particallydone/amd64_synapse:v39" image = "particallydone/amd64_synapse:v39"
network_mode = "host" network_mode = "host"
readonly_rootfs = true readonly_rootfs = true
ports = [ "client_port", "federation_port" ]
command = "python" command = "python"
args = [ args = [
"-m", "synapse.app.homeserver", "-m", "synapse.app.homeserver",
@ -27,60 +34,47 @@ job "im" {
] ]
} }
artifact {
source = "http://127.0.0.1:8500/v1/kv/configuration/chat/synapse/homeserver.yaml?raw"
destination = "secrets/tpl/homeserver.yaml.tpl"
mode = "file"
}
template { template {
source = "secrets/tpl/homeserver.yaml.tpl" data = file("../config/configuration/chat/synapse/homeserver.yaml")
destination = "secrets/conf/homeserver.yaml" destination = "secrets/conf/homeserver.yaml"
} }
artifact {
source = "http://127.0.0.1:8500/v1/kv/configuration/chat/easybridge/registration.yaml.tpl?raw"
destination = "secrets/tpl/easybridge_registration.yaml.tpl"
mode = "file"
}
template { template {
source = "secrets/tpl/easybridge_registration.yaml.tpl" data = file("../config/configuration/chat/easybridge/registration.yaml.tpl")
destination = "secrets/conf/easybridge_registration.yaml" destination = "secrets/conf/easybridge_registration.yaml"
} }
artifact {
source = "http://127.0.0.1:8500/v1/kv/configuration/chat/fb2mx/registration.yaml?raw"
destination = "secrets/tpl/fb2mx_registration.yaml.tpl"
mode = "file"
}
template { template {
source = "secrets/tpl/fb2mx_registration.yaml.tpl" data = file("../config/configuration/chat/synapse/log.yaml")
destination = "secrets/conf/fb2mx_registration.yaml" destination = "secrets/conf/log.yaml"
} }
template { template {
data = "{{ key \"configuration/chat/synapse/log.yaml\" }}" data = file("../config/configuration/chat/synapse/conf.d/server_name.yaml")
destination = "secrets/conf/log.yaml"
}
template {
data = "{{ key \"configuration/chat/synapse/conf.d/server_name.yaml\" }}"
destination = "secrets/conf/server_name.yaml" destination = "secrets/conf/server_name.yaml"
} }
template { template {
data = "{{ key \"configuration/chat/synapse/conf.d/report_stats.yaml\" }}" data = file("../config/configuration/chat/synapse/conf.d/report_stats.yaml")
destination = "secrets/conf/report_stats.yaml" destination = "secrets/conf/report_stats.yaml"
} }
# --- secrets ---
template { template {
data = "{{ key \"secrets/chat/synapse/homeserver.tls.crt\" }}" data = "{{ key \"secrets/chat/synapse/homeserver.tls.crt\" }}"
destination = "secrets/conf/homeserver.tls.crt" destination = "secrets/conf/homeserver.tls.crt"
} }
template { template {
data = "{{ key \"secrets/chat/synapse/homeserver.tls.dh\" }}" data = "{{ key \"secrets/chat/synapse/homeserver.tls.dh\" }}"
destination = "secrets/conf/homeserver.tls.dh" destination = "secrets/conf/homeserver.tls.dh"
} }
template { template {
data = "{{ key \"secrets/chat/synapse/homeserver.tls.key\" }}" data = "{{ key \"secrets/chat/synapse/homeserver.tls.key\" }}"
destination = "secrets/conf/homeserver.tls.key" destination = "secrets/conf/homeserver.tls.key"
} }
template { template {
data = "{{ key \"secrets/chat/synapse/homeserver.signing.key\" }}" data = "{{ key \"secrets/chat/synapse/homeserver.signing.key\" }}"
destination = "secrets/conf/homeserver.signing.key" destination = "secrets/conf/homeserver.signing.key"
@ -97,8 +91,7 @@ job "im" {
service { service {
name = "synapse-client" name = "synapse-client"
port = 8008 port = "client_port"
address_mode = "driver"
tags = [ tags = [
"matrix", "matrix",
"traefik.enable=true", "traefik.enable=true",
@ -109,8 +102,7 @@ job "im" {
] ]
check { check {
type = "tcp" type = "tcp"
port = 8008 port = "client_port"
address_mode = "driver"
interval = "60s" interval = "60s"
timeout = "5s" timeout = "5s"
check_restart { check_restart {
@ -123,7 +115,7 @@ job "im" {
service { service {
name = "synapse-federation" name = "synapse-federation"
port = 8448 port = "federation_port"
address_mode = "driver" address_mode = "driver"
tags = [ tags = [
"matrix", "matrix",
@ -133,55 +125,44 @@ job "im" {
"traefik.frontend.priority=100" "traefik.frontend.priority=100"
] ]
} }
} }
} }
group "easybridge" { group "easybridge" {
count = 1 count = 1
network {
port "api_port" {
static = 8321
to = 8321
}
port "web_port" { to = 8281 }
}
task "easybridge" { task "easybridge" {
driver = "docker" driver = "docker"
config { config {
image = "lxpz/easybridge_amd64:33" image = "lxpz/easybridge_amd64:33"
port_map { ports = [ "api_port", "web_port" ]
api_port = 8321
web_port = 8281
}
volumes = [ volumes = [
"secrets/conf:/data" "secrets/conf:/data"
] ]
args = [ "./easybridge", "-config", "/data/config.json" ] args = [ "./easybridge", "-config", "/data/config.json" ]
} }
artifact {
source = "http://127.0.0.1:8500/v1/kv/configuration/chat/easybridge/registration.yaml.tpl?raw"
destination = "secrets/tpl/registration.yaml.tpl"
mode = "file"
}
template { template {
source = "secrets/tpl/registration.yaml.tpl" data = file("../config/configuration/chat/easybridge/registration.yaml.tpl")
destination = "secrets/conf/registration.yaml" destination = "secrets/conf/registration.yaml"
} }
artifact {
source = "http://127.0.0.1:8500/v1/kv/configuration/chat/easybridge/config.json.tpl?raw"
destination = "secrets/tpl/config.json.tpl"
mode = "file"
}
template { template {
source = "secrets/tpl/config.json.tpl" data = file("../config/configuration/chat/easybridge/config.json.tpl")
destination = "secrets/conf/config.json" destination = "secrets/conf/config.json"
} }
resources { resources {
memory = 500 memory = 500
cpu = 1000 cpu = 1000
network {
port "api_port" {
static = "8321"
}
port "web_port" {}
}
} }
service { service {
@ -231,28 +212,27 @@ job "im" {
group "riotweb" { group "riotweb" {
count = 1 count = 1
network {
port "web_port" { to = 8043 }
}
task "server" { task "server" {
driver = "docker" driver = "docker"
config { config {
image = "particallydone/amd64_riotweb:v18" image = "particallydone/amd64_riotweb:v18"
port_map { ports = [ "web_port" ]
web_port = 8043
}
volumes = [ volumes = [
"secrets/config.json:/srv/http/config.json" "secrets/config.json:/srv/http/config.json"
] ]
} }
template { template {
data = "{{ key \"configuration/chat/riot_web/config.json\" }}" data = file("../config/configuration/chat/riot_web/config.json")
destination = "secrets/config.json" destination = "secrets/config.json"
} }
resources { resources {
memory = 21 memory = 21
network {
port "web_port" {}
}
} }
service { service {
@ -280,77 +260,5 @@ job "im" {
} }
} }
} }
/*
group "turn_stun" {
count=1
task "coturn" {
driver = "docker"
config {
image = "registry.gitlab.com/superboum/ankh-morpork/amd64_coturn:v1"
port_map {
main_port = 3478
alt_port = 3479
}
command = "/usr/bin/turnserver"
args = [
"-X", "82.253.205.190",
"-v",
"-f",
"-a"
]
volumes = [
"secrets/turnserver.conf:/etc/turnserver.conf"
]
}
artifact {
source = "http://127.0.0.1:8500/v1/kv/configuration/chat/coturn/turnserver.conf.tpl?raw"
destination = "secrets/turnserver.conf.tpl"
mode = "file"
}
template {
source = "secrets/turnserver.conf.tpl"
destination = "secrets/turnserver.conf"
}
resources {
memory = 50
network {
port "main_port" {
static = "3478"
}
port "alt_port" {
static = "3479"
}
}
}
service {
tags = [
"coturn",
"matrix"
]
port = "main_port"
address_mode = "host"
name = "coturn"
check {
type = "tcp"
port = "main_port"
interval = "60s"
timeout = "5s"
check_restart {
limit = 3
grace = "90s"
ignore_warnings = false
}
}
}
}
}
*/
} }