lab7: TLS ко всем зависимостям и телеметрии; раздельные роли PostgreSQL (GRANT по коду), ACL Valkey, AMQPS, HTTPS S3, mTLS Collector/Prometheus/Loki/Tempo/Grafana

This commit is contained in:
Alexey Bodanyuk
2026-11-27 16:29:09 +03:00
parent f36da97951
commit 93f4ed1013
28 changed files with 621 additions and 201 deletions
+21 -11
View File
@@ -1,11 +1,15 @@
# Prometheus 3.16 (prom/prometheus:v3.16.0), lab 6: the METRICS store.
# Prometheus 3.16 (prom/prometheus:v3.16.0), labs 6-7: the METRICS store.
#
# Application metrics are PUSHED by the Collector over OTLP (flag --web.enable-otlp-receiver,
# endpoint /api/v1/otlp/v1/metrics). Prometheus derives `job` = service.name and
# `instance` = service.instance.id from the OTLP resource, and translates the OTel names with
# suffixes: http.server.request.duration (unit s) -> http_server_request_duration_seconds_bucket,
# messenger.jobs.processed -> messenger_jobs_processed_total (mapping: docs/OBSERVABILITY.md).
# The telemetry components themselves are SCRAPED (pull) below.
# Application metrics AND the Collector's own metrics are PUSHED by the Collector over OTLP/HTTPS
# (flag --web.enable-otlp-receiver, endpoint /api/v1/otlp/v1/metrics). Prometheus derives
# `job` = service.name and `instance` = service.instance.id from the OTLP resource, and translates
# the OTel names with suffixes: http.server.request.duration (unit s) ->
# http_server_request_duration_seconds_bucket (mapping: docs/OBSERVABILITY.md).
#
# Lab 7: the web listener is HTTPS with a REQUIRED client certificate of the internal CA and a SAN
# allowlist (web-config.yml): only otel-collector (push), grafana (queries) and prometheus itself
# (self-scrape, promtool healthcheck) get in. Scrapes of Loki/Tempo use HTTPS + this server's
# own client certificate (they require one too).
global:
scrape_interval: 15s
evaluation_interval: 15s # alert rules: detection delay = condition + `for` + <= 15 s
@@ -24,13 +28,19 @@ rule_files:
- /etc/prometheus/rules/*.yml
scrape_configs:
- job_name: otel-collector # otelcol_* : accepted/refused/sent/failed, queue size, RSS
static_configs: [{targets: ["otel-collector:8888"]}]
- job_name: prometheus
scheme: https
tls_config: &mtls
ca_file: /run/secrets/internal-ca.crt
cert_file: /run/secrets/prometheus.crt
key_file: /run/secrets/prometheus.key
min_version: TLS12
static_configs: [{targets: ["localhost:9090"]}]
- job_name: loki
scheme: https
tls_config: *mtls
static_configs: [{targets: ["loki:3100"]}]
- job_name: tempo
scheme: https
tls_config: *mtls
static_configs: [{targets: ["tempo:3200"]}]
- job_name: grafana
static_configs: [{targets: ["grafana:3000"]}]