Щербацевич-БПИ2302-на 3
This commit is contained in:
@@ -0,0 +1 @@
|
||||
{"inject_transient": false, "crash_after_s3": false, "relay_exit_before_publish": false, "stall_seconds": 0, "timeout_seconds": 0}
|
||||
@@ -0,0 +1,212 @@
|
||||
{
|
||||
"annotations": {"list": []},
|
||||
"editable": true,
|
||||
"fiscalYearStartMonth": 0,
|
||||
"graphTooltip": 1,
|
||||
"links": [],
|
||||
"refresh": "10s",
|
||||
"schemaVersion": 39,
|
||||
"tags": ["messenger", "lab6"],
|
||||
"time": {"from": "now-1h", "to": "now"},
|
||||
"timezone": "browser",
|
||||
"title": "Messenger observability",
|
||||
"uid": "messenger-lab6",
|
||||
"version": 1,
|
||||
"panels": [
|
||||
{
|
||||
"type": "text",
|
||||
"id": 1,
|
||||
"title": "SLI и единицы",
|
||||
"gridPos": {"h": 5, "w": 24, "x": 0, "y": 0},
|
||||
"options": {
|
||||
"mode": "markdown",
|
||||
"content": "**API availability.** SLI = бизнес-ответы 5xx / все бизнес-запросы, без `/health`. SLO = 99% успеха на окне 5 минут. Алерт смотрит окно 1 минута и порог 5%.\n\n**Time to ready.** SLI = гистограмма секунд от записи вложения до `ready`. SLO = p95 не выше 60 с. Алерт смотрит возраст старейшей queued/processing задачи и порог 30 с. Это backlog, не среднее время обработки.\n\nПроцентили считаются `histogram_quantile` по сумме bucket всех реплик (`sum by (le)`), а не как среднее готовых p95. Единицы: RPS — запросы/с, длительность и возраст — секунды, пул и worker — штуки, память — байты, CPU — ядра."
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "timeseries",
|
||||
"id": 2,
|
||||
"title": "API RPS",
|
||||
"description": "Запросы в секунду, только sli=business. Единица req/s.",
|
||||
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
||||
"gridPos": {"h": 8, "w": 8, "x": 0, "y": 5},
|
||||
"fieldConfig": {"defaults": {"unit": "reqps", "custom": {"drawStyle": "line", "fillOpacity": 15}}, "overrides": []},
|
||||
"options": {"legend": {"displayMode": "list", "placement": "bottom"}},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
||||
"expr": "sum by (status_class) (rate(http_server_requests_total{service_name=\"messenger-api\",sli=\"business\"}[1m]))",
|
||||
"legendFormat": "{{status_class}}"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "timeseries",
|
||||
"id": 3,
|
||||
"title": "Ошибки API",
|
||||
"description": "Сколько бизнес-ответов 4xx и 5xx накоплено. 4xx — ошибка запроса, 5xx — сбой сервера. Алерт и SLO по-прежнему только про 5xx.",
|
||||
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
||||
"gridPos": {"h": 8, "w": 8, "x": 8, "y": 5},
|
||||
"fieldConfig": {"defaults": {"unit": "short", "min": 0, "custom": {"drawStyle": "line", "fillOpacity": 10}}, "overrides": []},
|
||||
"options": {"legend": {"displayMode": "list", "placement": "bottom"}},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
||||
"expr": "sum by (status_class) (http_server_requests_total{service_name=\"messenger-api\",sli=\"business\",status_class=~\"4xx|5xx\"}) or label_replace(vector(0), \"status_class\", \"4xx\", \"\", \"\") or label_replace(vector(0), \"status_class\", \"5xx\", \"\", \"\")",
|
||||
"legendFormat": "{{status_class}}"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "timeseries",
|
||||
"id": 4,
|
||||
"title": "API duration",
|
||||
"description": "Секунды. histogram_quantile от суммы bucket всех реплик API.",
|
||||
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
||||
"gridPos": {"h": 8, "w": 8, "x": 16, "y": 5},
|
||||
"fieldConfig": {"defaults": {"unit": "s", "custom": {"drawStyle": "line", "fillOpacity": 10}}, "overrides": []},
|
||||
"options": {"legend": {"displayMode": "list", "placement": "bottom"}},
|
||||
"targets": [
|
||||
{"refId": "A", "datasource": {"type": "prometheus", "uid": "prometheus"}, "expr": "histogram_quantile(0.50, sum by (le) (rate(http_server_duration_seconds_bucket{service_name=\"messenger-api\",sli=\"business\"}[5m])))", "legendFormat": "p50"},
|
||||
{"refId": "B", "datasource": {"type": "prometheus", "uid": "prometheus"}, "expr": "histogram_quantile(0.95, sum by (le) (rate(http_server_duration_seconds_bucket{service_name=\"messenger-api\",sli=\"business\"}[5m])))", "legendFormat": "p95"},
|
||||
{"refId": "C", "datasource": {"type": "prometheus", "uid": "prometheus"}, "expr": "histogram_quantile(0.99, sum by (le) (rate(http_server_duration_seconds_bucket{service_name=\"messenger-api\",sli=\"business\"}[5m])))", "legendFormat": "p99"}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "timeseries",
|
||||
"id": 5,
|
||||
"title": "Jobs",
|
||||
"description": "Задачи в секунду по outcome. Единица jobs/s.",
|
||||
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
||||
"gridPos": {"h": 8, "w": 8, "x": 0, "y": 13},
|
||||
"fieldConfig": {"defaults": {"unit": "ops", "custom": {"drawStyle": "line", "fillOpacity": 15}}, "overrides": []},
|
||||
"options": {"legend": {"displayMode": "list", "placement": "bottom"}},
|
||||
"targets": [
|
||||
{"refId": "A", "datasource": {"type": "prometheus", "uid": "prometheus"}, "expr": "sum by (outcome) (rate(jobs_processed_total{job_type=\"attachment.process.v1\",outcome=~\"ready|failed|retry\"}[5m]))", "legendFormat": "{{outcome}}"}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "timeseries",
|
||||
"id": 6,
|
||||
"title": "Job duration",
|
||||
"description": "Секунды обработки. p95 из гистограммы, отдельно для ready и failed.",
|
||||
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
||||
"gridPos": {"h": 8, "w": 8, "x": 8, "y": 13},
|
||||
"fieldConfig": {"defaults": {"unit": "s", "custom": {"drawStyle": "line", "fillOpacity": 10}}, "overrides": []},
|
||||
"options": {"legend": {"displayMode": "list", "placement": "bottom"}},
|
||||
"targets": [
|
||||
{"refId": "A", "datasource": {"type": "prometheus", "uid": "prometheus"}, "expr": "histogram_quantile(0.50, sum by (le) (rate(jobs_duration_seconds_bucket{outcome=~\"ready|failed|retry\"}[5m])))", "legendFormat": "p50"},
|
||||
{"refId": "B", "datasource": {"type": "prometheus", "uid": "prometheus"}, "expr": "histogram_quantile(0.95, sum by (le) (rate(jobs_duration_seconds_bucket{outcome=~\"ready|failed|retry\"}[5m])))", "legendFormat": "p95"},
|
||||
{"refId": "C", "datasource": {"type": "prometheus", "uid": "prometheus"}, "expr": "histogram_quantile(0.99, sum by (le) (rate(jobs_duration_seconds_bucket{outcome=~\"ready|failed|retry\"}[5m])))", "legendFormat": "p99"}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "timeseries",
|
||||
"id": 7,
|
||||
"title": "Time to ready",
|
||||
"description": "Секунды от принятия вложения до ready. p95 — SLO 60 с.",
|
||||
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
||||
"gridPos": {"h": 8, "w": 8, "x": 16, "y": 13},
|
||||
"fieldConfig": {"defaults": {"unit": "s", "custom": {"drawStyle": "line", "fillOpacity": 10}}, "overrides": []},
|
||||
"options": {"legend": {"displayMode": "list", "placement": "bottom"}},
|
||||
"targets": [
|
||||
{"refId": "A", "datasource": {"type": "prometheus", "uid": "prometheus"}, "expr": "histogram_quantile(0.50, sum by (le) (rate(attachment_time_to_ready_seconds_bucket[5m])))", "legendFormat": "p50"},
|
||||
{"refId": "B", "datasource": {"type": "prometheus", "uid": "prometheus"}, "expr": "histogram_quantile(0.95, sum by (le) (rate(attachment_time_to_ready_seconds_bucket[5m])))", "legendFormat": "p95"},
|
||||
{"refId": "C", "datasource": {"type": "prometheus", "uid": "prometheus"}, "expr": "histogram_quantile(0.99, sum by (le) (rate(attachment_time_to_ready_seconds_bucket[5m])))", "legendFormat": "p99"}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "timeseries",
|
||||
"id": 8,
|
||||
"title": "Queue depth",
|
||||
"description": "Число задач queued или processing. max, чтобы две реплики API не удваивали одно наблюдение.",
|
||||
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
||||
"gridPos": {"h": 8, "w": 8, "x": 0, "y": 21},
|
||||
"fieldConfig": {"defaults": {"unit": "short", "custom": {"drawStyle": "line", "fillOpacity": 15}}, "overrides": []},
|
||||
"options": {"legend": {"displayMode": "list", "placement": "bottom"}},
|
||||
"targets": [
|
||||
{"refId": "A", "datasource": {"type": "prometheus", "uid": "prometheus"}, "expr": "max(queue_depth_ratio{queue=\"attachment.jobs\"})", "legendFormat": "attachment.jobs"}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "timeseries",
|
||||
"id": 9,
|
||||
"title": "Oldest job age",
|
||||
"description": "Секунды. Порог алерта 30 с отмечен как backlog, не как latency worker.",
|
||||
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
||||
"gridPos": {"h": 8, "w": 8, "x": 8, "y": 21},
|
||||
"fieldConfig": {"defaults": {"unit": "s", "custom": {"drawStyle": "line", "fillOpacity": 10}}, "overrides": []},
|
||||
"options": {"legend": {"displayMode": "list", "placement": "bottom"}},
|
||||
"targets": [
|
||||
{"refId": "A", "datasource": {"type": "prometheus", "uid": "prometheus"}, "expr": "max(queue_oldest_age_seconds{queue=\"attachment.jobs\"})", "legendFormat": "oldest"}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "timeseries",
|
||||
"id": 10,
|
||||
"title": "DB pool",
|
||||
"description": "Соединения: used — занятые, waiting — ждущие checkout, capacity — размер пула с overflow. Сумма по репликам API.",
|
||||
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
||||
"gridPos": {"h": 8, "w": 8, "x": 16, "y": 21},
|
||||
"fieldConfig": {"defaults": {"unit": "short", "custom": {"drawStyle": "line", "fillOpacity": 10}}, "overrides": []},
|
||||
"options": {"legend": {"displayMode": "list", "placement": "bottom"}},
|
||||
"targets": [
|
||||
{"refId": "A", "datasource": {"type": "prometheus", "uid": "prometheus"}, "expr": "sum by (state) (db_pool_connections_ratio{service_name=\"messenger-api\"})", "legendFormat": "{{state}}"}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "timeseries",
|
||||
"id": 11,
|
||||
"title": "Worker saturation",
|
||||
"description": "busy — занятые слоты, capacity — WORKER_CONCURRENCY.",
|
||||
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
||||
"gridPos": {"h": 8, "w": 8, "x": 0, "y": 29},
|
||||
"fieldConfig": {"defaults": {"unit": "short", "custom": {"drawStyle": "line", "fillOpacity": 10}}, "overrides": []},
|
||||
"options": {"legend": {"displayMode": "list", "placement": "bottom"}},
|
||||
"targets": [
|
||||
{"refId": "A", "datasource": {"type": "prometheus", "uid": "prometheus"}, "expr": "max by (state) (worker_slots_ratio{service_name=\"messenger-worker\"})", "legendFormat": "{{state}}"}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "timeseries",
|
||||
"id": 12,
|
||||
"title": "Process CPU",
|
||||
"description": "Секунды CPU на секунду стены, сумма процессов сервиса. Единица — ядра.",
|
||||
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
||||
"gridPos": {"h": 8, "w": 8, "x": 8, "y": 29},
|
||||
"fieldConfig": {"defaults": {"unit": "short", "custom": {"drawStyle": "line", "fillOpacity": 10}}, "overrides": []},
|
||||
"options": {"legend": {"displayMode": "list", "placement": "bottom"}},
|
||||
"targets": [
|
||||
{"refId": "A", "datasource": {"type": "prometheus", "uid": "prometheus"}, "expr": "sum by (service_name) (process_cpu_utilization_ratio)", "legendFormat": "{{service_name}}"}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "timeseries",
|
||||
"id": 13,
|
||||
"title": "Process memory",
|
||||
"description": "RSS процессов, байты.",
|
||||
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
||||
"gridPos": {"h": 8, "w": 8, "x": 16, "y": 29},
|
||||
"fieldConfig": {"defaults": {"unit": "bytes", "custom": {"drawStyle": "line", "fillOpacity": 10}}, "overrides": []},
|
||||
"options": {"legend": {"displayMode": "list", "placement": "bottom"}},
|
||||
"targets": [
|
||||
{"refId": "A", "datasource": {"type": "prometheus", "uid": "prometheus"}, "expr": "sum by (service_name) (process_memory_usage_bytes)", "legendFormat": "{{service_name}}"}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "timeseries",
|
||||
"id": 14,
|
||||
"title": "Prometheus alert state",
|
||||
"description": "1 — firing. Пропавший ряд — resolved/inactive. Имена HighApiErrorRate и QueueLagHigh.",
|
||||
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
||||
"gridPos": {"h": 8, "w": 24, "x": 0, "y": 37},
|
||||
"fieldConfig": {"defaults": {"unit": "short", "min": 0, "max": 1, "custom": {"drawStyle": "line", "fillOpacity": 10}}, "overrides": []},
|
||||
"options": {"legend": {"displayMode": "list", "placement": "bottom"}},
|
||||
"targets": [
|
||||
{"refId": "A", "datasource": {"type": "prometheus", "uid": "prometheus"}, "expr": "ALERTS{alertname=~\"HighApiErrorRate|QueueLagHigh\"}", "legendFormat": "{{alertname}} {{alertstate}}"}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
export GF_SECURITY_ADMIN_USER=admin
|
||||
export GF_SECURITY_ADMIN_PASSWORD="$(cat /run/secrets/grafana_admin_password)"
|
||||
export GF_AUTH_ANONYMOUS_ENABLED=false
|
||||
export GF_USERS_ALLOW_SIGN_UP=false
|
||||
export GF_ANALYTICS_REPORTING_ENABLED=false
|
||||
export GF_ANALYTICS_CHECK_FOR_UPDATES=false
|
||||
exec /run.sh
|
||||
@@ -0,0 +1,12 @@
|
||||
apiVersion: 1
|
||||
|
||||
contactPoints:
|
||||
- orgId: 1
|
||||
name: messenger-local
|
||||
receivers:
|
||||
- uid: messenger-local-none
|
||||
type: webhook
|
||||
settings:
|
||||
url: http://127.0.0.1:9/unused
|
||||
httpMethod: POST
|
||||
disableResolveMessage: false
|
||||
@@ -0,0 +1,8 @@
|
||||
apiVersion: 1
|
||||
|
||||
policies:
|
||||
- orgId: 1
|
||||
receiver: messenger-local
|
||||
group_by:
|
||||
- grafana_folder
|
||||
- alertname
|
||||
@@ -0,0 +1,120 @@
|
||||
apiVersion: 1
|
||||
|
||||
groups:
|
||||
- orgId: 1
|
||||
name: messenger-slo
|
||||
folder: Messenger
|
||||
interval: 30s
|
||||
rules:
|
||||
- uid: high-api-error-rate
|
||||
title: High API error rate
|
||||
condition: B
|
||||
data:
|
||||
- refId: A
|
||||
relativeTimeRange:
|
||||
from: 300
|
||||
to: 0
|
||||
datasourceUid: prometheus
|
||||
model:
|
||||
datasource:
|
||||
type: prometheus
|
||||
uid: prometheus
|
||||
editorMode: code
|
||||
expr: sum(rate(http_server_requests_total{service_name="messenger-api",sli="business",status_class="5xx"}[1m])) / clamp_min(sum(rate(http_server_requests_total{service_name="messenger-api",sli="business"}[1m])), 1e-9)
|
||||
instant: true
|
||||
intervalMs: 1000
|
||||
maxDataPoints: 43200
|
||||
refId: A
|
||||
- refId: B
|
||||
relativeTimeRange:
|
||||
from: 0
|
||||
to: 0
|
||||
datasourceUid: __expr__
|
||||
model:
|
||||
conditions:
|
||||
- evaluator:
|
||||
params:
|
||||
- 0.05
|
||||
type: gt
|
||||
operator:
|
||||
type: and
|
||||
query:
|
||||
params:
|
||||
- B
|
||||
reducer:
|
||||
params: []
|
||||
type: last
|
||||
type: query
|
||||
datasource:
|
||||
type: __expr__
|
||||
uid: __expr__
|
||||
expression: A
|
||||
intervalMs: 1000
|
||||
maxDataPoints: 43200
|
||||
refId: B
|
||||
type: threshold
|
||||
noDataState: OK
|
||||
execErrState: Error
|
||||
for: 1m
|
||||
annotations:
|
||||
summary: Доля бизнес 5xx выше 5% на окне 1 минута.
|
||||
description: SLI исключает /health. SLO — 99% успеха на окне 5 минут. Runbook — infra/grafana/runbooks/high-error-rate.md.
|
||||
labels:
|
||||
severity: warning
|
||||
isPaused: false
|
||||
- uid: queue-lag-high
|
||||
title: Queue lag high
|
||||
condition: B
|
||||
data:
|
||||
- refId: A
|
||||
relativeTimeRange:
|
||||
from: 300
|
||||
to: 0
|
||||
datasourceUid: prometheus
|
||||
model:
|
||||
datasource:
|
||||
type: prometheus
|
||||
uid: prometheus
|
||||
editorMode: code
|
||||
expr: max(queue_oldest_age_seconds{queue="attachment.jobs"})
|
||||
instant: true
|
||||
intervalMs: 1000
|
||||
maxDataPoints: 43200
|
||||
refId: A
|
||||
- refId: B
|
||||
relativeTimeRange:
|
||||
from: 0
|
||||
to: 0
|
||||
datasourceUid: __expr__
|
||||
model:
|
||||
conditions:
|
||||
- evaluator:
|
||||
params:
|
||||
- 30
|
||||
type: gt
|
||||
operator:
|
||||
type: and
|
||||
query:
|
||||
params:
|
||||
- B
|
||||
reducer:
|
||||
params: []
|
||||
type: last
|
||||
type: query
|
||||
datasource:
|
||||
type: __expr__
|
||||
uid: __expr__
|
||||
expression: A
|
||||
intervalMs: 1000
|
||||
maxDataPoints: 43200
|
||||
refId: B
|
||||
type: threshold
|
||||
noDataState: OK
|
||||
execErrState: Error
|
||||
for: 1m
|
||||
annotations:
|
||||
summary: Возраст старейшей задачи больше 30 секунд.
|
||||
description: Backlog, не latency обработки. SLO p95 time-to-ready — 60 секунд. Runbook — infra/grafana/runbooks/queue-lag.md.
|
||||
labels:
|
||||
severity: warning
|
||||
isPaused: false
|
||||
@@ -0,0 +1,11 @@
|
||||
apiVersion: 1
|
||||
|
||||
providers:
|
||||
- name: Messenger
|
||||
orgId: 1
|
||||
folder: Messenger
|
||||
type: file
|
||||
disableDeletion: false
|
||||
updateIntervalSeconds: 30
|
||||
options:
|
||||
path: /etc/grafana/dashboards
|
||||
@@ -0,0 +1,45 @@
|
||||
apiVersion: 1
|
||||
|
||||
datasources:
|
||||
- name: Prometheus
|
||||
uid: prometheus
|
||||
type: prometheus
|
||||
access: proxy
|
||||
url: http://prometheus:9090
|
||||
isDefault: true
|
||||
editable: false
|
||||
jsonData:
|
||||
timeInterval: 10s
|
||||
- name: Loki
|
||||
uid: loki
|
||||
type: loki
|
||||
access: proxy
|
||||
url: http://loki:3100
|
||||
editable: false
|
||||
jsonData:
|
||||
derivedFields:
|
||||
- name: trace_id
|
||||
matcherRegex: "\"trace_id\":\"([0-9a-f]+)\""
|
||||
url: "$${__value.raw}"
|
||||
datasourceUid: tempo
|
||||
urlDisplayLabel: Открыть трассу
|
||||
- name: Tempo
|
||||
uid: tempo
|
||||
type: tempo
|
||||
access: proxy
|
||||
url: http://tempo:3200
|
||||
editable: false
|
||||
jsonData:
|
||||
tracesToLogsV2:
|
||||
datasourceUid: loki
|
||||
filterByTraceID: false
|
||||
customQuery: true
|
||||
query: '{service_name=~"messenger-.+"} | trace_id="$${__trace.traceId}"'
|
||||
tracesToMetrics:
|
||||
datasourceUid: prometheus
|
||||
serviceMap:
|
||||
datasourceUid: prometheus
|
||||
nodeGraph:
|
||||
enabled: true
|
||||
lokiSearch:
|
||||
datasourceUid: loki
|
||||
@@ -0,0 +1,13 @@
|
||||
# High API error rate
|
||||
|
||||
SLI: доля ответов 5xx среди бизнес-запросов (`sli="business"`). Проверки `/health/*` в числитель и знаменатель не входят: отказ клиента с неверным паролем — это 401, а не отказ базы.
|
||||
|
||||
SLO: не меньше 99% успешных бизнес-запросов на скользящем окне 5 минут.
|
||||
|
||||
Алерт: та же доля на окне 1 минута выше 5% в течение 1 минуты. Окно короче SLO, чтобы короткий отказ успел зажечься и погаснуть на защите.
|
||||
|
||||
1. На дашборде Messenger сравнить панель доли ошибок и p95 длительности.
|
||||
2. Открыть трассу запроса со статусом 5xx. Если время в `db.finalize` или запрос оборвался таймаутом пула, это база. Если span handler длинный без дочернего db/s3, это код обработчика.
|
||||
3. Сверить `db.pool.connections` со `state=used` и `state=waiting`. Рост waiting при полном used — насыщение пула, а не медленный Python.
|
||||
4. Вернуть Postgres (`docker compose unpause postgres` или `start`).
|
||||
5. Убедиться, что алерт перешёл из firing в inactive. Доставка уведомлений наружу не используется.
|
||||
@@ -0,0 +1,12 @@
|
||||
# Queue lag
|
||||
|
||||
Backlog — число задач `attachment.jobs` в статусе queued или processing и возраст старейшей из них. Это не latency успешной обработки: её показывает гистограмма `attachment.time_to_ready`.
|
||||
|
||||
SLO: p95 времени от принятой загрузки до `ready` не выше 60 секунд.
|
||||
|
||||
Алерт: возраст старейшей задачи больше 30 секунд в течение 1 минуты.
|
||||
|
||||
1. Сравнить queue depth / oldest age с `worker.slots`. Если capacity пропала, контейнер worker остановлен.
|
||||
2. По trace id загрузки найти server span API, producer span relay (`publish attachment.jobs`) и consumer span worker. Разрыв после producer при живом API означает, что consumer не забирает сообщения.
|
||||
3. В логах Loki по тому же trace id проверить `outbox published` и отсутствие `job ready`.
|
||||
4. Запустить worker. Глубина и возраст должны уменьшиться, алерт стать inactive.
|
||||
@@ -0,0 +1,41 @@
|
||||
global
|
||||
log stdout format raw local0
|
||||
maxconn 256
|
||||
ssl-default-bind-options ssl-min-ver TLSv1.2 no-tls-tickets
|
||||
|
||||
defaults
|
||||
log global
|
||||
mode http
|
||||
option httplog
|
||||
option dontlognull
|
||||
option redispatch
|
||||
timeout connect 3s
|
||||
timeout client 120s
|
||||
timeout server 120s
|
||||
timeout http-request 30s
|
||||
retries 2
|
||||
|
||||
resolvers docker
|
||||
nameserver dns 127.0.0.11:53
|
||||
resolve_retries 3
|
||||
timeout resolve 1s
|
||||
timeout retry 1s
|
||||
hold valid 5s
|
||||
hold other 5s
|
||||
hold refused 5s
|
||||
hold nx 5s
|
||||
hold timeout 5s
|
||||
hold obsolete 5s
|
||||
|
||||
frontend public
|
||||
bind :8443 ssl crt /certs/lb-server.pem alpn http/1.1
|
||||
http-request set-header X-Forwarded-Proto https
|
||||
default_backend api
|
||||
|
||||
backend api
|
||||
balance roundrobin
|
||||
option httpchk
|
||||
http-check send meth GET uri /health/ready ver HTTP/1.1 hdr Host api
|
||||
http-check expect status 200
|
||||
default-server inter 2s fall 2 rise 2 resolvers docker init-addr last,libc,none resolve-prefer ipv4 ssl verify required ca-file /certs/ca.crt crt /certs/lb-client.pem verifyhost api alpn http/1.1
|
||||
server-template api 8 api:8443 check
|
||||
@@ -0,0 +1,37 @@
|
||||
auth_enabled: false
|
||||
|
||||
server:
|
||||
http_listen_port: 3100
|
||||
log_level: warn
|
||||
|
||||
common:
|
||||
path_prefix: /loki
|
||||
storage:
|
||||
filesystem:
|
||||
chunks_directory: /loki/chunks
|
||||
rules_directory: /loki/rules
|
||||
replication_factor: 1
|
||||
ring:
|
||||
instance_addr: 127.0.0.1
|
||||
kvstore:
|
||||
store: inmemory
|
||||
|
||||
schema_config:
|
||||
configs:
|
||||
- from: 2024-01-01
|
||||
store: tsdb
|
||||
object_store: filesystem
|
||||
schema: v13
|
||||
index:
|
||||
prefix: index_
|
||||
period: 24h
|
||||
|
||||
limits_config:
|
||||
allow_structured_metadata: true
|
||||
volume_enabled: true
|
||||
retention_period: 168h
|
||||
reject_old_samples: true
|
||||
reject_old_samples_max_age: 168h
|
||||
ingestion_rate_mb: 8
|
||||
ingestion_burst_size_mb: 16
|
||||
max_streams_per_user: 10000
|
||||
@@ -0,0 +1,38 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
ROOT_USER=$(cat /secrets/passwords/minio_root_user)
|
||||
ROOT_PASS=$(cat /secrets/passwords/minio_root_password)
|
||||
API_KEY=$(cat /secrets/passwords/s3_api_key)
|
||||
API_SECRET=$(cat /secrets/passwords/s3_api_secret)
|
||||
WORKER_KEY=$(cat /secrets/passwords/s3_worker_key)
|
||||
WORKER_SECRET=$(cat /secrets/passwords/s3_worker_secret)
|
||||
GC_KEY=$(cat /secrets/passwords/s3_gc_key)
|
||||
GC_SECRET=$(cat /secrets/passwords/s3_gc_secret)
|
||||
export SSL_CERT_FILE=/certs/ca.crt
|
||||
|
||||
i=0
|
||||
while [ "$i" -lt 40 ]; do
|
||||
if mc alias set local https://minio:9000 "$ROOT_USER" "$ROOT_PASS" >/dev/null 2>&1; then
|
||||
break
|
||||
fi
|
||||
i=$((i + 1))
|
||||
sleep 1
|
||||
done
|
||||
mc alias set local https://minio:9000 "$ROOT_USER" "$ROOT_PASS"
|
||||
mc mb --ignore-existing local/messenger-attachments
|
||||
mc anonymous set none local/messenger-attachments
|
||||
|
||||
add_user() {
|
||||
key=$1
|
||||
secret=$2
|
||||
policy=$3
|
||||
file=$4
|
||||
mc admin user add local "$key" "$secret" >/dev/null 2>&1 || mc admin user add local "$key" "$secret"
|
||||
mc admin policy create local "$policy" "$file" >/dev/null 2>&1 || true
|
||||
mc admin policy attach local "$policy" --user "$key" >/dev/null 2>&1 || mc admin policy set local "$policy" user="$key"
|
||||
}
|
||||
|
||||
add_user "$API_KEY" "$API_SECRET" api-objects /policies/api-policy.json
|
||||
add_user "$WORKER_KEY" "$WORKER_SECRET" worker-objects /policies/worker-policy.json
|
||||
add_user "$GC_KEY" "$GC_SECRET" gc-objects /policies/gc-policy.json
|
||||
echo "minio bootstrap complete"
|
||||
@@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
export MINIO_ROOT_USER="$(cat /run/secrets/minio_root_user)"
|
||||
export MINIO_ROOT_PASSWORD="$(cat /run/secrets/minio_root_password)"
|
||||
exec /usr/bin/docker-entrypoint.sh server /data --address :9000 --console-address :9001
|
||||
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"Version": "2012-10-17",
|
||||
"Statement": [
|
||||
{
|
||||
"Sid": "ApiObjectAccess",
|
||||
"Effect": "Allow",
|
||||
"Action": [
|
||||
"s3:GetObject",
|
||||
"s3:PutObject",
|
||||
"s3:DeleteObject",
|
||||
"s3:AbortMultipartUpload",
|
||||
"s3:ListBucket",
|
||||
"s3:GetBucketLocation"
|
||||
],
|
||||
"Resource": [
|
||||
"arn:aws:s3:::messenger-attachments",
|
||||
"arn:aws:s3:::messenger-attachments/*"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"Version": "2012-10-17",
|
||||
"Statement": [
|
||||
{
|
||||
"Effect": "Allow",
|
||||
"Action": ["s3:GetBucketLocation", "s3:ListBucket", "s3:HeadBucket"],
|
||||
"Resource": ["arn:aws:s3:::messenger-attachments"]
|
||||
},
|
||||
{
|
||||
"Effect": "Allow",
|
||||
"Action": ["s3:GetObject", "s3:PutObject", "s3:DeleteObject"],
|
||||
"Resource": ["arn:aws:s3:::messenger-attachments/staging/*"]
|
||||
},
|
||||
{
|
||||
"Effect": "Allow",
|
||||
"Action": ["s3:GetObject"],
|
||||
"Resource": ["arn:aws:s3:::messenger-attachments/att/*"]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"Version": "2012-10-17",
|
||||
"Statement": [
|
||||
{
|
||||
"Effect": "Allow",
|
||||
"Action": ["s3:GetBucketLocation", "s3:ListBucket", "s3:HeadBucket"],
|
||||
"Resource": ["arn:aws:s3:::messenger-attachments"]
|
||||
},
|
||||
{
|
||||
"Effect": "Allow",
|
||||
"Action": ["s3:GetObject", "s3:DeleteObject"],
|
||||
"Resource": [
|
||||
"arn:aws:s3:::messenger-attachments/staging/*",
|
||||
"arn:aws:s3:::messenger-attachments/att/*"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"Version": "2012-10-17",
|
||||
"Statement": [
|
||||
{
|
||||
"Effect": "Allow",
|
||||
"Action": ["s3:GetBucketLocation", "s3:ListBucket", "s3:HeadBucket"],
|
||||
"Resource": ["arn:aws:s3:::messenger-attachments"]
|
||||
},
|
||||
{
|
||||
"Effect": "Allow",
|
||||
"Action": ["s3:GetObject", "s3:DeleteObject"],
|
||||
"Resource": ["arn:aws:s3:::messenger-attachments/staging/*"]
|
||||
},
|
||||
{
|
||||
"Effect": "Allow",
|
||||
"Action": ["s3:GetObject", "s3:PutObject", "s3:DeleteObject"],
|
||||
"Resource": ["arn:aws:s3:::messenger-attachments/att/*"]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
server {
|
||||
listen 9000 ssl;
|
||||
server_name minio;
|
||||
server_tokens off;
|
||||
ssl_certificate /certs/minio.crt;
|
||||
ssl_certificate_key /certs/minio.key;
|
||||
ssl_protocols TLSv1.2 TLSv1.3;
|
||||
client_max_body_size 20m;
|
||||
access_log off;
|
||||
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1:9000;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header Connection "";
|
||||
proxy_buffering off;
|
||||
proxy_request_buffering off;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
resolver 127.0.0.11 valid=10s ipv6=off;
|
||||
|
||||
map $ssl_client_s_dn $telemetry_client_ok {
|
||||
default 0;
|
||||
"~CN=otel-collector(,|$)" 1;
|
||||
"~CN=grafana(,|$)" 1;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 4318 ssl;
|
||||
server_name tempo.lab.internal;
|
||||
server_tokens off;
|
||||
ssl_certificate /certs/telemetry.crt;
|
||||
ssl_certificate_key /certs/telemetry.key;
|
||||
ssl_client_certificate /certs/ca.crt;
|
||||
ssl_verify_client on;
|
||||
ssl_protocols TLSv1.2 TLSv1.3;
|
||||
client_max_body_size 20m;
|
||||
access_log off;
|
||||
if ($telemetry_client_ok = 0) { return 403; }
|
||||
location / {
|
||||
set $upstream tempo:4318;
|
||||
proxy_pass http://$upstream;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header Content-Type $content_type;
|
||||
proxy_set_header Connection "";
|
||||
}
|
||||
}
|
||||
|
||||
server {
|
||||
listen 3200 ssl;
|
||||
server_name tempo.lab.internal;
|
||||
server_tokens off;
|
||||
ssl_certificate /certs/telemetry.crt;
|
||||
ssl_certificate_key /certs/telemetry.key;
|
||||
ssl_client_certificate /certs/ca.crt;
|
||||
ssl_verify_client on;
|
||||
ssl_protocols TLSv1.2 TLSv1.3;
|
||||
client_max_body_size 20m;
|
||||
access_log off;
|
||||
if ($telemetry_client_ok = 0) { return 403; }
|
||||
location / {
|
||||
set $upstream tempo:3200;
|
||||
proxy_pass http://$upstream;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header Connection "";
|
||||
}
|
||||
}
|
||||
|
||||
server {
|
||||
listen 3100 ssl;
|
||||
server_name loki.lab.internal;
|
||||
server_tokens off;
|
||||
ssl_certificate /certs/telemetry.crt;
|
||||
ssl_certificate_key /certs/telemetry.key;
|
||||
ssl_client_certificate /certs/ca.crt;
|
||||
ssl_verify_client on;
|
||||
ssl_protocols TLSv1.2 TLSv1.3;
|
||||
client_max_body_size 20m;
|
||||
access_log off;
|
||||
if ($telemetry_client_ok = 0) { return 403; }
|
||||
location / {
|
||||
set $upstream loki:3100;
|
||||
proxy_pass http://$upstream;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header Content-Type $content_type;
|
||||
proxy_set_header Connection "";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
ui = false
|
||||
disable_mlock = true
|
||||
|
||||
storage "file" {
|
||||
path = "/openbao/data"
|
||||
}
|
||||
|
||||
listener "tcp" {
|
||||
address = "0.0.0.0:8200"
|
||||
cluster_address = "0.0.0.0:8201"
|
||||
tls_cert_file = "/tmp/tls/server.crt"
|
||||
tls_key_file = "/tmp/tls/server.key"
|
||||
tls_min_version = "tls12"
|
||||
}
|
||||
|
||||
api_addr = "https://openbao:8200"
|
||||
cluster_addr = "https://openbao:8201"
|
||||
@@ -0,0 +1,17 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
mkdir -p /tmp/tls /openbao/data
|
||||
cp /certs/openbao.crt /tmp/tls/server.crt
|
||||
cp /certs/openbao.key /tmp/tls/server.key
|
||||
chmod 644 /tmp/tls/server.crt
|
||||
chmod 600 /tmp/tls/server.key
|
||||
if id openbao >/dev/null 2>&1; then
|
||||
chown -R openbao:openbao /tmp/tls /openbao/data
|
||||
if command -v su-exec >/dev/null 2>&1; then
|
||||
exec su-exec openbao bao server -config=/openbao/config/config.hcl
|
||||
fi
|
||||
if command -v gosu >/dev/null 2>&1; then
|
||||
exec gosu openbao bao server -config=/openbao/config/config.hcl
|
||||
fi
|
||||
fi
|
||||
exec bao server -config=/openbao/config/config.hcl
|
||||
@@ -0,0 +1,3 @@
|
||||
path "secret/data/messenger/api" {
|
||||
capabilities = ["read"]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
path "secret/data/messenger/gc" {
|
||||
capabilities = ["read"]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
path "secret/data/messenger/migrate" {
|
||||
capabilities = ["read"]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
path "secret/data/messenger/relay" {
|
||||
capabilities = ["read"]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
path "secret/data/messenger/worker" {
|
||||
capabilities = ["read"]
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
receivers:
|
||||
otlp:
|
||||
protocols:
|
||||
grpc:
|
||||
endpoint: 127.0.0.1:4317
|
||||
http:
|
||||
endpoint: 0.0.0.0:4318
|
||||
tls:
|
||||
cert_file: /certs/otel.crt
|
||||
key_file: /certs/otel.key
|
||||
auth:
|
||||
authenticator: bearertokenauth
|
||||
|
||||
processors:
|
||||
memory_limiter:
|
||||
check_interval: 1s
|
||||
limit_mib: 256
|
||||
spike_limit_mib: 64
|
||||
batch:
|
||||
timeout: 5s
|
||||
send_batch_size: 512
|
||||
send_batch_max_size: 1024
|
||||
|
||||
exporters:
|
||||
otlphttp/tempo:
|
||||
endpoint: https://tempo.lab.internal:4318
|
||||
timeout: 5s
|
||||
tls:
|
||||
ca_file: /certs/ca.crt
|
||||
cert_file: /certs/otel.crt
|
||||
key_file: /certs/otel.key
|
||||
retry_on_failure:
|
||||
enabled: true
|
||||
initial_interval: 1s
|
||||
max_interval: 10s
|
||||
max_elapsed_time: 30s
|
||||
sending_queue:
|
||||
enabled: true
|
||||
num_consumers: 2
|
||||
queue_size: 200
|
||||
otlphttp/loki:
|
||||
endpoint: https://loki.lab.internal:3100/otlp
|
||||
timeout: 5s
|
||||
tls:
|
||||
ca_file: /certs/ca.crt
|
||||
cert_file: /certs/otel.crt
|
||||
key_file: /certs/otel.key
|
||||
retry_on_failure:
|
||||
enabled: true
|
||||
initial_interval: 1s
|
||||
max_interval: 10s
|
||||
max_elapsed_time: 30s
|
||||
sending_queue:
|
||||
enabled: true
|
||||
num_consumers: 2
|
||||
queue_size: 200
|
||||
prometheus:
|
||||
endpoint: 0.0.0.0:8889
|
||||
tls:
|
||||
cert_file: /certs/otel.crt
|
||||
key_file: /certs/otel.key
|
||||
resource_to_telemetry_conversion:
|
||||
enabled: true
|
||||
metric_expiration: 5m
|
||||
|
||||
extensions:
|
||||
health_check:
|
||||
endpoint: 127.0.0.1:13133
|
||||
bearertokenauth:
|
||||
scheme: Bearer
|
||||
token: ${env:OTEL_INGEST_TOKEN}
|
||||
|
||||
service:
|
||||
extensions: [health_check, bearertokenauth]
|
||||
telemetry:
|
||||
logs:
|
||||
level: info
|
||||
metrics:
|
||||
readers:
|
||||
- pull:
|
||||
exporter:
|
||||
prometheus:
|
||||
host: 127.0.0.1
|
||||
port: 8888
|
||||
pipelines:
|
||||
traces:
|
||||
receivers: [otlp]
|
||||
processors: [memory_limiter, batch]
|
||||
exporters: [otlphttp/tempo]
|
||||
metrics:
|
||||
receivers: [otlp]
|
||||
processors: [memory_limiter, batch]
|
||||
exporters: [prometheus]
|
||||
logs:
|
||||
receivers: [otlp]
|
||||
processors: [memory_limiter, batch]
|
||||
exporters: [otlphttp/loki]
|
||||
@@ -0,0 +1,13 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
mkdir -p /var/lib/postgresql/tls
|
||||
cp /certs/postgres.crt /var/lib/postgresql/tls/server.crt
|
||||
cp /certs/postgres.key /var/lib/postgresql/tls/server.key
|
||||
chown postgres:postgres /var/lib/postgresql/tls/server.crt /var/lib/postgresql/tls/server.key
|
||||
chmod 644 /var/lib/postgresql/tls/server.crt
|
||||
chmod 600 /var/lib/postgresql/tls/server.key
|
||||
exec docker-entrypoint.sh postgres \
|
||||
-c ssl=on \
|
||||
-c ssl_cert_file=/var/lib/postgresql/tls/server.crt \
|
||||
-c ssl_key_file=/var/lib/postgresql/tls/server.key \
|
||||
-c hba_file=/etc/pg/pg_hba.conf
|
||||
@@ -0,0 +1,14 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" \
|
||||
-v api_pass="$(cat /run/secrets/db_api_password)" \
|
||||
-v worker_pass="$(cat /run/secrets/db_worker_password)" \
|
||||
-v relay_pass="$(cat /run/secrets/db_relay_password)" \
|
||||
-v gc_pass="$(cat /run/secrets/db_gc_password)" <<'SQL'
|
||||
SELECT format('CREATE ROLE api_user LOGIN PASSWORD %L NOSUPERUSER NOCREATEDB NOCREATEROLE', :'api_pass') \gexec
|
||||
SELECT format('CREATE ROLE worker_user LOGIN PASSWORD %L NOSUPERUSER NOCREATEDB NOCREATEROLE', :'worker_pass') \gexec
|
||||
SELECT format('CREATE ROLE relay_user LOGIN PASSWORD %L NOSUPERUSER NOCREATEDB NOCREATEROLE', :'relay_pass') \gexec
|
||||
SELECT format('CREATE ROLE gc_user LOGIN PASSWORD %L NOSUPERUSER NOCREATEDB NOCREATEROLE', :'gc_pass') \gexec
|
||||
GRANT CONNECT ON DATABASE messenger TO api_user, worker_user, relay_user, gc_user;
|
||||
SQL
|
||||
touch /var/lib/postgresql/data/.roles-ready
|
||||
@@ -0,0 +1,3 @@
|
||||
local all all trust
|
||||
hostssl all all all scram-sha-256
|
||||
hostnossl all all all reject
|
||||
@@ -0,0 +1,29 @@
|
||||
groups:
|
||||
- name: messenger-slo
|
||||
interval: 15s
|
||||
rules:
|
||||
- alert: HighApiErrorRate
|
||||
expr: |
|
||||
(
|
||||
sum(rate(http_server_requests_total{service_name="messenger-api",sli="business",status_class="5xx"}[1m]))
|
||||
/
|
||||
clamp_min(sum(rate(http_server_requests_total{service_name="messenger-api",sli="business"}[1m])), 1e-9)
|
||||
) > 0.05
|
||||
for: 1m
|
||||
labels:
|
||||
severity: warning
|
||||
slo: api-availability
|
||||
annotations:
|
||||
summary: Доля бизнес-запросов с ответом 5xx выше 5% за 1 минуту.
|
||||
description: SLI — 5xx среди запросов sli=business, без /health. SLO — не меньше 99% успешных бизнес-запросов на окне 5 минут. Этот алерт короче SLO, чтобы короткий отказ был виден и снялся после восстановления.
|
||||
runbook: Открыть дашборд Messenger. Сравнить долю 5xx и p95. В трассе ошибочного запроса посмотреть, сидит ли время в db.finalize или это сам handler. Сверить db.pool.connections state=used и state=waiting. Вернуть Postgres. Дождаться, пока ряд алерта исчезнет.
|
||||
- alert: QueueLagHigh
|
||||
expr: max(queue_oldest_age_seconds{queue="attachment.jobs"}) > 30
|
||||
for: 1m
|
||||
labels:
|
||||
severity: warning
|
||||
slo: time-to-ready
|
||||
annotations:
|
||||
summary: Возраст старейшей задачи attachment.jobs больше 30 секунд.
|
||||
description: Backlog — это число и возраст задач в статусе queued или processing, а не длительность успешной обработки. SLO времени до ready — p95 гистограммы attachment_time_to_ready_seconds не выше 60 секунд.
|
||||
runbook: На дашборде сравнить queue depth и oldest age с worker.slots. Если busy=0 и capacity пропала, worker остановлен. Проверить трассу upload и лог relay на publish. Запустить worker. Возраст должен упасть, алерт перейти в inactive.
|
||||
@@ -0,0 +1,15 @@
|
||||
global:
|
||||
scrape_interval: 10s
|
||||
evaluation_interval: 15s
|
||||
|
||||
rule_files:
|
||||
- /etc/prometheus/alerts.yml
|
||||
|
||||
scrape_configs:
|
||||
- job_name: otel-collector
|
||||
scheme: https
|
||||
tls_config:
|
||||
ca_file: /certs/ca.crt
|
||||
server_name: otel-collector
|
||||
static_configs:
|
||||
- targets: ["otel-collector:8889"]
|
||||
@@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
mkdir -p /var/lib/rabbitmq/tls
|
||||
cp /certs/ca.crt /var/lib/rabbitmq/tls/ca.crt
|
||||
cp /certs/rabbitmq.crt /var/lib/rabbitmq/tls/server.crt
|
||||
cp /certs/rabbitmq.key /var/lib/rabbitmq/tls/server.key
|
||||
chown -R rabbitmq:rabbitmq /var/lib/rabbitmq/tls
|
||||
chmod 644 /var/lib/rabbitmq/tls/ca.crt /var/lib/rabbitmq/tls/server.crt
|
||||
chmod 600 /var/lib/rabbitmq/tls/server.key
|
||||
export RABBITMQ_DEFAULT_USER="$(cat /run/secrets/rabbitmq_user)"
|
||||
export RABBITMQ_DEFAULT_PASS="$(cat /run/secrets/rabbitmq_password)"
|
||||
exec docker-entrypoint.sh rabbitmq-server
|
||||
@@ -0,0 +1,12 @@
|
||||
listeners.tcp = none
|
||||
listeners.ssl.default = 5671
|
||||
ssl_options.cacertfile = /var/lib/rabbitmq/tls/ca.crt
|
||||
ssl_options.certfile = /var/lib/rabbitmq/tls/server.crt
|
||||
ssl_options.keyfile = /var/lib/rabbitmq/tls/server.key
|
||||
ssl_options.verify = verify_none
|
||||
ssl_options.fail_if_no_peer_cert = false
|
||||
ssl_options.versions.1 = tlsv1.2
|
||||
ssl_options.versions.2 = tlsv1.3
|
||||
management.tcp.ip = 127.0.0.1
|
||||
management.tcp.port = 15672
|
||||
load_definitions = /run/secrets/definitions.json
|
||||
@@ -0,0 +1,19 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
mkdir -p /tmp/tls /data
|
||||
cp /certs/redis.crt /tmp/tls/server.crt
|
||||
cp /certs/redis.key /tmp/tls/server.key
|
||||
chown redis:redis /tmp/tls/server.crt /tmp/tls/server.key /data
|
||||
chmod 644 /tmp/tls/server.crt
|
||||
chmod 600 /tmp/tls/server.key
|
||||
exec gosu redis redis-server \
|
||||
--tls-port 6379 \
|
||||
--port 0 \
|
||||
--tls-cert-file /tmp/tls/server.crt \
|
||||
--tls-key-file /tmp/tls/server.key \
|
||||
--tls-ca-cert-file /certs/ca.crt \
|
||||
--requirepass "$(cat /run/secrets/redis_password)" \
|
||||
--appendonly yes \
|
||||
--appendfsync always \
|
||||
--dir /data \
|
||||
--protected-mode yes
|
||||
@@ -0,0 +1,28 @@
|
||||
server:
|
||||
http_listen_port: 3200
|
||||
log_level: warn
|
||||
|
||||
distributor:
|
||||
receivers:
|
||||
otlp:
|
||||
protocols:
|
||||
grpc:
|
||||
endpoint: 0.0.0.0:4317
|
||||
http:
|
||||
endpoint: 0.0.0.0:4318
|
||||
|
||||
ingester:
|
||||
trace_idle_period: 10s
|
||||
max_block_duration: 5m
|
||||
|
||||
compactor:
|
||||
compaction:
|
||||
block_retention: 168h
|
||||
|
||||
storage:
|
||||
trace:
|
||||
backend: local
|
||||
wal:
|
||||
path: /var/tempo/wal
|
||||
local:
|
||||
path: /var/tempo/blocks
|
||||
Reference in New Issue
Block a user