diff --git a/hosts/common/nomad.nix b/hosts/common/nomad.nix index f431883..816a5c5 100644 --- a/hosts/common/nomad.nix +++ b/hosts/common/nomad.nix @@ -43,6 +43,13 @@ in # TODO: trim this down allow_caps = ["all"]; volumes.enabled = true; + extra_labels = [ + "job_name" + "task_group_name" + "task_name" + "namespace" + "node_name" + ]; }; }; diff --git a/services/vector.hcl b/services/vector.hcl new file mode 100644 index 0000000..2d9ea15 --- /dev/null +++ b/services/vector.hcl @@ -0,0 +1,88 @@ +job "vector" { + datacenters = ["alo"] + type = "system" + group "vector" { + network { + port "api" { + #host_network = "tailscale" + to = 8686 + } + } + ephemeral_disk { + size = 500 + sticky = true + } + task "vector" { + driver = "docker" + config { + image = "timberio/vector:0.28.X-alpine" + ports = ["api"] + volumes = ["/var/run/docker.sock:/var/run/docker.sock:ro"] + } + + env { + VECTOR_CONFIG = "local/vector.toml" + VECTOR_REQUIRE_HEALTHY = "true" + } + + service { + check { + port = "api" + type = "http" + path = "/health" + interval = "30s" + timeout = "5s" + } + } + + resources { + cpu = 500 # 500 MHz + memory = 256 # 256MB + } + + template { + destination = "local/vector.toml" + change_mode = "signal" + change_signal = "SIGHUP" + # overriding the delimiters to [[ ]] to avoid conflicts with Vector's native templating, which also uses {{ }} + left_delimiter = "[[" + right_delimiter = "]]" + data=<