2022-06-01 08:41:51 +02:00
|
|
|
variable "flake_ref" {
|
|
|
|
type = string
|
|
|
|
}
|
|
|
|
|
|
|
|
variable "flake_sha" {
|
|
|
|
type = string
|
|
|
|
}
|
|
|
|
|
2021-10-17 22:21:32 +02:00
|
|
|
job "camptules" {
|
|
|
|
datacenters = [ "homelab-1" ]
|
|
|
|
type = "service"
|
|
|
|
|
|
|
|
group "camptules" {
|
|
|
|
count = 1
|
|
|
|
|
2022-06-01 08:41:51 +02:00
|
|
|
network {
|
|
|
|
mode = "bridge"
|
|
|
|
}
|
|
|
|
|
2021-10-17 22:21:32 +02:00
|
|
|
task "camptules" {
|
2022-06-01 08:41:51 +02:00
|
|
|
driver = "containerd-driver"
|
2021-10-17 22:21:32 +02:00
|
|
|
|
|
|
|
config {
|
2022-07-30 23:27:40 +02:00
|
|
|
flake_ref = "${var.flake_ref}#nixngSystems.camptules.config.system.build.toplevel"
|
|
|
|
flake_sha = var.flake_sha
|
|
|
|
entrypoint = [ "init" ]
|
2021-10-17 22:21:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
resources {
|
2022-07-30 23:27:40 +02:00
|
|
|
cpu = 512
|
|
|
|
memory = 128
|
|
|
|
memory_max = 192
|
2021-10-17 22:21:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
vault {
|
2022-07-30 23:27:40 +02:00
|
|
|
policies = ["camptules-policy"]
|
2021-10-17 22:21:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
template {
|
2022-07-30 23:27:40 +02:00
|
|
|
data = <<EOF
|
2021-10-17 22:21:32 +02:00
|
|
|
{{ with secret "kv/data/camptules" }}
|
2022-04-26 09:44:20 +02:00
|
|
|
{{ .Data.data.token }}
|
2021-10-17 22:21:32 +02:00
|
|
|
{{ end }}
|
|
|
|
EOF
|
2022-07-30 23:27:40 +02:00
|
|
|
destination = "secrets/cfg"
|
2022-04-26 09:44:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
template {
|
2022-07-30 23:27:40 +02:00
|
|
|
data = <<EOF
|
2022-04-26 09:44:20 +02:00
|
|
|
{{ with secret "kv/data/camptules" }}
|
|
|
|
{{ .Data.data.ytb_api_key }}
|
|
|
|
{{ end }}
|
|
|
|
EOF
|
2022-07-30 23:27:40 +02:00
|
|
|
destination = "secrets/ytb-api-key"
|
2021-10-17 22:21:32 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|