diff --git a/ansible/group_vars/all/nomad b/ansible/group_vars/all/nomad index f644a75..0f2cfa5 100644 --- a/ansible/group_vars/all/nomad +++ b/ansible/group_vars/all/nomad @@ -5,4 +5,4 @@ nomad_docker_allow_caps: nomad_vault_enabled: true nomad_vault_address: "http://active.vault.service.{{consul_domain}}:8200" nomad_vault_role: "nomad-cluster" - +nomad_docker_extra_labels: ["job_name", "task_group_name", "task_name", "namespace", "node_name"] diff --git a/nomad-job/promtail.nomad b/nomad-job/decom/promtail.nomad similarity index 100% rename from nomad-job/promtail.nomad rename to nomad-job/decom/promtail.nomad diff --git a/nomad-job/vector.nomad b/nomad-job/vector.nomad new file mode 100644 index 0000000..34fb44a --- /dev/null +++ b/nomad-job/vector.nomad @@ -0,0 +1,87 @@ +job "vector" { + datacenters = ["homelab", "hetzner"] + priority = 50 + type = "system" + meta { + forcedeploy = "0" + } + group "vector" { + count = 1 + network { + port api { + to = 8686 + } + } + task "vector" { + driver = "docker" + config { + image = "timberio/vector:0.34.1-alpine" + ports = ["api"] + volumes = [ + "/var/run/docker.sock:/var/run/docker.sock", + ] + + } + # docker socket volume mount + env { + VECTOR_CONFIG = "local/vector.toml" + VECTOR_REQUIRE_HEALTHY = "true" + } + # resource limits are a good idea because you don't want your log collection to consume all resources available + resources { + cpu = 500 # 500 MHz + memory = 256 # 256MB + } + # template with Vector's configuration + 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=<