[+] lab7
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
# Official public images/binaries were removed upstream; build fixed release sources.
|
||||
FROM golang:1.24.2-bookworm AS minio-build
|
||||
ENV CGO_ENABLED=0 GOMAXPROCS=2 GOTOOLCHAIN=local
|
||||
RUN git clone --depth 1 --branch RELEASE.2025-04-22T22-12-26Z https://github.com/minio/minio.git /src
|
||||
WORKDIR /src
|
||||
RUN go build -p 2 -trimpath -ldflags='-s -w' -o /out/minio .
|
||||
RUN test "$(git rev-parse HEAD)" = 0d7408fc9969caf07de6a8c3a84f9fbb10a6739e && go build -p 2 -trimpath -ldflags='-s -w -X github.com/minio/minio/cmd.Version=2025-04-22T22:12:26Z -X github.com/minio/minio/cmd.ReleaseTag=RELEASE.2025-04-22T22-12-26Z -X github.com/minio/minio/cmd.CommitID=0d7408fc9969caf07de6a8c3a84f9fbb10a6739e' -o /out/minio .
|
||||
|
||||
FROM golang:1.24.2-bookworm AS mc-build
|
||||
ENV CGO_ENABLED=0 GOMAXPROCS=2 GOTOOLCHAIN=local
|
||||
RUN git clone --depth 1 --branch RELEASE.2025-04-16T18-13-26Z https://github.com/minio/mc.git /src
|
||||
WORKDIR /src
|
||||
RUN go build -p 2 -trimpath -ldflags='-s -w' -o /out/mc .
|
||||
RUN test "$(git rev-parse HEAD)" = b00526b153a31b36767991a4f5ce2cced435ee8e && go build -p 2 -trimpath -ldflags='-s -w -X github.com/minio/mc/cmd.Version=2025-04-16T18:13:26Z -X github.com/minio/mc/cmd.ReleaseTag=RELEASE.2025-04-16T18-13-26Z -X github.com/minio/mc/cmd.CommitID=b00526b153a31b36767991a4f5ce2cced435ee8e' -o /out/mc .
|
||||
|
||||
FROM python:3.13.5-slim AS minio
|
||||
LABEL org.opencontainers.image.source="https://github.com/minio/minio" org.opencontainers.image.version="RELEASE.2025-04-22T22-12-26Z"
|
||||
RUN useradd --uid 10002 --create-home minio && mkdir /data && chown 10002:10002 /data
|
||||
COPY --from=minio-build /out/minio /usr/local/bin/minio
|
||||
COPY infra/minio/server.sh /server.sh
|
||||
USER 10002
|
||||
ENTRYPOINT ["/bin/sh", "/server.sh"]
|
||||
CMD ["server", "/data", "--address", ":9000", "--console-address", "127.0.0.1:9001"]
|
||||
|
||||
FROM debian:bookworm-slim AS mc
|
||||
LABEL org.opencontainers.image.source="https://github.com/minio/mc" org.opencontainers.image.version="RELEASE.2025-04-16T18-13-26Z"
|
||||
COPY --from=mc-build /out/mc /usr/local/bin/mc
|
||||
ENTRYPOINT ["/bin/sh", "/config/bootstrap.sh"]
|
||||
@@ -0,0 +1,45 @@
|
||||
{
|
||||
"Version": "2012-10-17",
|
||||
"Statement": [
|
||||
{
|
||||
"Effect": "Allow",
|
||||
"Action": [
|
||||
"s3:GetBucketLocation"
|
||||
],
|
||||
"Resource": [
|
||||
"arn:aws:s3:::messenger-attachments"
|
||||
]
|
||||
},
|
||||
{
|
||||
"Effect": "Allow",
|
||||
"Action": [
|
||||
"s3:ListBucket"
|
||||
],
|
||||
"Resource": [
|
||||
"arn:aws:s3:::messenger-attachments"
|
||||
],
|
||||
"Condition": {
|
||||
"StringLike": {
|
||||
"s3:prefix": [
|
||||
"originals/*",
|
||||
"staging/*",
|
||||
"variants/*"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"Effect": "Allow",
|
||||
"Action": [
|
||||
"s3:GetObject",
|
||||
"s3:PutObject",
|
||||
"s3:DeleteObject"
|
||||
],
|
||||
"Resource": [
|
||||
"arn:aws:s3:::messenger-attachments/originals/*",
|
||||
"arn:aws:s3:::messenger-attachments/staging/*",
|
||||
"arn:aws:s3:::messenger-attachments/variants/*"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
export MC_CONFIG_DIR=/tmp/mc
|
||||
export SSL_CERT_FILE=/trust/ca.crt
|
||||
root_user=$(cat /run/secrets/minio_root_user)
|
||||
root_password=$(cat /run/secrets/minio_root_password)
|
||||
mc alias set local https://minio:9000 "$root_user" "$root_password" >/dev/null
|
||||
mc mb --ignore-existing local/messenger-attachments >/dev/null
|
||||
mc anonymous set none local/messenger-attachments >/dev/null
|
||||
for role in api worker relay test; do
|
||||
access=$(cat "/run/secrets/s3_${role}_id")
|
||||
password=$(cat "/run/secrets/s3_${role}_secret")
|
||||
mc admin user add local "$access" "$password" >/dev/null
|
||||
mc admin policy create local "lab7-$role" "/policies/$role.json" >/dev/null
|
||||
mc admin policy attach local "lab7-$role" --user "$access" >/dev/null
|
||||
done
|
||||
printf '%s\n' 'Private S3 bootstrap and scoped identities ready.'
|
||||
@@ -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 minio "$@"
|
||||
@@ -0,0 +1,73 @@
|
||||
worker_processes 1;
|
||||
error_log /dev/stderr warn;
|
||||
pid /var/run/nginx.pid;
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
http {
|
||||
access_log off;
|
||||
server_tokens off;
|
||||
limit_conn_zone $server_name zone=uploads:64k;
|
||||
|
||||
# Docker DNS; resolve updates the upstream when replicas get new IPs.
|
||||
resolver 127.0.0.11 valid=1s ipv6=off;
|
||||
resolver_timeout 1s;
|
||||
|
||||
upstream messenger {
|
||||
zone messenger 64k;
|
||||
# All A records of api participate in the default round-robin balancing.
|
||||
server api:9443 resolve max_fails=1 fail_timeout=2s;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 8443 ssl;
|
||||
ssl_certificate /pki/tls.crt;
|
||||
ssl_certificate_key /pki/tls.key;
|
||||
ssl_protocols TLSv1.2 TLSv1.3;
|
||||
ssl_session_tickets off;
|
||||
client_max_body_size 32k;
|
||||
proxy_ssl_trusted_certificate /trust/ca.crt;
|
||||
proxy_ssl_verify on;
|
||||
proxy_ssl_server_name on;
|
||||
proxy_ssl_name api;
|
||||
proxy_ssl_certificate /pki/tls.crt;
|
||||
proxy_ssl_certificate_key /pki/tls.key;
|
||||
server_name messenger;
|
||||
|
||||
location ~ ^/api/v1/chats/[^/]+/attachments$ {
|
||||
limit_conn uploads 16;
|
||||
client_max_body_size 11m;
|
||||
client_body_buffer_size 64k;
|
||||
client_body_timeout 10s;
|
||||
proxy_request_buffering on;
|
||||
proxy_pass https://messenger;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header Connection "";
|
||||
proxy_connect_timeout 1s;
|
||||
proxy_read_timeout 30s;
|
||||
proxy_send_timeout 30s;
|
||||
proxy_next_upstream error timeout http_503;
|
||||
proxy_next_upstream_tries 2;
|
||||
}
|
||||
|
||||
location / {
|
||||
proxy_pass https://messenger;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header Connection "";
|
||||
|
||||
proxy_connect_timeout 1s;
|
||||
proxy_read_timeout 5s;
|
||||
proxy_send_timeout 5s;
|
||||
|
||||
# Passive checks. Do NOT enable non_idempotent: an already-sent POST
|
||||
# must not be resent by Nginx after an ambiguous response.
|
||||
proxy_next_upstream error timeout http_503;
|
||||
proxy_next_upstream_tries 2;
|
||||
proxy_next_upstream_timeout 6s;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
groups:
|
||||
- name: messenger
|
||||
rules:
|
||||
- alert: HighApiErrorRate
|
||||
expr: sum(rate(http_requests_total{status_class="5xx"}[1m])) / clamp_min(sum(rate(http_requests_total[1m])),0.001) > 0.05
|
||||
for: 15s
|
||||
labels: {severity: warning}
|
||||
annotations:
|
||||
summary: Business API 5xx exceeds 5% in 1 minute
|
||||
runbook: Check postgres.query error spans, DB pool and request logs. Restore DB and confirm resolved.
|
||||
- alert: QueueLagGrowing
|
||||
expr: max(queue_oldest_age_seconds) > 15
|
||||
for: 15s
|
||||
labels: {severity: warning}
|
||||
annotations:
|
||||
summary: Oldest unfinished attachment is older than 15 seconds
|
||||
runbook: Check worker capacity/busy, job outcomes and consumer spans. Restore worker and confirm queue drains.
|
||||
@@ -0,0 +1,88 @@
|
||||
receivers:
|
||||
otlp:
|
||||
protocols:
|
||||
http:
|
||||
endpoint: 127.0.0.1:4318
|
||||
processors:
|
||||
memory_limiter:
|
||||
check_interval: 1s
|
||||
limit_mib: 192
|
||||
spike_limit_mib: 48
|
||||
batch:
|
||||
timeout: 1s
|
||||
send_batch_size: 128
|
||||
send_batch_max_size: 256
|
||||
exporters:
|
||||
prometheus:
|
||||
endpoint: 127.0.0.1:9464
|
||||
resource_to_telemetry_conversion:
|
||||
enabled: true
|
||||
metric_expiration: 10s
|
||||
otlp/tempo:
|
||||
endpoint: tempo:4319
|
||||
tls:
|
||||
ca_file: /trust/ca.crt
|
||||
cert_file: /pki/tls.crt
|
||||
key_file: /pki/tls.key
|
||||
insecure: false
|
||||
timeout: 2s
|
||||
sending_queue:
|
||||
enabled: true
|
||||
queue_size: 256
|
||||
num_consumers: 2
|
||||
retry_on_failure:
|
||||
enabled: true
|
||||
initial_interval: 1s
|
||||
max_interval: 5s
|
||||
max_elapsed_time: 20s
|
||||
otlphttp/loki:
|
||||
endpoint: https://loki:9443/otlp
|
||||
timeout: 2s
|
||||
sending_queue:
|
||||
enabled: true
|
||||
queue_size: 256
|
||||
num_consumers: 2
|
||||
retry_on_failure:
|
||||
enabled: true
|
||||
initial_interval: 1s
|
||||
max_interval: 5s
|
||||
max_elapsed_time: 20s
|
||||
tls:
|
||||
ca_file: /trust/ca.crt
|
||||
cert_file: /pki/tls.crt
|
||||
key_file: /pki/tls.key
|
||||
insecure: false
|
||||
service:
|
||||
telemetry:
|
||||
metrics:
|
||||
readers:
|
||||
- pull:
|
||||
exporter:
|
||||
prometheus:
|
||||
host: 127.0.0.1
|
||||
port: 8888
|
||||
pipelines:
|
||||
metrics:
|
||||
receivers:
|
||||
- otlp
|
||||
processors:
|
||||
- memory_limiter
|
||||
- batch
|
||||
exporters:
|
||||
- prometheus
|
||||
logs:
|
||||
receivers:
|
||||
- otlp
|
||||
processors:
|
||||
- memory_limiter
|
||||
- batch
|
||||
exporters:
|
||||
- otlphttp/loki
|
||||
traces:
|
||||
receivers:
|
||||
- otlp
|
||||
processors:
|
||||
- memory_limiter
|
||||
- batch
|
||||
exporters:
|
||||
- otlp/tempo
|
||||
@@ -0,0 +1,436 @@
|
||||
{
|
||||
"uid": "messenger-lab6",
|
||||
"title": "Messenger \u2014 API and pipeline",
|
||||
"schemaVersion": 41,
|
||||
"version": 1,
|
||||
"refresh": "5s",
|
||||
"time": {
|
||||
"from": "now-15m",
|
||||
"to": "now"
|
||||
},
|
||||
"tags": [
|
||||
"lab6"
|
||||
],
|
||||
"panels": [
|
||||
{
|
||||
"id": 1,
|
||||
"type": "timeseries",
|
||||
"title": "Business RPS",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"expr": "sum(rate(http_requests_total[1m]))",
|
||||
"refId": "A",
|
||||
"legendFormat": "{{service_name}} {{outcome}}"
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "reqps"
|
||||
},
|
||||
"overrides": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"type": "timeseries",
|
||||
"title": "5xx ratio",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 12,
|
||||
"y": 0,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"expr": "sum(rate(http_requests_total{status_class=\"5xx\"}[1m])) / clamp_min(sum(rate(http_requests_total[1m])),0.001)",
|
||||
"refId": "A",
|
||||
"legendFormat": "{{service_name}} {{outcome}}"
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "percentunit"
|
||||
},
|
||||
"overrides": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"type": "timeseries",
|
||||
"title": "HTTP p50",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 0,
|
||||
"y": 8,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"expr": "histogram_quantile(0.5,sum by(le)(rate(http_server_duration_seconds_bucket[1m])))",
|
||||
"refId": "A",
|
||||
"legendFormat": "{{service_name}} {{outcome}}"
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "s"
|
||||
},
|
||||
"overrides": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 4,
|
||||
"type": "timeseries",
|
||||
"title": "HTTP p95",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 12,
|
||||
"y": 8,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"expr": "histogram_quantile(0.95,sum by(le)(rate(http_server_duration_seconds_bucket[1m])))",
|
||||
"refId": "A",
|
||||
"legendFormat": "{{service_name}} {{outcome}}"
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "s"
|
||||
},
|
||||
"overrides": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 5,
|
||||
"type": "timeseries",
|
||||
"title": "HTTP p99",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 0,
|
||||
"y": 16,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"expr": "histogram_quantile(0.99,sum by(le)(rate(http_server_duration_seconds_bucket[1m])))",
|
||||
"refId": "A",
|
||||
"legendFormat": "{{service_name}} {{outcome}}"
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "s"
|
||||
},
|
||||
"overrides": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 6,
|
||||
"type": "timeseries",
|
||||
"title": "Jobs by outcome",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 12,
|
||||
"y": 16,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"expr": "sum by(outcome)(rate(jobs_processed_total[1m]))",
|
||||
"refId": "A",
|
||||
"legendFormat": "{{service_name}} {{outcome}}"
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "ops"
|
||||
},
|
||||
"overrides": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 7,
|
||||
"type": "timeseries",
|
||||
"title": "Job p95",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 0,
|
||||
"y": 24,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"expr": "histogram_quantile(0.95,sum by(le)(rate(job_processing_duration_seconds_bucket[1m])))",
|
||||
"refId": "A",
|
||||
"legendFormat": "{{service_name}} {{outcome}}"
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "s"
|
||||
},
|
||||
"overrides": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 8,
|
||||
"type": "timeseries",
|
||||
"title": "Accepted to ready p95",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 12,
|
||||
"y": 24,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"expr": "histogram_quantile(0.95,sum by(le)(rate(attachment_ready_seconds_bucket[1m])))",
|
||||
"refId": "A",
|
||||
"legendFormat": "{{service_name}} {{outcome}}"
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "s"
|
||||
},
|
||||
"overrides": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 9,
|
||||
"type": "timeseries",
|
||||
"title": "Queue depth",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 0,
|
||||
"y": 32,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"expr": "max(queue_depth)",
|
||||
"refId": "A",
|
||||
"legendFormat": "{{service_name}} {{outcome}}"
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "short"
|
||||
},
|
||||
"overrides": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 10,
|
||||
"type": "timeseries",
|
||||
"title": "Oldest unfinished job",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 12,
|
||||
"y": 32,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"expr": "max(queue_oldest_age_seconds)",
|
||||
"refId": "A",
|
||||
"legendFormat": "{{service_name}} {{outcome}}"
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "s"
|
||||
},
|
||||
"overrides": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 11,
|
||||
"type": "timeseries",
|
||||
"title": "DB pool used / waiting",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 0,
|
||||
"y": 40,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"expr": "sum by(service_name)(db_pool_used)",
|
||||
"refId": "A",
|
||||
"legendFormat": "{{service_name}} {{outcome}}"
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "short"
|
||||
},
|
||||
"overrides": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 12,
|
||||
"type": "timeseries",
|
||||
"title": "DB pool waiting",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 12,
|
||||
"y": 40,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"expr": "sum by(service_name)(db_pool_waiting)",
|
||||
"refId": "A",
|
||||
"legendFormat": "{{service_name}} {{outcome}}"
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "short"
|
||||
},
|
||||
"overrides": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 13,
|
||||
"type": "timeseries",
|
||||
"title": "Worker busy / capacity",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 0,
|
||||
"y": 48,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"expr": "sum(worker_busy{service_name=\"messenger-worker\"}) / clamp_min(sum(worker_capacity{service_name=\"messenger-worker\"}),1)",
|
||||
"refId": "A",
|
||||
"legendFormat": "{{service_name}} {{outcome}}"
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "percentunit"
|
||||
},
|
||||
"overrides": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 14,
|
||||
"type": "timeseries",
|
||||
"title": "Process RSS",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 12,
|
||||
"y": 48,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"expr": "process_memory_bytes",
|
||||
"refId": "A",
|
||||
"legendFormat": "{{service_name}} {{outcome}}"
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "bytes"
|
||||
},
|
||||
"overrides": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 15,
|
||||
"type": "timeseries",
|
||||
"title": "Process CPU cores",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 0,
|
||||
"y": 56,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"expr": "rate(process_cpu_seconds_total[1m])",
|
||||
"refId": "A",
|
||||
"legendFormat": "{{service_name}} {{outcome}}"
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "short"
|
||||
},
|
||||
"overrides": []
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
apiVersion: 1
|
||||
providers:
|
||||
- name: messenger
|
||||
folder: Messenger
|
||||
type: file
|
||||
options:
|
||||
path: /var/lib/grafana/dashboards
|
||||
@@ -0,0 +1,28 @@
|
||||
apiVersion: 1
|
||||
datasources:
|
||||
- name: Prometheus
|
||||
uid: prometheus
|
||||
type: prometheus
|
||||
url: http://prometheus:9090
|
||||
isDefault: true
|
||||
access: proxy
|
||||
- name: Loki
|
||||
uid: loki
|
||||
type: loki
|
||||
url: http://loki:3100
|
||||
access: proxy
|
||||
jsonData:
|
||||
derivedFields:
|
||||
- name: TraceID
|
||||
matcherRegex: '"trace_id":\s*"([0-9a-f]{32})"'
|
||||
datasourceUid: tempo
|
||||
url: '$${__value.raw}'
|
||||
- name: Tempo
|
||||
uid: tempo
|
||||
type: tempo
|
||||
url: http://tempo:3200
|
||||
access: proxy
|
||||
jsonData:
|
||||
tracesToLogsV2:
|
||||
datasourceUid: loki
|
||||
filterByTraceID: true
|
||||
@@ -0,0 +1,34 @@
|
||||
auth_enabled: false
|
||||
server:
|
||||
http_listen_port: 3100
|
||||
http_listen_address: 127.0.0.1
|
||||
grpc_listen_address: 127.0.0.1
|
||||
common:
|
||||
path_prefix: /loki
|
||||
replication_factor: 1
|
||||
ring:
|
||||
kvstore:
|
||||
store: inmemory
|
||||
storage:
|
||||
filesystem:
|
||||
chunks_directory: /loki/chunks
|
||||
rules_directory: /loki/rules
|
||||
instance_addr: 127.0.0.1
|
||||
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
|
||||
retention_period: 168h
|
||||
compactor:
|
||||
working_directory: /loki/compactor
|
||||
retention_enabled: true
|
||||
delete_request_store: filesystem
|
||||
analytics:
|
||||
reporting_enabled: false
|
||||
@@ -0,0 +1,26 @@
|
||||
global:
|
||||
scrape_interval: 2s
|
||||
evaluation_interval: 2s
|
||||
rule_files:
|
||||
- /etc/prometheus/alerts.yaml
|
||||
scrape_configs:
|
||||
- job_name: messenger
|
||||
static_configs:
|
||||
- targets:
|
||||
- collector:9465
|
||||
scheme: https
|
||||
tls_config:
|
||||
ca_file: /trust/ca.crt
|
||||
cert_file: /pki/tls.crt
|
||||
key_file: /pki/tls.key
|
||||
server_name: collector
|
||||
- job_name: collector
|
||||
static_configs:
|
||||
- targets:
|
||||
- collector:8889
|
||||
scheme: https
|
||||
tls_config:
|
||||
ca_file: /trust/ca.crt
|
||||
cert_file: /pki/tls.crt
|
||||
key_file: /pki/tls.key
|
||||
server_name: collector
|
||||
@@ -0,0 +1,33 @@
|
||||
server:
|
||||
http_listen_port: 3200
|
||||
http_listen_address: 127.0.0.1
|
||||
grpc_listen_address: 127.0.0.1
|
||||
distributor:
|
||||
receivers:
|
||||
otlp:
|
||||
protocols:
|
||||
grpc:
|
||||
endpoint: 127.0.0.1:4317
|
||||
ingester:
|
||||
trace_idle_period: 2s
|
||||
max_block_duration: 10s
|
||||
max_block_bytes: 8388608
|
||||
concurrent_flushes: 1
|
||||
flush_check_period: 2s
|
||||
complete_block_timeout: 30s
|
||||
compactor:
|
||||
compaction:
|
||||
block_retention: 168h
|
||||
storage:
|
||||
trace:
|
||||
backend: local
|
||||
blocklist_poll: 10s
|
||||
search:
|
||||
read_buffer_count: 4
|
||||
read_buffer_size_bytes: 262144
|
||||
wal:
|
||||
path: /var/tempo/wal
|
||||
local:
|
||||
path: /var/tempo/blocks
|
||||
usage_report:
|
||||
reporting_enabled: false
|
||||
@@ -0,0 +1,3 @@
|
||||
FROM python:3.13.5-slim
|
||||
RUN pip install --no-cache-dir pip-audit==2.9.0
|
||||
ENTRYPOINT ["python", "-m", "pip_audit", "--cache-dir", "/tmp/pip-audit", "--disable-pip", "--no-deps", "-r", "/requirements.lock", "--format", "json", "--output", "/out/dependency-scan.json"]
|
||||
@@ -0,0 +1,37 @@
|
||||
[
|
||||
{
|
||||
"port": 6380,
|
||||
"upstream_port": 6379,
|
||||
"allowed_clients": [
|
||||
"api",
|
||||
"relay"
|
||||
],
|
||||
"protocol": "redis",
|
||||
"redis_user": "producer",
|
||||
"commands": [
|
||||
"AUTH",
|
||||
"PING",
|
||||
"CLIENT",
|
||||
"XADD"
|
||||
]
|
||||
},
|
||||
{
|
||||
"port": 6381,
|
||||
"upstream_port": 6379,
|
||||
"allowed_clients": [
|
||||
"worker"
|
||||
],
|
||||
"protocol": "redis",
|
||||
"redis_user": "consumer",
|
||||
"commands": [
|
||||
"AUTH",
|
||||
"PING",
|
||||
"CLIENT",
|
||||
"XGROUP",
|
||||
"XREADGROUP",
|
||||
"XAUTOCLAIM",
|
||||
"XACK",
|
||||
"XDEL"
|
||||
]
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,8 @@
|
||||
bind 127.0.0.1
|
||||
port 6379
|
||||
appendonly yes
|
||||
appendfsync always
|
||||
dir /data
|
||||
aclfile /etc/redis/users.acl
|
||||
maxmemory 96mb
|
||||
maxmemory-policy noeviction
|
||||
@@ -0,0 +1,7 @@
|
||||
bind 127.0.0.1
|
||||
port 6379
|
||||
appendonly yes
|
||||
dir /data
|
||||
aclfile /etc/redis/users.acl
|
||||
maxmemory 64mb
|
||||
maxmemory-policy allkeys-lru
|
||||
@@ -0,0 +1,40 @@
|
||||
[
|
||||
{
|
||||
"port": 4319,
|
||||
"upstream_port": 4318,
|
||||
"allowed_clients": [
|
||||
"api",
|
||||
"worker",
|
||||
"relay"
|
||||
],
|
||||
"protocol": "http"
|
||||
},
|
||||
{
|
||||
"port": 9465,
|
||||
"upstream_port": 9464,
|
||||
"allowed_clients": [
|
||||
"prometheus"
|
||||
],
|
||||
"protocol": "http",
|
||||
"read_only_clients": [
|
||||
"prometheus"
|
||||
],
|
||||
"read_prefixes": [
|
||||
"/metrics"
|
||||
]
|
||||
},
|
||||
{
|
||||
"port": 8889,
|
||||
"upstream_port": 8888,
|
||||
"allowed_clients": [
|
||||
"prometheus"
|
||||
],
|
||||
"protocol": "http",
|
||||
"read_only_clients": [
|
||||
"prometheus"
|
||||
],
|
||||
"read_prefixes": [
|
||||
"/metrics"
|
||||
]
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,25 @@
|
||||
[
|
||||
{
|
||||
"port": 9443,
|
||||
"upstream_port": 3100,
|
||||
"allowed_clients": [
|
||||
"collector",
|
||||
"grafana",
|
||||
"operator"
|
||||
],
|
||||
"read_only_clients": [
|
||||
"grafana",
|
||||
"operator"
|
||||
],
|
||||
"protocol": "http",
|
||||
"read_prefixes": [
|
||||
"/ready",
|
||||
"/loki/api/v1/query",
|
||||
"/loki/api/v1/labels",
|
||||
"/loki/api/v1/label/",
|
||||
"/loki/api/v1/series",
|
||||
"/loki/api/v1/index/",
|
||||
"/loki/api/v1/volume"
|
||||
]
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,16 @@
|
||||
ui = true
|
||||
disable_mlock = true
|
||||
api_addr = "https://openbao:8200"
|
||||
cluster_addr = "https://127.0.0.1:8201"
|
||||
listener "tcp" {
|
||||
address = "0.0.0.0:8200"
|
||||
cluster_address = "127.0.0.1:8201"
|
||||
tls_cert_file = "/pki/tls.crt"
|
||||
tls_key_file = "/pki/tls.key"
|
||||
tls_client_ca_file = "/trust/ca.crt"
|
||||
tls_require_and_verify_client_cert = true
|
||||
tls_min_version = "tls12"
|
||||
}
|
||||
storage "file" {
|
||||
path = "/openbao/file"
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
local all all trust
|
||||
hostnossl all all 0.0.0.0/0 reject
|
||||
hostnossl all all ::/0 reject
|
||||
hostssl all all 0.0.0.0/0 scram-sha-256
|
||||
hostssl all all ::/0 scram-sha-256
|
||||
@@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
cp /pki/tls.key /tmp/postgres-tls.key
|
||||
chown postgres:postgres /tmp/postgres-tls.key
|
||||
chmod 600 /tmp/postgres-tls.key
|
||||
exec /usr/local/bin/docker-entrypoint.sh postgres -c hba_file=/config/pg_hba.conf -c ssl=on -c ssl_cert_file=/pki/tls.crt -c ssl_key_file=/tmp/postgres-tls.key -c ssl_min_protocol_version=TLSv1.2 -c log_parameter_max_length_on_error=0
|
||||
@@ -0,0 +1,27 @@
|
||||
[
|
||||
{
|
||||
"port": 9443,
|
||||
"upstream_port": 9090,
|
||||
"allowed_clients": [
|
||||
"grafana",
|
||||
"operator"
|
||||
],
|
||||
"read_only_clients": [
|
||||
"grafana",
|
||||
"operator"
|
||||
],
|
||||
"protocol": "http",
|
||||
"read_prefixes": [
|
||||
"/-/ready",
|
||||
"/api/v1/query",
|
||||
"/api/v1/labels",
|
||||
"/api/v1/label/",
|
||||
"/api/v1/series",
|
||||
"/api/v1/metadata",
|
||||
"/api/v1/status/",
|
||||
"/api/v1/alerts",
|
||||
"/api/v1/rules",
|
||||
"/api/v1/targets"
|
||||
]
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,37 @@
|
||||
[
|
||||
{
|
||||
"port": 6380,
|
||||
"upstream_port": 6379,
|
||||
"allowed_clients": [
|
||||
"api"
|
||||
],
|
||||
"protocol": "redis",
|
||||
"redis_user": "profile",
|
||||
"commands": [
|
||||
"AUTH",
|
||||
"PING",
|
||||
"CLIENT",
|
||||
"GET",
|
||||
"SET"
|
||||
]
|
||||
},
|
||||
{
|
||||
"port": 6382,
|
||||
"upstream_port": 6379,
|
||||
"allowed_clients": [
|
||||
"operator"
|
||||
],
|
||||
"protocol": "redis",
|
||||
"redis_user": "tester",
|
||||
"commands": [
|
||||
"AUTH",
|
||||
"PING",
|
||||
"CLIENT",
|
||||
"GET",
|
||||
"SET",
|
||||
"FLUSHDB",
|
||||
"DEL",
|
||||
"TTL"
|
||||
]
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,33 @@
|
||||
[
|
||||
{
|
||||
"port": 9443,
|
||||
"upstream_port": 3200,
|
||||
"allowed_clients": [
|
||||
"grafana",
|
||||
"operator"
|
||||
],
|
||||
"read_only_clients": [
|
||||
"grafana",
|
||||
"operator"
|
||||
],
|
||||
"protocol": "http",
|
||||
"read_prefixes": [
|
||||
"/ready",
|
||||
"/api/traces/",
|
||||
"/api/search",
|
||||
"/api/v2/search",
|
||||
"/api/echo",
|
||||
"/api/status/"
|
||||
]
|
||||
},
|
||||
{
|
||||
"port": 4319,
|
||||
"upstream_port": 4317,
|
||||
"allowed_clients": [
|
||||
"collector"
|
||||
],
|
||||
"alpn": [
|
||||
"h2"
|
||||
]
|
||||
}
|
||||
]
|
||||
Reference in New Issue
Block a user