Implement TLS identities, scoped OpenBao access and worker security study
This commit is contained in:
+755
@@ -0,0 +1,755 @@
|
||||
name: mtusi-vasilev-lab7
|
||||
x-hardening:
|
||||
cpus: 0.25
|
||||
mem_limit: 128m
|
||||
pids_limit: 96
|
||||
cap_drop: &id001
|
||||
- ALL
|
||||
security_opt: &id002
|
||||
- no-new-privileges:true
|
||||
read_only: true
|
||||
tmpfs: &id003
|
||||
- /tmp:size=16m,noexec,nosuid
|
||||
x-environment:
|
||||
BAO_ADDR: https://openbao:8200
|
||||
S3_ENDPOINT: https://storage:8443
|
||||
S3_BUCKET: messenger
|
||||
S3_CA_FILE: /run/tls/ca.pem
|
||||
SSL_CERT_FILE: /run/tls/ca.pem
|
||||
JOB_MAX_ATTEMPTS: ${JOB_MAX_ATTEMPTS:-5}
|
||||
JOB_LEASE_SECONDS: ${JOB_LEASE_SECONDS:-45}
|
||||
SESSION_TTL_SECONDS: ${SESSION_TTL_SECONDS:-3600}
|
||||
OTEL_EXPORTER_OTLP_ENDPOINT: https://collector:4318
|
||||
OTEL_EXPORTER_OTLP_CERTIFICATE: /run/tls/ca.pem
|
||||
OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE: /run/tls/identity/cert.pem
|
||||
OTEL_EXPORTER_OTLP_CLIENT_KEY: /run/tls/identity/key.pem
|
||||
OTEL_ENABLED: '1'
|
||||
OTEL_METRIC_INTERVAL_MS: '5000'
|
||||
x-application:
|
||||
cpus: 0.5
|
||||
mem_limit: 512m
|
||||
pids_limit: 96
|
||||
cap_drop: *id001
|
||||
security_opt: *id002
|
||||
read_only: true
|
||||
tmpfs: *id003
|
||||
image: ${API_IMAGE:-mtusi-vasilev:lab7}
|
||||
build: &id004
|
||||
context: .
|
||||
args:
|
||||
VCS_REF: ${VCS_REF:-uncommitted}
|
||||
stop_grace_period: 8s
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:17.10-alpine
|
||||
entrypoint:
|
||||
- /etc/pg-entrypoint.sh
|
||||
environment:
|
||||
POSTGRES_USER: messenger
|
||||
POSTGRES_DB: messenger
|
||||
POSTGRES_PASSWORD_FILE: /run/secrets/postgres_password
|
||||
secrets:
|
||||
- postgres_password
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/data
|
||||
- ./secrets/pki/postgres:/run/tls/identity:ro
|
||||
- ./secrets/ca.pem:/run/tls/ca.pem:ro
|
||||
- ./infra/pg-entrypoint.sh:/etc/pg-entrypoint.sh:ro
|
||||
- ./infra/pg_hba.conf:/etc/postgresql/pg_hba.conf:ro
|
||||
- ./secrets/db_roles.sql:/docker-entrypoint-initdb.d/01_roles.sql:ro
|
||||
cpus: 0.75
|
||||
mem_limit: 768m
|
||||
command:
|
||||
- postgres
|
||||
- -c
|
||||
- fsync=on
|
||||
- -c
|
||||
- ssl=on
|
||||
- -c
|
||||
- ssl_cert_file=/run/tls/identity/cert.pem
|
||||
- -c
|
||||
- ssl_key_file=/tmp/postgres-key.pem
|
||||
- -c
|
||||
- ssl_ca_file=/run/tls/ca.pem
|
||||
- -c
|
||||
- hba_file=/etc/postgresql/pg_hba.conf
|
||||
healthcheck:
|
||||
test:
|
||||
- CMD-SHELL
|
||||
- pg_isready -U messenger -d messenger
|
||||
interval: 2s
|
||||
timeout: 2s
|
||||
retries: 20
|
||||
openbao:
|
||||
cpus: 0.25
|
||||
mem_limit: 192m
|
||||
pids_limit: 96
|
||||
cap_drop: *id001
|
||||
security_opt: *id002
|
||||
read_only: true
|
||||
tmpfs: *id003
|
||||
image: ghcr.io/openbao/openbao:2.5.2
|
||||
user: 100:1000
|
||||
command:
|
||||
- server
|
||||
- -config=/etc/openbao.hcl
|
||||
ports:
|
||||
- 127.0.0.1:18207:8200
|
||||
volumes:
|
||||
- bao_data:/bao/data
|
||||
- ./infra/openbao.hcl:/etc/openbao.hcl:ro
|
||||
- ./secrets/pki/openbao:/run/tls/identity:ro
|
||||
- ./secrets/ca.pem:/run/tls/ca.pem:ro
|
||||
depends_on:
|
||||
state-init:
|
||||
condition: service_completed_successfully
|
||||
cache:
|
||||
cpus: 0.25
|
||||
mem_limit: 128m
|
||||
pids_limit: 96
|
||||
cap_drop: *id001
|
||||
security_opt: *id002
|
||||
read_only: true
|
||||
tmpfs: *id003
|
||||
image: valkey/valkey:8.1.3-alpine
|
||||
command:
|
||||
- /run/secrets/cache_config
|
||||
secrets:
|
||||
- cache_config
|
||||
user: 1000:1000
|
||||
entrypoint:
|
||||
- valkey-server
|
||||
cache-tls:
|
||||
cpus: 0.5
|
||||
mem_limit: 64m
|
||||
pids_limit: 96
|
||||
cap_drop: *id001
|
||||
security_opt: *id002
|
||||
read_only: true
|
||||
tmpfs: *id003
|
||||
image: ${API_IMAGE:-mtusi-vasilev:lab7}
|
||||
build: *id004
|
||||
stop_grace_period: 8s
|
||||
network_mode: service:cache
|
||||
command:
|
||||
- python
|
||||
- -m
|
||||
- messenger.tls_gateway
|
||||
- --config
|
||||
- /run/tls/gateway.json
|
||||
volumes:
|
||||
- ./secrets/pki/cache:/run/tls/identity:ro
|
||||
- ./secrets/ca.pem:/run/tls/ca.pem:ro
|
||||
- ./secrets/revoked.json:/run/tls/revoked.json:ro
|
||||
- ./secrets/cache_gateway.json:/run/tls/gateway.json:ro
|
||||
healthcheck:
|
||||
disable: true
|
||||
broker:
|
||||
cpus: 0.25
|
||||
mem_limit: 192m
|
||||
pids_limit: 96
|
||||
cap_drop: *id001
|
||||
security_opt: *id002
|
||||
read_only: true
|
||||
tmpfs: *id003
|
||||
image: valkey/valkey:8.1.3-alpine
|
||||
command:
|
||||
- /run/secrets/broker_config
|
||||
secrets:
|
||||
- broker_config
|
||||
volumes:
|
||||
- broker_data:/data
|
||||
depends_on:
|
||||
state-init:
|
||||
condition: service_completed_successfully
|
||||
user: 1000:1000
|
||||
entrypoint:
|
||||
- valkey-server
|
||||
broker-tls:
|
||||
cpus: 0.5
|
||||
mem_limit: 64m
|
||||
pids_limit: 96
|
||||
cap_drop: *id001
|
||||
security_opt: *id002
|
||||
read_only: true
|
||||
tmpfs: *id003
|
||||
image: ${API_IMAGE:-mtusi-vasilev:lab7}
|
||||
build: *id004
|
||||
stop_grace_period: 8s
|
||||
network_mode: service:broker
|
||||
command:
|
||||
- python
|
||||
- -m
|
||||
- messenger.tls_gateway
|
||||
- --config
|
||||
- /run/tls/gateway.json
|
||||
volumes:
|
||||
- ./secrets/pki/broker:/run/tls/identity:ro
|
||||
- ./secrets/ca.pem:/run/tls/ca.pem:ro
|
||||
- ./secrets/revoked.json:/run/tls/revoked.json:ro
|
||||
- ./secrets/broker_gateway.json:/run/tls/gateway.json:ro
|
||||
healthcheck:
|
||||
disable: true
|
||||
storage:
|
||||
image: chrislusf/seaweedfs:4.15@sha256:1593bd2a98964f5d4df83fa7db2b3d4ee7b20190813cc5bf8c3200e0e70d346e
|
||||
command:
|
||||
- server
|
||||
- -dir=/data
|
||||
- -ip=127.0.0.1
|
||||
- -ip.bind=127.0.0.1
|
||||
- -filer
|
||||
- -volume.max=32
|
||||
- -volume.preStopSeconds=0
|
||||
- -master.volumeSizeLimitMB=64
|
||||
volumes:
|
||||
- s3_data:/data
|
||||
- ./infra/filer.toml:/etc/seaweedfs/filer.toml:ro
|
||||
cpus: 0.5
|
||||
mem_limit: 512m
|
||||
cap_drop:
|
||||
- ALL
|
||||
security_opt:
|
||||
- no-new-privileges:true
|
||||
healthcheck:
|
||||
test:
|
||||
- CMD-SHELL
|
||||
- wget -q -O /dev/null http://127.0.0.1:9333/dir/status
|
||||
interval: 2s
|
||||
timeout: 2s
|
||||
retries: 25
|
||||
depends_on:
|
||||
state-init:
|
||||
condition: service_completed_successfully
|
||||
user: 1000:1000
|
||||
entrypoint:
|
||||
- /usr/bin/weed
|
||||
s3:
|
||||
image: chrislusf/seaweedfs:4.15@sha256:1593bd2a98964f5d4df83fa7db2b3d4ee7b20190813cc5bf8c3200e0e70d346e
|
||||
network_mode: service:storage
|
||||
command:
|
||||
- s3
|
||||
- -filer=127.0.0.1:8888
|
||||
- -ip.bind=127.0.0.1
|
||||
- -config=/run/secrets/s3_config
|
||||
- -port=8333
|
||||
- -port.iceberg=0
|
||||
secrets:
|
||||
- s3_config
|
||||
depends_on:
|
||||
storage:
|
||||
condition: service_healthy
|
||||
cpus: 0.25
|
||||
mem_limit: 256m
|
||||
cap_drop:
|
||||
- ALL
|
||||
security_opt:
|
||||
- no-new-privileges:true
|
||||
user: 1000:1000
|
||||
entrypoint:
|
||||
- /usr/bin/weed
|
||||
storage-tls:
|
||||
cpus: 0.5
|
||||
mem_limit: 96m
|
||||
pids_limit: 96
|
||||
cap_drop: *id001
|
||||
security_opt: *id002
|
||||
read_only: true
|
||||
tmpfs: *id003
|
||||
image: ${API_IMAGE:-mtusi-vasilev:lab7}
|
||||
build: *id004
|
||||
stop_grace_period: 8s
|
||||
network_mode: service:storage
|
||||
command:
|
||||
- python
|
||||
- -m
|
||||
- messenger.tls_gateway
|
||||
- --config
|
||||
- /run/tls/gateway.json
|
||||
volumes:
|
||||
- ./secrets/pki/storage:/run/tls/identity:ro
|
||||
- ./secrets/ca.pem:/run/tls/ca.pem:ro
|
||||
- ./secrets/revoked.json:/run/tls/revoked.json:ro
|
||||
- ./secrets/storage_gateway.json:/run/tls/gateway.json:ro
|
||||
healthcheck:
|
||||
disable: true
|
||||
migrate:
|
||||
cpus: 0.5
|
||||
mem_limit: 512m
|
||||
pids_limit: 96
|
||||
cap_drop: *id001
|
||||
security_opt: *id002
|
||||
read_only: true
|
||||
tmpfs: *id003
|
||||
image: ${API_IMAGE:-mtusi-vasilev:lab7}
|
||||
build: *id004
|
||||
stop_grace_period: 8s
|
||||
command:
|
||||
- python
|
||||
- -m
|
||||
- messenger.migrate
|
||||
environment:
|
||||
DATABASE_URL_FILE: /run/secrets/admin_database_url
|
||||
secrets:
|
||||
- admin_database_url
|
||||
volumes:
|
||||
- ./secrets/ca.pem:/run/tls/ca.pem:ro
|
||||
healthcheck:
|
||||
disable: true
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
s3-bootstrap:
|
||||
cpus: 0.5
|
||||
mem_limit: 512m
|
||||
pids_limit: 96
|
||||
cap_drop: *id001
|
||||
security_opt: *id002
|
||||
read_only: true
|
||||
tmpfs: *id003
|
||||
image: ${API_IMAGE:-mtusi-vasilev:lab7}
|
||||
build: *id004
|
||||
stop_grace_period: 8s
|
||||
command:
|
||||
- python
|
||||
- -m
|
||||
- messenger.storage_bootstrap
|
||||
environment:
|
||||
S3_ENDPOINT: https://storage:8443
|
||||
S3_ADMIN_ACCESS_KEY_FILE: /run/secrets/admin_s3_access_key
|
||||
S3_ADMIN_SECRET_KEY_FILE: /run/secrets/admin_s3_secret_key
|
||||
secrets:
|
||||
- admin_s3_access_key
|
||||
- admin_s3_secret_key
|
||||
volumes:
|
||||
- ./secrets/pki/operator:/run/tls/identity:ro
|
||||
- ./secrets/ca.pem:/run/tls/ca.pem:ro
|
||||
healthcheck:
|
||||
disable: true
|
||||
depends_on:
|
||||
storage-tls:
|
||||
condition: service_started
|
||||
api:
|
||||
cpus: 0.5
|
||||
mem_limit: 512m
|
||||
pids_limit: 96
|
||||
cap_drop: *id001
|
||||
security_opt: *id002
|
||||
read_only: true
|
||||
tmpfs: *id003
|
||||
image: ${API_IMAGE:-mtusi-vasilev:lab7}
|
||||
build: *id004
|
||||
stop_grace_period: 8s
|
||||
command:
|
||||
- python
|
||||
- -m
|
||||
- messenger.secure_entry
|
||||
environment:
|
||||
BAO_ADDR: https://openbao:8200
|
||||
S3_ENDPOINT: https://storage:8443
|
||||
S3_BUCKET: messenger
|
||||
S3_CA_FILE: /run/tls/ca.pem
|
||||
SSL_CERT_FILE: /run/tls/ca.pem
|
||||
JOB_MAX_ATTEMPTS: ${JOB_MAX_ATTEMPTS:-5}
|
||||
JOB_LEASE_SECONDS: ${JOB_LEASE_SECONDS:-45}
|
||||
SESSION_TTL_SECONDS: ${SESSION_TTL_SECONDS:-3600}
|
||||
OTEL_EXPORTER_OTLP_ENDPOINT: https://collector:4318
|
||||
OTEL_EXPORTER_OTLP_CERTIFICATE: /run/tls/ca.pem
|
||||
OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE: /run/tls/identity/cert.pem
|
||||
OTEL_EXPORTER_OTLP_CLIENT_KEY: /run/tls/identity/key.pem
|
||||
BAO_ROLE: api
|
||||
TLS_GATEWAY_CONFIG: /run/tls/gateway.json
|
||||
OTEL_ENABLED: '1'
|
||||
OTEL_METRIC_INTERVAL_MS: '5000'
|
||||
volumes:
|
||||
- ./secrets/pki/api:/run/tls/identity:ro
|
||||
- ./secrets/ca.pem:/run/tls/ca.pem:ro
|
||||
- ./secrets/revoked.json:/run/tls/revoked.json:ro
|
||||
- ./secrets/api_gateway.json:/run/tls/gateway.json:ro
|
||||
deploy:
|
||||
replicas: ${API_REPLICAS:-2}
|
||||
depends_on:
|
||||
migrate:
|
||||
condition: service_completed_successfully
|
||||
s3-bootstrap:
|
||||
condition: service_completed_successfully
|
||||
cache-tls:
|
||||
condition: service_started
|
||||
dispatcher:
|
||||
cpus: 0.5
|
||||
mem_limit: 192m
|
||||
pids_limit: 96
|
||||
cap_drop: *id001
|
||||
security_opt: *id002
|
||||
read_only: true
|
||||
tmpfs: *id003
|
||||
image: ${API_IMAGE:-mtusi-vasilev:lab7}
|
||||
build: *id004
|
||||
stop_grace_period: 8s
|
||||
command:
|
||||
- python
|
||||
- -m
|
||||
- messenger.worker
|
||||
- --dispatcher
|
||||
environment:
|
||||
BAO_ADDR: https://openbao:8200
|
||||
S3_ENDPOINT: https://storage:8443
|
||||
S3_BUCKET: messenger
|
||||
S3_CA_FILE: /run/tls/ca.pem
|
||||
SSL_CERT_FILE: /run/tls/ca.pem
|
||||
JOB_MAX_ATTEMPTS: ${JOB_MAX_ATTEMPTS:-5}
|
||||
JOB_LEASE_SECONDS: ${JOB_LEASE_SECONDS:-45}
|
||||
SESSION_TTL_SECONDS: ${SESSION_TTL_SECONDS:-3600}
|
||||
OTEL_EXPORTER_OTLP_ENDPOINT: https://collector:4318
|
||||
OTEL_EXPORTER_OTLP_CERTIFICATE: /run/tls/ca.pem
|
||||
OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE: /run/tls/identity/cert.pem
|
||||
OTEL_EXPORTER_OTLP_CLIENT_KEY: /run/tls/identity/key.pem
|
||||
BAO_ROLE: dispatcher
|
||||
OTEL_ENABLED: '1'
|
||||
OTEL_METRIC_INTERVAL_MS: '5000'
|
||||
volumes:
|
||||
- ./secrets/pki/dispatcher:/run/tls/identity:ro
|
||||
- ./secrets/ca.pem:/run/tls/ca.pem:ro
|
||||
healthcheck:
|
||||
disable: true
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
migrate:
|
||||
condition: service_completed_successfully
|
||||
broker-tls:
|
||||
condition: service_started
|
||||
worker:
|
||||
cpus: 0.75
|
||||
mem_limit: 896m
|
||||
pids_limit: 96
|
||||
cap_drop: *id001
|
||||
security_opt: *id002
|
||||
read_only: true
|
||||
tmpfs:
|
||||
- /tmp:size=32m,noexec,nosuid
|
||||
image: ${API_IMAGE:-mtusi-vasilev:lab7}
|
||||
build: *id004
|
||||
stop_grace_period: 30s
|
||||
command:
|
||||
- python
|
||||
- -m
|
||||
- messenger.worker
|
||||
environment:
|
||||
BAO_ADDR: https://openbao:8200
|
||||
S3_ENDPOINT: https://storage:8443
|
||||
S3_BUCKET: messenger
|
||||
S3_CA_FILE: /run/tls/ca.pem
|
||||
SSL_CERT_FILE: /run/tls/ca.pem
|
||||
JOB_MAX_ATTEMPTS: ${JOB_MAX_ATTEMPTS:-5}
|
||||
JOB_LEASE_SECONDS: ${JOB_LEASE_SECONDS:-45}
|
||||
SESSION_TTL_SECONDS: ${SESSION_TTL_SECONDS:-3600}
|
||||
OTEL_EXPORTER_OTLP_ENDPOINT: https://collector:4318
|
||||
OTEL_EXPORTER_OTLP_CERTIFICATE: /run/tls/ca.pem
|
||||
OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE: /run/tls/identity/cert.pem
|
||||
OTEL_EXPORTER_OTLP_CLIENT_KEY: /run/tls/identity/key.pem
|
||||
BAO_ROLE: worker
|
||||
OTEL_ENABLED: '1'
|
||||
OTEL_METRIC_INTERVAL_MS: '5000'
|
||||
volumes:
|
||||
- ./secrets/pki/worker:/run/tls/identity:ro
|
||||
- ./secrets/ca.pem:/run/tls/ca.pem:ro
|
||||
healthcheck:
|
||||
disable: true
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
migrate:
|
||||
condition: service_completed_successfully
|
||||
broker-tls:
|
||||
condition: service_started
|
||||
s3-bootstrap:
|
||||
condition: service_completed_successfully
|
||||
lb:
|
||||
cpus: 0.25
|
||||
mem_limit: 128m
|
||||
pids_limit: 96
|
||||
cap_drop: *id001
|
||||
security_opt: *id002
|
||||
read_only: true
|
||||
tmpfs: *id003
|
||||
image: haproxy:3.2-alpine@sha256:96ec3c75a9264ba94e733eeacb44051ed6e7b79bb77a73c2c36f236b6423f1f0
|
||||
ports:
|
||||
- 127.0.0.1:${PUBLIC_PORT:-8447}:8443
|
||||
volumes:
|
||||
- ./infra/haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro
|
||||
- ./secrets/pki/lb:/run/tls/identity:ro
|
||||
- ./secrets/ca.pem:/run/tls/ca.pem:ro
|
||||
depends_on:
|
||||
api:
|
||||
condition: service_healthy
|
||||
healthcheck:
|
||||
test:
|
||||
- CMD-SHELL
|
||||
- test -S /tmp/haproxy.sock
|
||||
interval: 2s
|
||||
timeout: 2s
|
||||
retries: 20
|
||||
collector:
|
||||
cpus: 0.25
|
||||
mem_limit: 256m
|
||||
pids_limit: 96
|
||||
cap_drop: *id001
|
||||
security_opt: *id002
|
||||
read_only: true
|
||||
tmpfs: *id003
|
||||
image: otel/opentelemetry-collector-contrib:0.123.0
|
||||
command:
|
||||
- --config=/etc/otelcol/config.yaml
|
||||
volumes:
|
||||
- ./infra/observability/collector.yaml:/etc/otelcol/config.yaml:ro
|
||||
- ./secrets/pki/collector:/run/tls/identity:ro
|
||||
- ./secrets/ca.pem:/run/tls/ca.pem:ro
|
||||
prometheus:
|
||||
cpus: 0.25
|
||||
mem_limit: 256m
|
||||
pids_limit: 96
|
||||
cap_drop: *id001
|
||||
security_opt: *id002
|
||||
read_only: true
|
||||
tmpfs: *id003
|
||||
image: prom/prometheus:v3.2.1
|
||||
command:
|
||||
- --config.file=/etc/prometheus/prometheus.yml
|
||||
- --storage.tsdb.path=/prometheus
|
||||
- --storage.tsdb.retention.time=24h
|
||||
- --web.listen-address=127.0.0.1:9090
|
||||
volumes:
|
||||
- ./infra/observability/prometheus.yaml:/etc/prometheus/prometheus.yml:ro
|
||||
- ./infra/observability/alerts.yaml:/etc/prometheus/alerts.yaml:ro
|
||||
- prometheus_data:/prometheus
|
||||
- ./secrets/pki/prometheus:/run/tls/identity:ro
|
||||
- ./secrets/ca.pem:/run/tls/ca.pem:ro
|
||||
ports:
|
||||
- 127.0.0.1:19097:9443
|
||||
depends_on:
|
||||
state-init:
|
||||
condition: service_completed_successfully
|
||||
loki:
|
||||
cpus: 0.25
|
||||
mem_limit: 384m
|
||||
pids_limit: 96
|
||||
cap_drop: *id001
|
||||
security_opt: *id002
|
||||
read_only: true
|
||||
tmpfs: *id003
|
||||
image: grafana/loki:3.4.2
|
||||
command:
|
||||
- -config.file=/etc/loki/config.yaml
|
||||
volumes:
|
||||
- ./infra/observability/loki.yaml:/etc/loki/config.yaml:ro
|
||||
- loki_data:/loki
|
||||
depends_on:
|
||||
state-init:
|
||||
condition: service_completed_successfully
|
||||
tempo:
|
||||
cpus: 0.25
|
||||
mem_limit: 768m
|
||||
environment:
|
||||
GOMEMLIMIT: 512MiB
|
||||
pids_limit: 96
|
||||
cap_drop: *id001
|
||||
security_opt: *id002
|
||||
read_only: true
|
||||
tmpfs: *id003
|
||||
image: grafana/tempo:2.7.2
|
||||
command:
|
||||
- -config.file=/etc/tempo/config.yaml
|
||||
volumes:
|
||||
- ./infra/observability/tempo.yaml:/etc/tempo/config.yaml:ro
|
||||
- tempo_data:/var/tempo
|
||||
depends_on:
|
||||
state-init:
|
||||
condition: service_completed_successfully
|
||||
grafana:
|
||||
cpus: 0.25
|
||||
mem_limit: 256m
|
||||
pids_limit: 96
|
||||
cap_drop: *id001
|
||||
security_opt: *id002
|
||||
read_only: true
|
||||
tmpfs: *id003
|
||||
image: grafana/grafana:11.6.0
|
||||
environment:
|
||||
GF_AUTH_ANONYMOUS_ENABLED: 'false'
|
||||
GF_AUTH_DISABLE_LOGIN_FORM: 'false'
|
||||
GF_USERS_ALLOW_SIGN_UP: 'false'
|
||||
GF_ANALYTICS_REPORTING_ENABLED: 'false'
|
||||
GF_ANALYTICS_CHECK_FOR_UPDATES: 'false'
|
||||
GF_SECURITY_ADMIN_PASSWORD__FILE: /run/secrets/grafana_password
|
||||
GF_SERVER_PROTOCOL: https
|
||||
GF_SERVER_CERT_FILE: /run/tls/identity/cert.pem
|
||||
GF_SERVER_CERT_KEY: /run/tls/identity/key.pem
|
||||
volumes:
|
||||
- ./secrets/grafana-provisioning/datasources:/etc/grafana/provisioning/datasources:ro
|
||||
- ./infra/grafana/provisioning/dashboards:/etc/grafana/provisioning/dashboards:ro
|
||||
- ./infra/grafana/dashboards:/var/lib/grafana/dashboards:ro
|
||||
- grafana_data:/var/lib/grafana
|
||||
- ./secrets/pki/grafana:/run/tls/identity:ro
|
||||
- ./secrets/ca.pem:/run/tls/ca.pem:ro
|
||||
ports:
|
||||
- 127.0.0.1:13007:3000
|
||||
secrets:
|
||||
- grafana_password
|
||||
depends_on:
|
||||
state-init:
|
||||
condition: service_completed_successfully
|
||||
collector-tls:
|
||||
cpus: 0.5
|
||||
mem_limit: 64m
|
||||
pids_limit: 96
|
||||
cap_drop: *id001
|
||||
security_opt: *id002
|
||||
read_only: true
|
||||
tmpfs: *id003
|
||||
image: ${API_IMAGE:-mtusi-vasilev:lab7}
|
||||
build: *id004
|
||||
stop_grace_period: 8s
|
||||
network_mode: service:collector
|
||||
command:
|
||||
- python
|
||||
- -m
|
||||
- messenger.tls_gateway
|
||||
- --config
|
||||
- /run/tls/gateway.json
|
||||
volumes:
|
||||
- ./secrets/pki/collector:/run/tls/identity:ro
|
||||
- ./secrets/ca.pem:/run/tls/ca.pem:ro
|
||||
- ./secrets/revoked.json:/run/tls/revoked.json:ro
|
||||
- ./secrets/collector_gateway.json:/run/tls/gateway.json:ro
|
||||
healthcheck:
|
||||
disable: true
|
||||
prometheus-tls:
|
||||
cpus: 0.5
|
||||
mem_limit: 64m
|
||||
pids_limit: 96
|
||||
cap_drop: *id001
|
||||
security_opt: *id002
|
||||
read_only: true
|
||||
tmpfs: *id003
|
||||
image: ${API_IMAGE:-mtusi-vasilev:lab7}
|
||||
build: *id004
|
||||
stop_grace_period: 8s
|
||||
network_mode: service:prometheus
|
||||
command:
|
||||
- python
|
||||
- -m
|
||||
- messenger.tls_gateway
|
||||
- --config
|
||||
- /run/tls/gateway.json
|
||||
volumes:
|
||||
- ./secrets/pki/prometheus:/run/tls/identity:ro
|
||||
- ./secrets/ca.pem:/run/tls/ca.pem:ro
|
||||
- ./secrets/revoked.json:/run/tls/revoked.json:ro
|
||||
- ./secrets/prometheus_gateway.json:/run/tls/gateway.json:ro
|
||||
healthcheck:
|
||||
disable: true
|
||||
loki-tls:
|
||||
cpus: 0.5
|
||||
mem_limit: 64m
|
||||
pids_limit: 96
|
||||
cap_drop: *id001
|
||||
security_opt: *id002
|
||||
read_only: true
|
||||
tmpfs: *id003
|
||||
image: ${API_IMAGE:-mtusi-vasilev:lab7}
|
||||
build: *id004
|
||||
stop_grace_period: 8s
|
||||
network_mode: service:loki
|
||||
command:
|
||||
- python
|
||||
- -m
|
||||
- messenger.tls_gateway
|
||||
- --config
|
||||
- /run/tls/gateway.json
|
||||
volumes:
|
||||
- ./secrets/pki/loki:/run/tls/identity:ro
|
||||
- ./secrets/ca.pem:/run/tls/ca.pem:ro
|
||||
- ./secrets/revoked.json:/run/tls/revoked.json:ro
|
||||
- ./secrets/loki_gateway.json:/run/tls/gateway.json:ro
|
||||
healthcheck:
|
||||
disable: true
|
||||
tempo-tls:
|
||||
cpus: 0.5
|
||||
mem_limit: 64m
|
||||
pids_limit: 96
|
||||
cap_drop: *id001
|
||||
security_opt: *id002
|
||||
read_only: true
|
||||
tmpfs: *id003
|
||||
image: ${API_IMAGE:-mtusi-vasilev:lab7}
|
||||
build: *id004
|
||||
stop_grace_period: 8s
|
||||
network_mode: service:tempo
|
||||
command:
|
||||
- python
|
||||
- -m
|
||||
- messenger.tls_gateway
|
||||
- --config
|
||||
- /run/tls/gateway.json
|
||||
volumes:
|
||||
- ./secrets/pki/tempo:/run/tls/identity:ro
|
||||
- ./secrets/ca.pem:/run/tls/ca.pem:ro
|
||||
- ./secrets/revoked.json:/run/tls/revoked.json:ro
|
||||
- ./secrets/tempo_gateway.json:/run/tls/gateway.json:ro
|
||||
healthcheck:
|
||||
disable: true
|
||||
state-init:
|
||||
cpus: 0.5
|
||||
mem_limit: 64m
|
||||
pids_limit: 96
|
||||
cap_drop: *id001
|
||||
security_opt: *id002
|
||||
read_only: true
|
||||
tmpfs: *id003
|
||||
image: ${API_IMAGE:-mtusi-vasilev:lab7}
|
||||
build: *id004
|
||||
stop_grace_period: 8s
|
||||
user: 0:0
|
||||
command:
|
||||
- python
|
||||
- -c
|
||||
- import os; pairs=[('/state/bao',100),('/state/broker',1000),('/state/storage',1000),('/state/prometheus',65534),('/state/loki',10001),('/state/tempo',10001),('/state/grafana',472)];
|
||||
[(os.chown(root,uid,uid),[os.chown(os.path.join(root,n),uid,uid) for n in dirs+files])
|
||||
for path,uid in pairs for root,dirs,files in os.walk(path)]
|
||||
cap_add:
|
||||
- CHOWN
|
||||
- DAC_OVERRIDE
|
||||
healthcheck:
|
||||
disable: true
|
||||
volumes:
|
||||
- bao_data:/state/bao
|
||||
- broker_data:/state/broker
|
||||
- s3_data:/state/storage
|
||||
- prometheus_data:/state/prometheus
|
||||
- loki_data:/state/loki
|
||||
- tempo_data:/state/tempo
|
||||
- grafana_data:/state/grafana
|
||||
volumes:
|
||||
postgres_data: null
|
||||
s3_data: null
|
||||
broker_data: null
|
||||
bao_data: null
|
||||
prometheus_data: {}
|
||||
loki_data: {}
|
||||
tempo_data: {}
|
||||
grafana_data: {}
|
||||
secrets:
|
||||
postgres_password:
|
||||
file: ./secrets/postgres_password
|
||||
cache_config:
|
||||
file: ./secrets/cache_config
|
||||
broker_config:
|
||||
file: ./secrets/broker_config
|
||||
s3_config:
|
||||
file: ./secrets/s3_config
|
||||
admin_database_url:
|
||||
file: ./secrets/admin_database_url
|
||||
admin_s3_access_key:
|
||||
file: ./secrets/admin_s3_access_key
|
||||
admin_s3_secret_key:
|
||||
file: ./secrets/admin_s3_secret_key
|
||||
grafana_password:
|
||||
file: ./secrets/grafana_password
|
||||
Reference in New Issue
Block a user