2022-09-18 18:24:43 +02:00
|
|
|
variable "flake_ref" {
|
|
|
|
type = string
|
|
|
|
}
|
|
|
|
|
|
|
|
variable "flake_sha" {
|
|
|
|
type = string
|
|
|
|
}
|
|
|
|
|
2022-10-27 11:39:39 +02:00
|
|
|
job "matrix" {
|
2022-09-18 18:24:43 +02:00
|
|
|
datacenters = [ "homelab-1" ]
|
|
|
|
type = "service"
|
|
|
|
|
2022-10-27 11:39:39 +02:00
|
|
|
group "mautrix-facebook" {
|
2023-04-20 11:47:46 +02:00
|
|
|
count = 0
|
2022-09-18 18:24:43 +02:00
|
|
|
|
2022-10-27 11:39:39 +02:00
|
|
|
volume "matrix-mautrix-facebook" {
|
2022-09-18 18:24:43 +02:00
|
|
|
type = "csi"
|
2022-10-27 11:39:39 +02:00
|
|
|
source = "matrix-mautrix-facebook"
|
2022-09-18 18:24:43 +02:00
|
|
|
read_only = false
|
|
|
|
|
|
|
|
attachment_mode = "file-system"
|
|
|
|
access_mode = "single-node-writer"
|
|
|
|
}
|
|
|
|
|
2022-10-27 11:39:39 +02:00
|
|
|
volume "matrix-registrations" {
|
|
|
|
type = "csi"
|
|
|
|
source = "matrix-registrations"
|
|
|
|
read_only = false
|
|
|
|
|
|
|
|
attachment_mode = "file-system"
|
|
|
|
access_mode = "multi-node-multi-writer"
|
|
|
|
}
|
|
|
|
|
|
|
|
restart {
|
|
|
|
attempts = 5
|
|
|
|
delay = "5s"
|
|
|
|
}
|
|
|
|
|
|
|
|
network {
|
|
|
|
mode = "bridge"
|
|
|
|
}
|
|
|
|
|
|
|
|
service {
|
|
|
|
name = "matrix-mautrix-facebook"
|
|
|
|
port = "29319"
|
|
|
|
|
|
|
|
# check {
|
|
|
|
# type = "http"
|
|
|
|
# address_mode = "alloc"
|
|
|
|
# path = "/public"
|
|
|
|
# port = "29319"
|
|
|
|
# interval = "2s"
|
|
|
|
# timeout = "2s"
|
|
|
|
# }
|
|
|
|
|
|
|
|
connect {
|
|
|
|
sidecar_service {}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
task "mautrix-facebook" {
|
2022-10-27 11:26:19 +02:00
|
|
|
driver = "docker"
|
2022-10-27 11:39:39 +02:00
|
|
|
|
|
|
|
volume_mount {
|
|
|
|
volume = "matrix-mautrix-facebook"
|
|
|
|
destination = "/var/lib/mautrix-facebook"
|
|
|
|
read_only = false
|
|
|
|
}
|
|
|
|
|
|
|
|
volume_mount {
|
|
|
|
volume = "matrix-registrations"
|
|
|
|
destination = "/var/lib/registrations"
|
|
|
|
read_only = false
|
|
|
|
}
|
|
|
|
|
|
|
|
config {
|
2022-10-27 11:26:19 +02:00
|
|
|
nix_flake_ref = "${var.flake_ref}#nixngSystems.mautrix-facebook.config.system.build.toplevel"
|
|
|
|
nix_flake_sha = var.flake_sha
|
2022-10-27 11:39:39 +02:00
|
|
|
entrypoint = [ "init" ]
|
|
|
|
}
|
|
|
|
|
|
|
|
vault {
|
|
|
|
policies = ["matrix-mautrix-facebook-policy"]
|
|
|
|
}
|
|
|
|
|
|
|
|
template {
|
|
|
|
data = <<EOF
|
2023-04-20 11:47:46 +02:00
|
|
|
{{ with secret "kv/data/cluster/matrix/mautrix-facebook" }}
|
2022-10-27 11:39:39 +02:00
|
|
|
MAUTRIX_FACEBOOK_APPSERVICE_AS_TOKEN={{ .Data.data.as_token }}
|
|
|
|
MAUTRIX_FACEBOOK_APPSERVICE_HS_TOKEN={{ .Data.data.hs_token }}
|
|
|
|
{{ end }}
|
|
|
|
EOF
|
|
|
|
destination = "secrets/environment"
|
|
|
|
env = true
|
|
|
|
}
|
|
|
|
|
|
|
|
resources {
|
|
|
|
cpu = 256
|
|
|
|
memory = 256
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
group "heisenbridge" {
|
|
|
|
count = 1
|
|
|
|
|
|
|
|
volume "matrix-registrations" {
|
|
|
|
type = "csi"
|
|
|
|
source = "matrix-registrations"
|
|
|
|
read_only = false
|
|
|
|
|
|
|
|
attachment_mode = "file-system"
|
|
|
|
access_mode = "multi-node-multi-writer"
|
|
|
|
}
|
|
|
|
|
|
|
|
restart {
|
|
|
|
attempts = 5
|
|
|
|
delay = "5s"
|
|
|
|
}
|
|
|
|
|
|
|
|
network {
|
|
|
|
mode = "bridge"
|
|
|
|
}
|
|
|
|
|
|
|
|
service {
|
|
|
|
name = "matrix-heisenbridge"
|
|
|
|
port = "9898"
|
|
|
|
|
|
|
|
connect {
|
|
|
|
sidecar_service {}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
task "heisenbridge" {
|
2022-10-27 11:26:19 +02:00
|
|
|
driver = "docker"
|
2022-10-27 11:39:39 +02:00
|
|
|
|
|
|
|
volume_mount {
|
|
|
|
volume = "matrix-registrations"
|
|
|
|
destination = "/var/lib/registrations"
|
|
|
|
read_only = false
|
|
|
|
}
|
|
|
|
|
|
|
|
config {
|
2022-10-27 11:26:19 +02:00
|
|
|
nix_flake_ref = "${var.flake_ref}#nixngSystems.heisenbridge.config.system.build.toplevel"
|
|
|
|
nix_flake_sha = var.flake_sha
|
2022-10-27 11:39:39 +02:00
|
|
|
entrypoint = [ "init" ]
|
|
|
|
}
|
|
|
|
|
|
|
|
resources {
|
|
|
|
cpu = 128
|
|
|
|
memory = 128
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-04-20 11:47:46 +02:00
|
|
|
group "redis" {
|
2022-10-27 11:39:39 +02:00
|
|
|
count = 1
|
|
|
|
|
2023-04-20 11:47:46 +02:00
|
|
|
volume "matrix-redis" {
|
2022-10-27 11:39:39 +02:00
|
|
|
type = "csi"
|
2023-04-20 11:47:46 +02:00
|
|
|
source = "matrix-redis"
|
2022-10-27 11:39:39 +02:00
|
|
|
read_only = false
|
|
|
|
|
|
|
|
attachment_mode = "file-system"
|
|
|
|
access_mode = "single-node-writer"
|
|
|
|
}
|
|
|
|
|
2023-04-20 11:47:46 +02:00
|
|
|
restart {
|
|
|
|
attempts = 5
|
|
|
|
delay = "5s"
|
|
|
|
}
|
2022-10-30 01:21:24 +02:00
|
|
|
|
2023-04-20 11:47:46 +02:00
|
|
|
network {
|
|
|
|
mode = "bridge"
|
2022-10-30 01:21:24 +02:00
|
|
|
}
|
|
|
|
|
2023-04-20 11:47:46 +02:00
|
|
|
vault {
|
|
|
|
policies = ["matrix-synapse-policy"]
|
|
|
|
}
|
2022-10-27 11:39:39 +02:00
|
|
|
|
2023-04-20 11:47:46 +02:00
|
|
|
service {
|
|
|
|
name = "matrix-redis"
|
|
|
|
port = "6379"
|
|
|
|
|
|
|
|
# check {
|
|
|
|
# type = "http"
|
|
|
|
# address_mode = "alloc"
|
|
|
|
# path = "/health"
|
|
|
|
# port = "6167"
|
|
|
|
# interval = "2s"
|
|
|
|
# timeout = "2s"
|
|
|
|
# }
|
|
|
|
|
|
|
|
connect {
|
|
|
|
sidecar_service {}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
task "redis" {
|
|
|
|
driver = "docker"
|
|
|
|
|
|
|
|
volume_mount {
|
|
|
|
volume = "matrix-redis"
|
|
|
|
destination = "/var/lib/redis"
|
|
|
|
read_only = false
|
|
|
|
}
|
|
|
|
|
|
|
|
config {
|
|
|
|
nix_flake_ref = "${var.flake_ref}#nixngSystems.conduitRedis.config.system.build.toplevel"
|
|
|
|
nix_flake_sha = var.flake_sha
|
|
|
|
entrypoint = [ "init" ]
|
|
|
|
}
|
|
|
|
|
|
|
|
template {
|
|
|
|
data = <<EOF
|
|
|
|
{{ with secret "kv/data/cluster/matrix/synapse" -}}
|
|
|
|
{{ .Data.data.redis_password }}
|
|
|
|
{{ end -}}
|
|
|
|
EOF
|
|
|
|
destination = "/secrets/redis_password"
|
|
|
|
}
|
2022-10-27 11:39:39 +02:00
|
|
|
}
|
2023-04-20 11:47:46 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
group "synapse-client" {
|
|
|
|
count = 1
|
2022-10-27 11:39:39 +02:00
|
|
|
|
2022-09-18 18:24:43 +02:00
|
|
|
restart {
|
|
|
|
attempts = 5
|
|
|
|
delay = "5s"
|
|
|
|
}
|
|
|
|
|
|
|
|
network {
|
|
|
|
mode = "bridge"
|
|
|
|
}
|
|
|
|
|
2023-04-20 11:47:46 +02:00
|
|
|
vault {
|
|
|
|
policies = ["matrix-synapse-policy"]
|
|
|
|
}
|
|
|
|
|
|
|
|
volume "matrix-synapse" {
|
|
|
|
type = "csi"
|
|
|
|
source = "matrix-synapse"
|
|
|
|
read_only = false
|
|
|
|
|
|
|
|
attachment_mode = "file-system"
|
|
|
|
access_mode = "multi-node-multi-writer"
|
|
|
|
}
|
|
|
|
|
|
|
|
volume "matrix-registrations" {
|
|
|
|
type = "csi"
|
|
|
|
source = "matrix-registrations"
|
|
|
|
read_only = false
|
|
|
|
|
|
|
|
attachment_mode = "file-system"
|
|
|
|
access_mode = "multi-node-multi-writer"
|
|
|
|
}
|
|
|
|
|
2022-09-18 18:24:43 +02:00
|
|
|
service {
|
2023-04-20 11:47:46 +02:00
|
|
|
name = "matrix-synapse-client"
|
2022-09-18 18:24:43 +02:00
|
|
|
port = "6167"
|
|
|
|
|
|
|
|
check {
|
|
|
|
type = "http"
|
|
|
|
address_mode = "alloc"
|
2023-04-20 11:47:46 +02:00
|
|
|
path = "/health"
|
2022-09-18 18:24:43 +02:00
|
|
|
port = "6167"
|
|
|
|
interval = "2s"
|
|
|
|
timeout = "2s"
|
|
|
|
}
|
|
|
|
|
|
|
|
connect {
|
2022-10-27 11:39:39 +02:00
|
|
|
sidecar_service {
|
|
|
|
proxy {
|
|
|
|
upstreams {
|
|
|
|
destination_name = "matrix-mautrix-facebook"
|
|
|
|
local_bind_port = 29319
|
|
|
|
}
|
|
|
|
|
|
|
|
upstreams {
|
|
|
|
destination_name = "matrix-heisenbridge"
|
|
|
|
local_bind_port = 9898
|
|
|
|
}
|
2023-04-20 11:47:46 +02:00
|
|
|
|
|
|
|
upstreams {
|
|
|
|
destination_name = "matrix-postgresql"
|
|
|
|
local_bind_port = 5432
|
|
|
|
}
|
|
|
|
|
|
|
|
upstreams {
|
|
|
|
destination_name = "matrix-redis"
|
|
|
|
local_bind_port = 6379
|
|
|
|
}
|
|
|
|
|
|
|
|
upstreams {
|
|
|
|
destination_name = "matrix-synapse-replication"
|
|
|
|
local_bind_port = 9093
|
|
|
|
}
|
2022-10-27 11:39:39 +02:00
|
|
|
}
|
|
|
|
}
|
2022-09-18 18:24:43 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-04-20 11:47:46 +02:00
|
|
|
task "synapse-client" {
|
2022-10-30 01:21:24 +02:00
|
|
|
driver = "docker"
|
|
|
|
|
|
|
|
volume_mount {
|
2023-04-20 11:47:46 +02:00
|
|
|
volume = "matrix-synapse"
|
|
|
|
destination = "/var/lib/synapse"
|
|
|
|
read_only = false
|
|
|
|
}
|
|
|
|
|
|
|
|
volume_mount {
|
|
|
|
volume = "matrix-registrations"
|
|
|
|
destination = "/var/lib/registrations"
|
2022-10-30 01:21:24 +02:00
|
|
|
read_only = false
|
|
|
|
}
|
|
|
|
|
|
|
|
config {
|
2023-04-20 11:47:46 +02:00
|
|
|
nix_flake_ref = "${var.flake_ref}#nixngSystems.synapseClient.config.system.build.toplevel"
|
2022-10-30 01:21:24 +02:00
|
|
|
nix_flake_sha = var.flake_sha
|
|
|
|
entrypoint = [ "init" ]
|
|
|
|
}
|
|
|
|
|
|
|
|
resources {
|
2023-04-20 11:47:46 +02:00
|
|
|
cpu = 1024
|
|
|
|
memory = 2048
|
2022-10-30 01:21:24 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
template {
|
|
|
|
data = <<EOF
|
2023-04-20 11:47:46 +02:00
|
|
|
{{ with secret "kv/data/cluster/matrix/synapse" }}
|
|
|
|
worker_name: "worker-client-{{ env "NOMAD_ALLOC_INDEX" }}"
|
|
|
|
registration_shared_secret: "{{ .Data.data.registration_shared_secret }}"
|
|
|
|
macaroon_secret_key: "{{ .Data.data.macaroon_secret_key }}"
|
|
|
|
form_secret: "{{ .Data.data.form_secret }}"
|
|
|
|
database:
|
|
|
|
name: "psycopg2"
|
|
|
|
args:
|
|
|
|
user: "synapse"
|
|
|
|
password: "{{ .Data.data.pgpass }}"
|
|
|
|
database: "synapse"
|
|
|
|
host: "127.0.0.1"
|
|
|
|
cp_min: 5
|
|
|
|
cp_max: 10
|
|
|
|
redis:
|
|
|
|
enabled: true
|
|
|
|
password: "{{ .Data.data.redis_password }}"
|
|
|
|
{{ end }}
|
2022-10-30 01:21:24 +02:00
|
|
|
EOF
|
2023-04-20 11:47:46 +02:00
|
|
|
destination = "/secrets/extra.yaml"
|
2022-10-30 01:21:24 +02:00
|
|
|
}
|
2023-04-20 11:47:46 +02:00
|
|
|
}
|
|
|
|
}
|
2022-10-30 01:21:24 +02:00
|
|
|
|
2023-04-20 11:47:46 +02:00
|
|
|
group "synapse-sync" {
|
|
|
|
count = 1
|
|
|
|
|
|
|
|
restart {
|
|
|
|
attempts = 5
|
|
|
|
delay = "5s"
|
|
|
|
}
|
|
|
|
|
|
|
|
network {
|
|
|
|
mode = "bridge"
|
|
|
|
}
|
|
|
|
|
|
|
|
vault {
|
|
|
|
policies = ["matrix-synapse-policy"]
|
|
|
|
}
|
|
|
|
|
|
|
|
volume "matrix-synapse" {
|
|
|
|
type = "csi"
|
|
|
|
source = "matrix-synapse"
|
|
|
|
read_only = false
|
|
|
|
|
|
|
|
attachment_mode = "file-system"
|
|
|
|
access_mode = "multi-node-multi-writer"
|
|
|
|
}
|
|
|
|
|
|
|
|
volume "matrix-registrations" {
|
|
|
|
type = "csi"
|
|
|
|
source = "matrix-registrations"
|
|
|
|
read_only = false
|
|
|
|
|
|
|
|
attachment_mode = "file-system"
|
|
|
|
access_mode = "multi-node-multi-writer"
|
|
|
|
}
|
|
|
|
|
|
|
|
service {
|
|
|
|
name = "matrix-synapse-sync"
|
|
|
|
port = "6167"
|
|
|
|
|
|
|
|
check {
|
|
|
|
type = "http"
|
|
|
|
address_mode = "alloc"
|
|
|
|
path = "/health"
|
|
|
|
port = "6167"
|
|
|
|
interval = "2s"
|
|
|
|
timeout = "2s"
|
|
|
|
}
|
|
|
|
|
|
|
|
connect {
|
|
|
|
sidecar_service {
|
|
|
|
proxy {
|
|
|
|
upstreams {
|
|
|
|
destination_name = "matrix-mautrix-facebook"
|
|
|
|
local_bind_port = 29319
|
|
|
|
}
|
|
|
|
|
|
|
|
upstreams {
|
|
|
|
destination_name = "matrix-heisenbridge"
|
|
|
|
local_bind_port = 9898
|
|
|
|
}
|
|
|
|
|
|
|
|
upstreams {
|
|
|
|
destination_name = "matrix-postgresql"
|
|
|
|
local_bind_port = 5432
|
|
|
|
}
|
|
|
|
|
|
|
|
upstreams {
|
|
|
|
destination_name = "matrix-redis"
|
|
|
|
local_bind_port = 6379
|
|
|
|
}
|
|
|
|
|
|
|
|
upstreams {
|
|
|
|
destination_name = "matrix-synapse-replication"
|
|
|
|
local_bind_port = 9093
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-10-30 01:21:24 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-04-20 11:47:46 +02:00
|
|
|
task "synapse-sync" {
|
2022-10-27 11:26:19 +02:00
|
|
|
driver = "docker"
|
2022-09-18 18:24:43 +02:00
|
|
|
|
|
|
|
volume_mount {
|
2022-10-27 11:39:39 +02:00
|
|
|
volume = "matrix-synapse"
|
|
|
|
destination = "/var/lib/synapse"
|
|
|
|
read_only = false
|
|
|
|
}
|
|
|
|
|
|
|
|
volume_mount {
|
|
|
|
volume = "matrix-registrations"
|
|
|
|
destination = "/var/lib/registrations"
|
2022-09-18 18:24:43 +02:00
|
|
|
read_only = false
|
|
|
|
}
|
|
|
|
|
|
|
|
config {
|
2023-04-20 11:47:46 +02:00
|
|
|
nix_flake_ref = "${var.flake_ref}#nixngSystems.synapseSync.config.system.build.toplevel"
|
2022-10-27 11:26:19 +02:00
|
|
|
nix_flake_sha = var.flake_sha
|
2022-09-18 18:24:43 +02:00
|
|
|
entrypoint = [ "init" ]
|
|
|
|
}
|
|
|
|
|
|
|
|
resources {
|
2023-04-20 11:47:46 +02:00
|
|
|
cpu = 1024
|
|
|
|
memory = 512
|
2022-10-27 11:39:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
template {
|
|
|
|
data = <<EOF
|
2023-04-20 11:47:46 +02:00
|
|
|
{{ with secret "kv/data/cluster/matrix/synapse" }}
|
|
|
|
worker_name: "worker-sync-{{ env "NOMAD_ALLOC_INDEX" }}"
|
|
|
|
registration_shared_secret: "{{ .Data.data.registration_shared_secret }}"
|
|
|
|
macaroon_secret_key: "{{ .Data.data.macaroon_secret_key }}"
|
|
|
|
form_secret: "{{ .Data.data.form_secret }}"
|
|
|
|
database:
|
|
|
|
name: "psycopg2"
|
|
|
|
args:
|
|
|
|
user: "synapse"
|
|
|
|
password: "{{ .Data.data.pgpass }}"
|
|
|
|
database: "synapse"
|
|
|
|
host: "127.0.0.1"
|
|
|
|
cp_min: 5
|
|
|
|
cp_max: 10
|
|
|
|
redis:
|
|
|
|
enabled: true
|
|
|
|
password: "{{ .Data.data.redis_password }}"
|
2022-10-30 01:21:24 +02:00
|
|
|
{{ end }}
|
|
|
|
EOF
|
2023-04-20 11:47:46 +02:00
|
|
|
destination = "/secrets/extra.yaml"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
group "synapse-federation-receiver" {
|
|
|
|
count = 1
|
|
|
|
|
|
|
|
restart {
|
|
|
|
attempts = 5
|
|
|
|
delay = "5s"
|
|
|
|
}
|
|
|
|
|
|
|
|
network {
|
|
|
|
mode = "bridge"
|
|
|
|
}
|
|
|
|
|
|
|
|
vault {
|
|
|
|
policies = ["matrix-synapse-policy"]
|
|
|
|
}
|
|
|
|
|
|
|
|
volume "matrix-synapse" {
|
|
|
|
type = "csi"
|
|
|
|
source = "matrix-synapse"
|
|
|
|
read_only = false
|
|
|
|
|
|
|
|
attachment_mode = "file-system"
|
|
|
|
access_mode = "multi-node-multi-writer"
|
|
|
|
}
|
|
|
|
|
|
|
|
volume "matrix-registrations" {
|
|
|
|
type = "csi"
|
|
|
|
source = "matrix-registrations"
|
|
|
|
read_only = false
|
|
|
|
|
|
|
|
attachment_mode = "file-system"
|
|
|
|
access_mode = "multi-node-multi-writer"
|
|
|
|
}
|
|
|
|
|
|
|
|
service {
|
|
|
|
name = "matrix-synapse-federation-receiver"
|
|
|
|
port = "6167"
|
|
|
|
|
|
|
|
check {
|
|
|
|
type = "http"
|
|
|
|
address_mode = "alloc"
|
|
|
|
path = "/health"
|
|
|
|
port = "6167"
|
|
|
|
interval = "2s"
|
|
|
|
timeout = "2s"
|
|
|
|
}
|
|
|
|
|
|
|
|
connect {
|
|
|
|
sidecar_service {
|
|
|
|
proxy {
|
|
|
|
upstreams {
|
|
|
|
destination_name = "matrix-mautrix-facebook"
|
|
|
|
local_bind_port = 29319
|
|
|
|
}
|
|
|
|
|
|
|
|
upstreams {
|
|
|
|
destination_name = "matrix-heisenbridge"
|
|
|
|
local_bind_port = 9898
|
|
|
|
}
|
|
|
|
|
|
|
|
upstreams {
|
|
|
|
destination_name = "matrix-postgresql"
|
|
|
|
local_bind_port = 5432
|
|
|
|
}
|
|
|
|
|
|
|
|
upstreams {
|
|
|
|
destination_name = "matrix-redis"
|
|
|
|
local_bind_port = 6379
|
|
|
|
}
|
|
|
|
|
|
|
|
upstreams {
|
|
|
|
destination_name = "matrix-synapse-replication"
|
|
|
|
local_bind_port = 9093
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
task "synapse-federation-receiver" {
|
|
|
|
driver = "docker"
|
|
|
|
|
|
|
|
volume_mount {
|
|
|
|
volume = "matrix-synapse"
|
|
|
|
destination = "/var/lib/synapse"
|
|
|
|
read_only = false
|
|
|
|
}
|
|
|
|
|
|
|
|
volume_mount {
|
|
|
|
volume = "matrix-registrations"
|
|
|
|
destination = "/var/lib/registrations"
|
|
|
|
read_only = false
|
|
|
|
}
|
|
|
|
|
|
|
|
config {
|
|
|
|
nix_flake_ref = "${var.flake_ref}#nixngSystems.synapseFederationReceiver.config.system.build.toplevel"
|
|
|
|
nix_flake_sha = var.flake_sha
|
|
|
|
entrypoint = [ "init" ]
|
|
|
|
}
|
|
|
|
|
|
|
|
resources {
|
|
|
|
cpu = 1024
|
|
|
|
memory = 512
|
|
|
|
}
|
|
|
|
|
|
|
|
template {
|
|
|
|
data = <<EOF
|
|
|
|
{{ with secret "kv/data/cluster/matrix/synapse" }}
|
|
|
|
worker_name: "worker-federation-receiver-{{ env "NOMAD_ALLOC_INDEX" }}"
|
|
|
|
registration_shared_secret: "{{ .Data.data.registration_shared_secret }}"
|
|
|
|
macaroon_secret_key: "{{ .Data.data.macaroon_secret_key }}"
|
|
|
|
form_secret: "{{ .Data.data.form_secret }}"
|
|
|
|
database:
|
|
|
|
name: "psycopg2"
|
|
|
|
args:
|
|
|
|
user: "synapse"
|
|
|
|
password: "{{ .Data.data.pgpass }}"
|
|
|
|
database: "synapse"
|
|
|
|
host: "127.0.0.1"
|
|
|
|
cp_min: 5
|
|
|
|
cp_max: 10
|
|
|
|
redis:
|
|
|
|
enabled: true
|
|
|
|
password: "{{ .Data.data.redis_password }}"
|
|
|
|
{{ end }}
|
|
|
|
EOF
|
|
|
|
destination = "/secrets/extra.yaml"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
group "synapse-federation-sender" {
|
|
|
|
count = 1
|
|
|
|
|
|
|
|
restart {
|
|
|
|
attempts = 5
|
|
|
|
delay = "5s"
|
|
|
|
}
|
|
|
|
|
|
|
|
network {
|
|
|
|
mode = "bridge"
|
|
|
|
}
|
|
|
|
|
|
|
|
vault {
|
|
|
|
policies = ["matrix-synapse-policy"]
|
|
|
|
}
|
|
|
|
|
|
|
|
volume "matrix-synapse" {
|
|
|
|
type = "csi"
|
|
|
|
source = "matrix-synapse"
|
|
|
|
read_only = false
|
|
|
|
|
|
|
|
attachment_mode = "file-system"
|
|
|
|
access_mode = "multi-node-multi-writer"
|
|
|
|
}
|
|
|
|
|
|
|
|
volume "matrix-registrations" {
|
|
|
|
type = "csi"
|
|
|
|
source = "matrix-registrations"
|
|
|
|
read_only = false
|
|
|
|
|
|
|
|
attachment_mode = "file-system"
|
|
|
|
access_mode = "multi-node-multi-writer"
|
|
|
|
}
|
|
|
|
|
|
|
|
service {
|
|
|
|
name = "matrix-synapse-federation-sender"
|
|
|
|
port = "6167"
|
|
|
|
|
|
|
|
check {
|
|
|
|
type = "http"
|
|
|
|
address_mode = "alloc"
|
|
|
|
path = "/health"
|
|
|
|
port = "6167"
|
|
|
|
interval = "2s"
|
|
|
|
timeout = "2s"
|
|
|
|
}
|
|
|
|
|
|
|
|
connect {
|
|
|
|
sidecar_service {
|
|
|
|
proxy {
|
|
|
|
upstreams {
|
|
|
|
destination_name = "matrix-mautrix-facebook"
|
|
|
|
local_bind_port = 29319
|
|
|
|
}
|
|
|
|
|
|
|
|
upstreams {
|
|
|
|
destination_name = "matrix-heisenbridge"
|
|
|
|
local_bind_port = 9898
|
|
|
|
}
|
|
|
|
|
|
|
|
upstreams {
|
|
|
|
destination_name = "matrix-postgresql"
|
|
|
|
local_bind_port = 5432
|
|
|
|
}
|
|
|
|
|
|
|
|
upstreams {
|
|
|
|
destination_name = "matrix-redis"
|
|
|
|
local_bind_port = 6379
|
|
|
|
}
|
|
|
|
|
|
|
|
upstreams {
|
|
|
|
destination_name = "matrix-synapse-replication"
|
|
|
|
local_bind_port = 9093
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
task "synapse-federation-sender" {
|
|
|
|
driver = "docker"
|
|
|
|
|
|
|
|
volume_mount {
|
|
|
|
volume = "matrix-synapse"
|
|
|
|
destination = "/var/lib/synapse"
|
|
|
|
read_only = false
|
|
|
|
}
|
|
|
|
|
|
|
|
volume_mount {
|
|
|
|
volume = "matrix-registrations"
|
|
|
|
destination = "/var/lib/registrations"
|
|
|
|
read_only = false
|
|
|
|
}
|
|
|
|
|
|
|
|
config {
|
|
|
|
nix_flake_ref = "${var.flake_ref}#nixngSystems.synapseFederationSender.config.system.build.toplevel"
|
|
|
|
nix_flake_sha = var.flake_sha
|
|
|
|
entrypoint = [ "init" ]
|
|
|
|
}
|
|
|
|
|
|
|
|
resources {
|
|
|
|
cpu = 1024
|
|
|
|
memory = 512
|
|
|
|
}
|
|
|
|
|
|
|
|
template {
|
|
|
|
data = <<EOF
|
|
|
|
{{ with secret "kv/data/cluster/matrix/synapse" }}
|
|
|
|
worker_name: "worker-federation-sender-{{ env "NOMAD_ALLOC_INDEX" }}"
|
|
|
|
registration_shared_secret: "{{ .Data.data.registration_shared_secret }}"
|
|
|
|
macaroon_secret_key: "{{ .Data.data.macaroon_secret_key }}"
|
|
|
|
form_secret: "{{ .Data.data.form_secret }}"
|
|
|
|
database:
|
|
|
|
name: "psycopg2"
|
|
|
|
args:
|
|
|
|
user: "synapse"
|
|
|
|
password: "{{ .Data.data.pgpass }}"
|
|
|
|
database: "synapse"
|
|
|
|
host: "127.0.0.1"
|
|
|
|
cp_min: 5
|
|
|
|
cp_max: 10
|
|
|
|
redis:
|
|
|
|
enabled: true
|
|
|
|
password: "{{ .Data.data.redis_password }}"
|
|
|
|
{{ end }}
|
|
|
|
EOF
|
|
|
|
destination = "/secrets/extra.yaml"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
group "postgresql" {
|
|
|
|
count = 1
|
|
|
|
|
|
|
|
volume "matrix-postgresql" {
|
|
|
|
type = "csi"
|
|
|
|
source = "matrix-postgresql"
|
|
|
|
read_only = false
|
|
|
|
|
|
|
|
attachment_mode = "file-system"
|
|
|
|
access_mode = "single-node-writer"
|
|
|
|
}
|
|
|
|
|
|
|
|
restart {
|
|
|
|
attempts = 5
|
|
|
|
delay = "5s"
|
|
|
|
}
|
|
|
|
|
|
|
|
network {
|
|
|
|
mode = "bridge"
|
|
|
|
}
|
|
|
|
|
|
|
|
service {
|
|
|
|
name = "matrix-postgresql"
|
|
|
|
port = "5432"
|
|
|
|
|
|
|
|
# check {
|
|
|
|
|
|
|
|
# }
|
|
|
|
|
|
|
|
connect {
|
|
|
|
sidecar_service {}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
task "postgresql" {
|
|
|
|
driver = "docker"
|
|
|
|
|
|
|
|
volume_mount {
|
|
|
|
volume = "matrix-postgresql"
|
|
|
|
destination = "/var/lib/postgresql"
|
|
|
|
read_only = false
|
|
|
|
}
|
|
|
|
|
|
|
|
config {
|
|
|
|
nix_flake_ref = "${var.flake_ref}#nixngSystems.conduitPostgresql.config.system.build.toplevel"
|
|
|
|
nix_flake_sha = var.flake_sha
|
|
|
|
entrypoint = [ "init" ]
|
|
|
|
}
|
|
|
|
|
|
|
|
resources {
|
|
|
|
cpu = 500
|
|
|
|
memory = 1024
|
|
|
|
memory_max = 1536
|
|
|
|
}
|
|
|
|
|
|
|
|
template {
|
|
|
|
data = <<EOF
|
|
|
|
alter user synapse with password '{{ with secret "kv/data/cluster/matrix/synapse" }}{{ .Data.data.pgpass }}{{ end }}';
|
|
|
|
EOF
|
|
|
|
destination = "secrets/init.sql"
|
|
|
|
}
|
|
|
|
|
|
|
|
vault {
|
|
|
|
policies = ["matrix-synapse-policy"]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
group "synapse" {
|
|
|
|
count = 1
|
|
|
|
|
|
|
|
volume "matrix-synapse" {
|
|
|
|
type = "csi"
|
|
|
|
source = "matrix-synapse"
|
|
|
|
read_only = false
|
|
|
|
|
|
|
|
attachment_mode = "file-system"
|
|
|
|
access_mode = "multi-node-multi-writer"
|
|
|
|
}
|
|
|
|
|
|
|
|
volume "matrix-registrations" {
|
|
|
|
type = "csi"
|
|
|
|
source = "matrix-registrations"
|
|
|
|
read_only = false
|
|
|
|
|
|
|
|
attachment_mode = "file-system"
|
|
|
|
access_mode = "multi-node-multi-writer"
|
|
|
|
}
|
|
|
|
|
|
|
|
restart {
|
|
|
|
attempts = 5
|
|
|
|
delay = "5s"
|
|
|
|
}
|
|
|
|
|
|
|
|
network {
|
|
|
|
mode = "bridge"
|
|
|
|
}
|
|
|
|
|
|
|
|
service {
|
|
|
|
name = "matrix-synapse"
|
|
|
|
port = "6167"
|
|
|
|
|
|
|
|
check {
|
|
|
|
type = "http"
|
|
|
|
address_mode = "alloc"
|
|
|
|
path = "/health"
|
|
|
|
port = "6167"
|
|
|
|
interval = "2s"
|
|
|
|
timeout = "2s"
|
|
|
|
}
|
|
|
|
|
|
|
|
connect {
|
|
|
|
sidecar_service {
|
|
|
|
proxy {
|
|
|
|
upstreams {
|
|
|
|
destination_name = "matrix-mautrix-facebook"
|
|
|
|
local_bind_port = 29319
|
|
|
|
}
|
|
|
|
|
|
|
|
upstreams {
|
|
|
|
destination_name = "matrix-heisenbridge"
|
|
|
|
local_bind_port = 9898
|
|
|
|
}
|
|
|
|
|
|
|
|
upstreams {
|
|
|
|
destination_name = "matrix-postgresql"
|
|
|
|
local_bind_port = 5432
|
|
|
|
}
|
|
|
|
|
|
|
|
upstreams {
|
|
|
|
destination_name = "matrix-redis"
|
|
|
|
local_bind_port = 6379
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
service {
|
|
|
|
name = "matrix-synapse-replication"
|
|
|
|
port = "9093"
|
|
|
|
|
|
|
|
# check {
|
|
|
|
# type = "http"
|
|
|
|
# address_mode = "alloc"
|
|
|
|
# path = "/"
|
|
|
|
# port = "9093"
|
|
|
|
# interval = "2s"
|
|
|
|
# timeout = "2s"
|
|
|
|
# }
|
|
|
|
|
|
|
|
connect {
|
|
|
|
sidecar_service {}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
task "synapse" {
|
|
|
|
driver = "docker"
|
|
|
|
|
|
|
|
volume_mount {
|
|
|
|
volume = "matrix-synapse"
|
|
|
|
destination = "/var/lib/synapse"
|
|
|
|
read_only = false
|
|
|
|
}
|
|
|
|
|
|
|
|
volume_mount {
|
|
|
|
volume = "matrix-registrations"
|
|
|
|
destination = "/var/lib/registrations"
|
|
|
|
read_only = false
|
|
|
|
}
|
|
|
|
|
|
|
|
config {
|
|
|
|
nix_flake_ref = "${var.flake_ref}#nixngSystems.conduit.config.system.build.toplevel"
|
|
|
|
nix_flake_sha = var.flake_sha
|
|
|
|
entrypoint = [ "init" ]
|
|
|
|
}
|
|
|
|
|
|
|
|
resources {
|
|
|
|
cpu = 2048
|
|
|
|
memory = 768
|
|
|
|
}
|
|
|
|
|
|
|
|
vault {
|
|
|
|
policies = ["matrix-synapse-policy"]
|
2022-10-30 01:21:24 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
template {
|
|
|
|
data = <<EOF
|
2023-04-20 11:47:46 +02:00
|
|
|
{{ with secret "kv/data/cluster/matrix/synapse" }}
|
2022-10-27 11:39:39 +02:00
|
|
|
registration_shared_secret: "{{ .Data.data.registration_shared_secret }}"
|
|
|
|
macaroon_secret_key: "{{ .Data.data.macaroon_secret_key }}"
|
|
|
|
form_secret: "{{ .Data.data.form_secret }}"
|
2022-10-30 01:21:24 +02:00
|
|
|
database:
|
|
|
|
name: "psycopg2"
|
|
|
|
args:
|
|
|
|
user: "synapse"
|
|
|
|
password: "{{ .Data.data.pgpass }}"
|
|
|
|
database: "synapse"
|
|
|
|
host: "127.0.0.1"
|
|
|
|
cp_min: 5
|
|
|
|
cp_max: 10
|
2023-04-20 11:47:46 +02:00
|
|
|
redis:
|
|
|
|
enabled: true
|
|
|
|
password: "{{ .Data.data.redis_password }}"
|
2022-10-27 11:39:39 +02:00
|
|
|
{{ end }}
|
|
|
|
EOF
|
|
|
|
destination = "/secrets/extra.yaml"
|
2022-09-18 18:24:43 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|