infrastructure/app/im/deploy/im.hcl

217 lines
5.1 KiB
HCL
Raw Normal View History

job "im" {
2019-06-01 14:02:49 +00:00
datacenters = ["dc1"]
type = "service"
2020-12-18 09:32:44 +00:00
priority = 60
2019-06-01 14:02:49 +00:00
group "matrix" {
count = 1
network {
port "client_port" { static = 8008 }
port "federation_port" { static = 8448 }
}
2019-06-01 14:02:49 +00:00
task "synapse" {
driver = "docker"
config {
2022-03-09 10:52:36 +00:00
image = "superboum/amd64_synapse:v51"
network_mode = "host"
2019-06-01 14:02:49 +00:00
readonly_rootfs = true
ports = [ "client_port", "federation_port" ]
2019-06-01 14:02:49 +00:00
command = "python"
args = [
"-m", "synapse.app.homeserver",
"-n",
"-c", "/etc/matrix-synapse/homeserver.yaml"
]
volumes = [
"secrets/conf:/etc/matrix-synapse",
2021-09-17 16:49:45 +00:00
"/tmp/synapse-media:/var/lib/matrix-synapse/media",
"/tmp/synapse-uploads:/var/lib/matrix-synapse/uploads",
2019-06-01 14:02:49 +00:00
"/tmp/synapse-logs:/var/log/matrix-synapse",
"/tmp/synapse:/tmp"
]
}
2021-09-17 16:49:45 +00:00
2019-06-01 14:02:49 +00:00
template {
data = file("../config/synapse/homeserver.yaml")
2019-06-01 14:02:49 +00:00
destination = "secrets/conf/homeserver.yaml"
}
2020-02-28 19:08:37 +00:00
template {
data = file("../config/easybridge/registration.yaml.tpl")
2020-02-28 19:08:37 +00:00
destination = "secrets/conf/easybridge_registration.yaml"
}
2019-06-01 14:02:49 +00:00
template {
data = file("../config/synapse/log.yaml")
2019-06-01 14:02:49 +00:00
destination = "secrets/conf/log.yaml"
}
2019-06-01 14:02:49 +00:00
template {
data = file("../config/synapse/conf.d/server_name.yaml")
2019-06-01 14:02:49 +00:00
destination = "secrets/conf/server_name.yaml"
}
2019-06-01 14:02:49 +00:00
template {
data = file("../config/synapse/conf.d/report_stats.yaml")
2019-06-01 14:02:49 +00:00
destination = "secrets/conf/report_stats.yaml"
}
# --- secrets ---
2019-06-01 14:02:49 +00:00
template {
data = "{{ key \"secrets/chat/synapse/homeserver.tls.crt\" }}"
destination = "secrets/conf/homeserver.tls.crt"
}
2019-06-01 14:02:49 +00:00
template {
data = "{{ key \"secrets/chat/synapse/homeserver.tls.dh\" }}"
destination = "secrets/conf/homeserver.tls.dh"
}
2019-06-01 14:02:49 +00:00
template {
data = "{{ key \"secrets/chat/synapse/homeserver.tls.key\" }}"
destination = "secrets/conf/homeserver.tls.key"
}
2019-06-01 14:02:49 +00:00
template {
data = "{{ key \"secrets/chat/synapse/homeserver.signing.key\" }}"
destination = "secrets/conf/homeserver.signing.key"
}
env {
SYNAPSE_CACHE_FACTOR = 1
}
resources {
cpu = 1000
memory = 2000
2019-06-01 14:02:49 +00:00
}
service {
name = "synapse-client"
port = "client_port"
2020-12-24 09:01:42 +00:00
address_mode = "host"
2019-06-01 14:02:49 +00:00
tags = [
"matrix",
2021-12-08 11:42:48 +00:00
"tricot im.deuxfleurs.fr/_matrix 100",
"tricot im.deuxfleurs.fr/_synapse 100",
"tricot-add-header Access-Control-Allow-Origin *",
2019-06-01 14:02:49 +00:00
]
check {
type = "tcp"
port = "client_port"
2019-06-01 14:02:49 +00:00
interval = "60s"
timeout = "5s"
check_restart {
limit = 3
grace = "90s"
ignore_warnings = false
}
}
}
service {
name = "synapse-federation"
port = "federation_port"
2020-12-24 09:01:42 +00:00
address_mode = "host"
tags = [
"matrix",
2021-12-08 11:42:48 +00:00
"tricot deuxfleurs.fr/_matrix 100",
2021-12-08 22:48:08 +00:00
"tricot deuxfleurs.fr:443/_matrix 100",
]
}
2019-06-01 14:02:49 +00:00
}
2020-02-28 19:08:37 +00:00
2021-09-17 16:49:45 +00:00
task "media-async-upload" {
driver = "docker"
config {
2022-03-09 10:52:36 +00:00
image = "superboum/amd64_synapse:v51"
2021-09-17 16:49:45 +00:00
readonly_rootfs = true
command = "/usr/local/bin/matrix-s3-async"
work_dir = "/tmp"
volumes = [
"/tmp/synapse-media:/var/lib/matrix-synapse/media",
"/tmp/synapse-uploads:/var/lib/matrix-synapse/uploads",
"/tmp/synapse:/tmp"
]
}
resources {
cpu = 100
memory = 200
}
template {
data = <<EOH
AWS_ACCESS_KEY_ID={{ key "secrets/chat/synapse/s3_access_key" | trimSpace }}
AWS_SECRET_ACCESS_KEY={{ key "secrets/chat/synapse/s3_secret_key" | trimSpace }}
AWS_DEFAULT_REGION=garage
PG_USER={{ key "secrets/chat/synapse/postgres_user" | trimSpace }}
PG_PASS={{ key "secrets/chat/synapse/postgres_pwd" | trimSpace }}
PG_DB={{ key "secrets/chat/synapse/postgres_db" | trimSpace }}
PG_HOST=psql-proxy.service.2.cluster.deuxfleurs.fr
PG_PORT=5432
EOH
destination = "secrets/env"
env = true
}
}
}
2021-09-17 16:49:45 +00:00
2019-06-01 14:02:49 +00:00
group "riotweb" {
count = 1
network {
port "web_port" { to = 8043 }
}
2019-06-01 14:02:49 +00:00
task "server" {
driver = "docker"
config {
2022-03-09 10:52:36 +00:00
image = "superboum/amd64_riotweb:v28"
ports = [ "web_port" ]
2019-06-01 14:02:49 +00:00
volumes = [
"secrets/config.json:/srv/http/config.json"
2019-06-01 14:02:49 +00:00
]
}
template {
data = file("../config/riot_web/config.json")
2019-06-01 14:02:49 +00:00
destination = "secrets/config.json"
}
resources {
memory = 21
}
service {
tags = [
"webstatic",
2021-12-08 11:42:48 +00:00
"tricot im.deuxfleurs.fr 10",
"tricot riot.deuxfleurs.fr 10",
2019-06-01 14:02:49 +00:00
]
port = "web_port"
address_mode = "host"
name = "webstatic"
check {
type = "tcp"
port = "web_port"
interval = "60s"
timeout = "5s"
check_restart {
limit = 3
grace = "90s"
ignore_warnings = false
}
}
}
}
}
}