mirror of
https://git.sr.ht/~magic_rb/dotfiles
synced 2024-11-25 17:46:14 +01:00
e9993d139c
Signed-off-by: Magic_RB <magic_rb@redalder.org>
119 lines
2.4 KiB
HCL
119 lines
2.4 KiB
HCL
variable "flake_ref" {
|
|
type = string
|
|
}
|
|
|
|
variable "flake_sha" {
|
|
type = string
|
|
}
|
|
|
|
variable "store_path" {
|
|
type = string
|
|
}
|
|
|
|
job "matrix-mautrix-discord" {
|
|
datacenters = [ "homelab-1" ]
|
|
type = "service"
|
|
|
|
group "mautrix-discord" {
|
|
count = 1
|
|
|
|
volume "matrix-mautrix-discord" {
|
|
type = "csi"
|
|
source = "matrix-mautrix-discord"
|
|
read_only = false
|
|
|
|
attachment_mode = "file-system"
|
|
access_mode = "single-node-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-mautrix-discord"
|
|
port = "29334"
|
|
|
|
# check {
|
|
# type = "http"
|
|
# address_mode = "alloc"
|
|
# path = "/public"
|
|
# port = "29319"
|
|
# interval = "2s"
|
|
# timeout = "2s"
|
|
# }
|
|
|
|
connect {
|
|
sidecar_service {
|
|
proxy {
|
|
upstreams {
|
|
destination_name = "matrix-postgresql"
|
|
local_bind_port = 5432
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
task "mautrix-discord" {
|
|
driver = "docker"
|
|
|
|
volume_mount {
|
|
volume = "matrix-mautrix-discord"
|
|
destination = "/var/lib/mautrix-discord"
|
|
read_only = false
|
|
}
|
|
|
|
volume_mount {
|
|
volume = "matrix-registrations"
|
|
destination = "/var/lib/registrations"
|
|
read_only = false
|
|
}
|
|
|
|
config {
|
|
nix_flake_ref = "${var.flake_ref}#nixngConfigurations.mautrixDiscord.config.system.build.toplevel"
|
|
nix_flake_sha = var.flake_sha
|
|
nix_flake_store_path = var.store_path
|
|
entrypoint = [ "init" ]
|
|
}
|
|
|
|
vault {
|
|
policies = ["matrix-mautrix-discord-policy"]
|
|
}
|
|
|
|
template {
|
|
data = <<EOF
|
|
{{ with secret "kv/data/cluster/matrix/mautrix-discord/main" }}
|
|
MAUTRIX_DISCORD_APPSERVICE_AS_TOKEN={{ .Data.data.as_token }}
|
|
MAUTRIX_DISCORD_APPSERVICE_HS_TOKEN={{ .Data.data.hs_token }}
|
|
{{ end }}
|
|
{{ with secret "kv/data/cluster/matrix/mautrix-discord/postgresql" }}
|
|
MAUTRIX_DISCORD_APPSERVICE_DATABASE_PASSWORD={{ .Data.data.pgpass }}
|
|
{{ end }}
|
|
EOF
|
|
destination = "secrets/environment"
|
|
env = true
|
|
}
|
|
|
|
resources {
|
|
cpu = 256
|
|
memory = 256
|
|
}
|
|
}
|
|
}
|
|
}
|