2023-06-13 09:56:10 +00:00
|
|
|
job "core-tricot" {
|
2023-01-04 09:06:06 +00:00
|
|
|
datacenters = ["neptune", "jupiter", "corrin", "bespin"]
|
2022-12-07 15:35:21 +00:00
|
|
|
type = "system"
|
2021-12-25 18:40:51 +00:00
|
|
|
priority = 90
|
|
|
|
|
2022-12-07 15:35:21 +00:00
|
|
|
constraint {
|
|
|
|
attribute = "${attr.cpu.arch}"
|
|
|
|
value = "amd64"
|
|
|
|
}
|
|
|
|
|
|
|
|
update {
|
|
|
|
max_parallel = 1
|
|
|
|
stagger = "1m"
|
|
|
|
}
|
|
|
|
|
|
|
|
group "tricot" {
|
2021-12-25 18:40:51 +00:00
|
|
|
network {
|
|
|
|
port "http_port" { static = 80 }
|
|
|
|
port "https_port" { static = 443 }
|
2022-12-06 13:41:53 +00:00
|
|
|
port "metrics_port" { static = 9334 }
|
2021-12-25 18:40:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
task "server" {
|
2022-12-01 15:04:47 +00:00
|
|
|
driver = "nix2"
|
2021-12-25 18:40:51 +00:00
|
|
|
|
|
|
|
config {
|
2022-12-01 15:04:47 +00:00
|
|
|
packages = [
|
2023-06-13 09:56:10 +00:00
|
|
|
"git+https://git.deuxfleurs.fr/Deuxfleurs/tricot.git?ref=main&rev=3999723308da10e564c4634997c6ecf63f2839d4"
|
2021-12-30 19:56:13 +00:00
|
|
|
]
|
2022-12-01 15:04:47 +00:00
|
|
|
command = "tricot"
|
|
|
|
# cap_add = [ "net_bind_service" ] # this doesn't work for whatever reason, so we need to put user = "root" instead
|
2021-12-25 18:40:51 +00:00
|
|
|
}
|
2022-12-01 15:04:47 +00:00
|
|
|
user = "root"
|
2021-12-25 18:40:51 +00:00
|
|
|
|
|
|
|
resources {
|
2023-01-03 17:25:32 +00:00
|
|
|
cpu = 500
|
2021-12-25 18:40:51 +00:00
|
|
|
memory = 200
|
|
|
|
}
|
|
|
|
|
|
|
|
restart {
|
|
|
|
interval = "30m"
|
|
|
|
attempts = 2
|
|
|
|
delay = "15s"
|
|
|
|
mode = "delay"
|
|
|
|
}
|
|
|
|
|
2021-12-30 19:56:13 +00:00
|
|
|
template {
|
|
|
|
data = "{{ key \"secrets/consul/consul-ca.crt\" }}"
|
2022-12-01 15:04:47 +00:00
|
|
|
destination = "etc/tricot/consul-ca.crt"
|
2021-12-30 19:56:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
template {
|
|
|
|
data = "{{ key \"secrets/consul/consul-client.crt\" }}"
|
2022-12-01 15:04:47 +00:00
|
|
|
destination = "etc/tricot/consul-client.crt"
|
2021-12-30 19:56:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
template {
|
|
|
|
data = "{{ key \"secrets/consul/consul-client.key\" }}"
|
2022-12-01 15:04:47 +00:00
|
|
|
destination = "etc/tricot/consul-client.key"
|
2021-12-30 19:56:13 +00:00
|
|
|
}
|
|
|
|
|
2021-12-25 18:40:51 +00:00
|
|
|
template {
|
|
|
|
data = <<EOH
|
2022-01-13 11:02:40 +00:00
|
|
|
TRICOT_NODE_NAME={{ env "attr.unique.consul.name" }}
|
2021-12-25 18:40:51 +00:00
|
|
|
TRICOT_LETSENCRYPT_EMAIL=alex@adnab.me
|
2023-03-20 08:44:37 +00:00
|
|
|
#TRICOT_ENABLE_COMPRESSION=true
|
2021-12-30 19:56:13 +00:00
|
|
|
TRICOT_CONSUL_HOST=https://localhost:8501
|
|
|
|
TRICOT_CONSUL_CA_CERT=/etc/tricot/consul-ca.crt
|
|
|
|
TRICOT_CONSUL_CLIENT_CERT=/etc/tricot/consul-client.crt
|
|
|
|
TRICOT_CONSUL_CLIENT_KEY=/etc/tricot/consul-client.key
|
2022-05-04 13:07:03 +00:00
|
|
|
TRICOT_HTTP_BIND_ADDR=[::]:80
|
|
|
|
TRICOT_HTTPS_BIND_ADDR=[::]:443
|
2022-12-06 13:41:53 +00:00
|
|
|
TRICOT_METRICS_BIND_ADDR=[::]:9334
|
2022-03-08 13:28:57 +00:00
|
|
|
RUST_LOG=tricot=debug
|
2023-04-20 13:13:13 +00:00
|
|
|
RUST_BACKTRACE=1
|
2021-12-25 18:40:51 +00:00
|
|
|
EOH
|
|
|
|
destination = "secrets/env"
|
|
|
|
env = true
|
|
|
|
}
|
|
|
|
|
|
|
|
service {
|
|
|
|
name = "tricot-http"
|
|
|
|
port = "http_port"
|
2022-12-07 15:35:21 +00:00
|
|
|
tags = [
|
2022-12-11 20:27:16 +00:00
|
|
|
"d53-aaaa ${meta.site}.site.staging.deuxfleurs.org",
|
|
|
|
"d53-aaaa staging.deuxfleurs.org",
|
2023-04-05 14:30:28 +00:00
|
|
|
"(diplonat (tcp_port 80))"
|
2022-12-07 15:35:21 +00:00
|
|
|
]
|
2021-12-25 18:40:51 +00:00
|
|
|
address_mode = "host"
|
|
|
|
}
|
|
|
|
|
|
|
|
service {
|
|
|
|
name = "tricot-https"
|
|
|
|
port = "https_port"
|
2022-12-07 15:35:21 +00:00
|
|
|
tags = [
|
2023-04-05 14:30:28 +00:00
|
|
|
"(diplonat (tcp_port 443))"
|
2022-12-07 15:35:21 +00:00
|
|
|
]
|
2021-12-25 18:40:51 +00:00
|
|
|
address_mode = "host"
|
|
|
|
}
|
2022-12-05 22:42:53 +00:00
|
|
|
|
|
|
|
service {
|
|
|
|
name = "tricot-metrics"
|
|
|
|
port = "metrics_port"
|
|
|
|
address_mode = "host"
|
|
|
|
}
|
2021-12-25 18:40:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|