2021-12-25 18:40:51 +00:00
|
|
|
job "core" {
|
|
|
|
datacenters = ["dc1", "neptune"]
|
|
|
|
type = "system"
|
|
|
|
priority = 90
|
|
|
|
|
|
|
|
constraint {
|
|
|
|
attribute = "${attr.cpu.arch}"
|
|
|
|
value = "amd64"
|
|
|
|
}
|
|
|
|
|
|
|
|
update {
|
|
|
|
max_parallel = 1
|
|
|
|
stagger = "1m"
|
|
|
|
}
|
|
|
|
|
|
|
|
group "network" {
|
|
|
|
task "diplonat" {
|
2022-12-01 21:32:02 +00:00
|
|
|
driver = "nix2"
|
2021-12-25 18:40:51 +00:00
|
|
|
|
|
|
|
config {
|
2022-12-01 21:32:02 +00:00
|
|
|
packages = [
|
|
|
|
"#iptables",
|
|
|
|
"git+https://git.deuxfleurs.fr/Deuxfleurs/diplonat.git?ref=main&rev=f306e8dc8d0e93478353ce39b6064e8c06a8bca6"
|
2021-12-30 19:56:13 +00:00
|
|
|
]
|
2022-12-01 21:32:02 +00:00
|
|
|
command = "diplonat"
|
2021-12-25 18:40:51 +00:00
|
|
|
}
|
2022-12-01 21:32:02 +00:00
|
|
|
user = "root"
|
2021-12-25 18:40:51 +00:00
|
|
|
|
|
|
|
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 21:32:02 +00:00
|
|
|
destination = "etc/diplonat/consul-ca.crt"
|
2021-12-30 19:56:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
template {
|
|
|
|
data = "{{ key \"secrets/consul/consul-client.crt\" }}"
|
2022-12-01 21:32:02 +00:00
|
|
|
destination = "etc/diplonat/consul-client.crt"
|
2021-12-30 19:56:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
template {
|
|
|
|
data = "{{ key \"secrets/consul/consul-client.key\" }}"
|
2022-12-01 21:32:02 +00:00
|
|
|
destination = "etc/diplonat/consul-client.key"
|
2021-12-30 19:56:13 +00:00
|
|
|
}
|
|
|
|
|
2021-12-25 18:40:51 +00:00
|
|
|
template {
|
|
|
|
data = <<EOH
|
|
|
|
DIPLONAT_REFRESH_TIME=60
|
|
|
|
DIPLONAT_EXPIRATION_TIME=300
|
|
|
|
DIPLONAT_CONSUL_NODE_NAME={{ env "attr.unique.hostname" }}
|
2021-12-30 19:56:13 +00:00
|
|
|
DIPLONAT_CONSUL_URL=https://localhost:8501
|
|
|
|
DIPLONAT_CONSUL_CA_CERT=/etc/diplonat/consul-ca.crt
|
|
|
|
DIPLONAT_CONSUL_CLIENT_CERT=/etc/diplonat/consul-client.crt
|
|
|
|
DIPLONAT_CONSUL_CLIENT_KEY=/etc/diplonat/consul-client.key
|
2021-12-25 18:40:51 +00:00
|
|
|
RUST_LOG=debug
|
|
|
|
EOH
|
|
|
|
destination = "secrets/env"
|
|
|
|
env = true
|
|
|
|
}
|
|
|
|
|
|
|
|
resources {
|
|
|
|
memory = 40
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|