diff --git a/infra/jobs/station/logging.levant.nomad b/infra/jobs/station/logging.levant.nomad index 998c57f4193e92ad20ec1aa2d0486668663557a1..32b07b203a90f29982356f15eb6cc39c6eaf2ecc 100644 --- a/infra/jobs/station/logging.levant.nomad +++ b/infra/jobs/station/logging.levant.nomad @@ -35,22 +35,6 @@ job "log-scraping" { sticky = true } - service { - connect { - sidecar_service { - proxy { - upstreams { - destination_name = "prometheus" - local_bind_port = 9090 - } - upstreams { - destination_name = "loki" - local_bind_port = 3100 - } - } - } - } - } task "vector" { driver = "docker" @@ -129,7 +113,7 @@ healthchecks.require_healthy = true [sinks.loki] type = "loki" inputs = [ "nomad-flags" ] - endpoint = "http://localhost:3100" + endpoint = "http://loki.service.consul:3100" encoding.codec = "json" healthcheck.enabled = true remove_label_fields = true @@ -150,7 +134,7 @@ healthchecks.require_healthy = true [sinks.prometheus_remote_write] type = "prometheus_remote_write" inputs = [ "host_metrics", "nomad_metrics", "vector_metrics" ] - endpoint = "http://localhost:9090/api/v1/write" + endpoint = "http://prometheus.service.consul:9090/api/v1/write" healthcheck.enabled = false EOF } diff --git a/infra/jobs/station/monitoring.levant.nomad b/infra/jobs/station/monitoring.levant.nomad index 358d8b83869c3a310b1c19459b7445c3802d39a1..554b0c43ad11d132a42d488c184b690eed45b8f8 100644 --- a/infra/jobs/station/monitoring.levant.nomad +++ b/infra/jobs/station/monitoring.levant.nomad @@ -8,7 +8,7 @@ job "monitoring" { network { mode = "bridge" port "postgres" { - to = 5432 + static = 5432 } } @@ -22,11 +22,7 @@ job "monitoring" { name = "postgres" port = "postgres" task = "postgres" - address_mode = "alloc" - connect { - sidecar_service {} - } } task "postgres" { @@ -69,24 +65,6 @@ job "monitoring" { name = "grafana" port = "http" - connect { - sidecar_service { - proxy { - upstreams { - destination_name = "postgres" - local_bind_port = 5432 - } - upstreams { - destination_name = "prometheus" - local_bind_port = 9090 - } - upstreams { - destination_name = "loki" - local_bind_port = 3100 - } - } - } - } } task "wait-for-db" { @@ -99,7 +77,7 @@ job "monitoring" { config { image = "[[.registry.astron.url]]/postgres:[[.monitoring.db.version]]" command = "sh" - args = ["-c", "while ! pg_isready -h localhost; do sleep 1; done"] + args = ["-c", "while ! pg_isready -h postgres.service.consul; do sleep 1; done"] } env { PGPASSFILE = "local/pgpass.txt" @@ -107,9 +85,7 @@ job "monitoring" { template { data = <<EOH -{{ range service "postgres" }} -localhost:5432:grafana:postgres:password -{{ end }} +postgres.service.consul:5432:grafana:postgres:password EOH destination = "local/pgpass.txt" perms = "600" @@ -138,7 +114,7 @@ localhost:5432:grafana:postgres:password GF_SERVER_ROOT_URL = "%(protocol)s://%(domain)s:%(http_port)s/grafana/" GF_SERVER_SERVE_FROM_SUB_PATH = "true" GF_DATABASE_TYPE = "postgres" - GF_DATABASE_HOST = "localhost:5432" + GF_DATABASE_HOST = "postgres.service.consul:5432" GF_DATABASE_NAME = "grafana" GF_DATABASE_USER = "postgres" GF_DATABASE_PASSWORD = "password" @@ -157,7 +133,7 @@ localhost:5432:grafana:postgres:password access: proxy orgId: 1 uid: prometheus - url: http://localhost:9090 + url: http://prometheus.service.consul:9090 isDefault: true EOH @@ -173,7 +149,7 @@ localhost:5432:grafana:postgres:password access: proxy orgId: 1 uid: loki - url: http://localhost:3100 + url: http://loki.service.consul:3100 jsonData: esVersion: 7.10.0 includeFrozen: false @@ -198,6 +174,7 @@ localhost:5432:grafana:postgres:password mode = "bridge" port "prometheus" { + static = 9090 to = 9090 } } @@ -212,18 +189,7 @@ localhost:5432:grafana:postgres:password tags = ["haproxy", "scrape"] name = "prometheus" port = "prometheus" - address_mode = "alloc" - connect { - sidecar_service { - proxy { - upstreams { - destination_name = "snmp-exporter" - local_bind_port = 9116 - } - } - } - } check { type = "http" @@ -327,7 +293,7 @@ localhost:5432:grafana:postgres:password - source_labels: [__meta_consul_service_address] target_label: __param_target - target_label: __address__ - replacement: "localhost:9116" + replacement: "snmp-exporter.service.consul:9116" - source_labels: [__meta_consul_service] target_label: instance # avoid a dynamic ip:port or hostname EOH @@ -355,7 +321,7 @@ localhost:5432:grafana:postgres:password port "loki" { to = 3100 # should be activated when fully replaces docker-compose setup - #static = 3100 + static = 3100 } } @@ -371,9 +337,6 @@ localhost:5432:grafana:postgres:password port = "loki" address_mode = "alloc" - connect { - sidecar_service {} - } } task "loki" {