This commit is contained in:
2026-11-26 23:34:55 +03:00
parent 20afc2c790
commit a25f357314
167 changed files with 33202 additions and 89 deletions
+646
View File
@@ -0,0 +1,646 @@
name: lab7
services:
api-tls:
read_only: true
security_opt: &id001
- no-new-privileges:true
cap_drop: &id002
- ALL
tmpfs: &id003
- /tmp:rw,noexec,nosuid,size=128m
user: ${LOCAL_UID:-1000}:${LOCAL_GID:-1000}
restart: unless-stopped
cpus: '0.5'
mem_limit: 256m
networks: &id004
- private
image: envoyproxy/envoy:v1.33.2
entrypoint:
- envoy
command:
- -c
- /etc/envoy/config.yaml
- --concurrency
- '1'
- --log-level
- warning
volumes:
- ./certs/trust:/pki:ro
- ./certs/api:/identity:ro
- ./infra/envoy/api.yaml:/etc/envoy/config.yaml:ro
api2-tls:
read_only: true
security_opt: *id001
cap_drop: *id002
tmpfs: *id003
user: ${LOCAL_UID:-1000}:${LOCAL_GID:-1000}
restart: unless-stopped
cpus: '0.5'
mem_limit: 256m
networks: *id004
image: envoyproxy/envoy:v1.33.2
entrypoint:
- envoy
command:
- -c
- /etc/envoy/config.yaml
- --concurrency
- '1'
- --log-level
- warning
volumes:
- ./certs/trust:/pki:ro
- ./certs/api:/identity:ro
- ./infra/envoy/api.yaml:/etc/envoy/config.yaml:ro
api:
read_only: true
security_opt: *id001
cap_drop: *id002
tmpfs: *id003
user: ${LOCAL_UID:-1000}:${LOCAL_GID:-1000}
restart: unless-stopped
cpus: '0.5'
mem_limit: 384m
build: .
image: lab7-api:local
network_mode: service:api-tls
environment: &id005
BAO_ADDR: https://openbao:8200
BAO_SERVICE: api
APP_HOST: 127.0.0.1
APP_PORT: '8080'
SESSION_STORE: redis
DB_POOL_SIZE: '4'
HTTP_WORKERS: '2'
S3_BUCKET: attachments
OTEL_EXPORTER_OTLP_ENDPOINT: https://otel-collector:4318
OTEL_EXPORTER_OTLP_CERTIFICATE: /pki/ca.crt
OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE: /identity/api.crt
OTEL_EXPORTER_OTLP_CLIENT_KEY: /identity/api.key
SSL_CERT_FILE: /pki/ca.crt
S3_PRESIGN_ENDPOINT: ${S3_PUBLIC_ENDPOINT:-https://localhost:8443}
volumes:
- ./certs/trust:/pki:ro
- ./certs/api:/identity:ro
- ./secrets/approle/api:/run/approle:ro
depends_on:
api-tls:
condition: service_started
db:
condition: service_healthy
cache:
condition: service_healthy
healthcheck:
test:
- CMD
- curl
- -fsS
- http://127.0.0.1:8080/health/ready
interval: 5s
timeout: 3s
retries: 20
start_period: 30s
api2:
read_only: true
security_opt: *id001
cap_drop: *id002
tmpfs: *id003
user: ${LOCAL_UID:-1000}:${LOCAL_GID:-1000}
restart: unless-stopped
cpus: '0.5'
mem_limit: 384m
build: .
image: lab7-api:local
network_mode: service:api2-tls
environment: *id005
volumes:
- ./certs/trust:/pki:ro
- ./certs/api:/identity:ro
- ./secrets/approle/api:/run/approle:ro
depends_on:
api2-tls:
condition: service_started
db:
condition: service_healthy
cache:
condition: service_healthy
healthcheck:
test:
- CMD
- curl
- -fsS
- http://127.0.0.1:8080/health/ready
interval: 5s
timeout: 3s
retries: 20
start_period: 30s
worker:
read_only: true
security_opt: *id001
cap_drop: *id002
tmpfs: *id003
user: ${LOCAL_UID:-1000}:${LOCAL_GID:-1000}
restart: unless-stopped
cpus: '0.5'
mem_limit: 512m
networks: *id004
build: .
image: lab7-api:local
command:
- /app/worker
environment:
BAO_ADDR: https://openbao:8200
BAO_SERVICE: worker
APP_HOST: 127.0.0.1
APP_PORT: '8080'
SESSION_STORE: redis
DB_POOL_SIZE: '4'
HTTP_WORKERS: '2'
S3_BUCKET: attachments
OTEL_EXPORTER_OTLP_ENDPOINT: https://otel-collector:4318
OTEL_EXPORTER_OTLP_CERTIFICATE: /pki/ca.crt
OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE: /identity/worker.crt
OTEL_EXPORTER_OTLP_CLIENT_KEY: /identity/worker.key
SSL_CERT_FILE: /pki/ca.crt
JOB_TIMEOUT_SECONDS: '60'
volumes:
- ./certs/trust:/pki:ro
- ./certs/worker:/identity:ro
- ./secrets/approle/worker:/run/approle:ro
pids_limit: 64
healthcheck:
test:
- CMD-SHELL
- test "$(cat /proc/1/comm)" = worker
interval: 5s
timeout: 3s
retries: 12
start_period: 20s
depends_on:
db:
condition: service_healthy
cache:
condition: service_healthy
lb:
read_only: true
security_opt: *id001
cap_drop: *id002
tmpfs: *id003
user: ${LOCAL_UID:-1000}:${LOCAL_GID:-1000}
restart: unless-stopped
cpus: '0.5'
mem_limit: 256m
networks:
- private
- edge
image: nginx:1.28.0-alpine
entrypoint:
- nginx
command:
- -g
- daemon off;
ports:
- ${HTTPS_PORT:-8443}:443
volumes:
- ./certs/trust:/pki:ro
- ./certs/lb:/identity:ro
- ./certs/client-api:/lb-client:ro
- ./lb/nginx.conf:/etc/nginx/nginx.conf:ro
depends_on:
api:
condition: service_healthy
api2:
condition: service_healthy
db:
read_only: true
security_opt: *id001
cap_drop: *id002
tmpfs:
- /tmp:rw,noexec,nosuid,size=128m
- /var/run/postgresql:rw,nosuid,size=16m
user: ${LOCAL_UID:-1000}:${LOCAL_GID:-1000}
restart: unless-stopped
cpus: '0.5'
mem_limit: 512m
networks: *id004
image: postgres:16.15-alpine
command:
- postgres
- -c
- ssl=on
- -c
- ssl_cert_file=/identity/db.crt
- -c
- ssl_key_file=/identity/db.key
- -c
- ssl_ca_file=/pki/ca.crt
- -c
- ssl_crl_file=/pki/ca.crl
- -c
- hba_file=/etc/postgresql/pg_hba.conf
- -c
- max_connections=100
- -c
- log_min_error_statement=panic
- -c
- log_parameter_max_length_on_error=0
- -c
- log_error_verbosity=terse
environment:
POSTGRES_DB: messenger
POSTGRES_USER: postgres
POSTGRES_PASSWORD_FILE: /run/operator/db-password
PGDATA: /var/lib/postgresql/data/pgdata
volumes:
- ./certs/trust:/pki:ro
- ./certs/db:/identity:ro
- ./secrets/state/postgres:/var/lib/postgresql/data
- ./secrets/operator/db-password:/run/operator/db-password:ro
- ./infra/postgres/pg_hba.conf:/etc/postgresql/pg_hba.conf:ro
healthcheck:
test:
- CMD
- pg_isready
- -U
- postgres
- -d
- messenger
interval: 5s
timeout: 3s
retries: 30
cache:
read_only: true
security_opt: *id001
cap_drop: *id002
tmpfs: *id003
user: ${LOCAL_UID:-1000}:${LOCAL_GID:-1000}
restart: unless-stopped
cpus: '0.5'
mem_limit: 256m
networks:
private:
aliases:
- redis
image: valkey/valkey:8.1.10-alpine
command:
- valkey-server
- /etc/redis/redis.conf
volumes:
- ./certs/trust:/pki:ro
- ./certs/redis:/identity:ro
- ./infra/redis/redis.conf:/etc/redis/redis.conf:ro
- ./secrets/redis:/run/redis:ro
- ./secrets/state/redis:/data
healthcheck:
test:
- CMD-SHELL
- valkey-cli --tls --cacert /pki/ca.crt --cert /identity/redis.crt --key /identity/redis.key
-h redis PING 2>&1 | grep -q NOAUTH
interval: 5s
timeout: 3s
retries: 30
minio:
read_only: true
security_opt: *id001
cap_drop: *id002
tmpfs: *id003
user: ${LOCAL_UID:-1000}:${LOCAL_GID:-1000}
restart: unless-stopped
cpus: '0.5'
mem_limit: 512m
networks: *id004
build:
context: ./infra/minio
image: lab7-minio:local
command:
- server
- /data
- --certs-dir
- /identity
- --console-address
- 127.0.0.1:9001
environment:
MINIO_ROOT_USER_FILE: /run/operator/minio-user
MINIO_ROOT_PASSWORD_FILE: /run/operator/minio-password
MINIO_BROWSER: 'off'
volumes:
- ./certs/trust:/pki:ro
- ./certs/minio:/identity:ro
- ./secrets/operator/minio-user:/run/operator/minio-user:ro
- ./secrets/operator/minio-password:/run/operator/minio-password:ro
- ./secrets/state/minio:/data
healthcheck:
test:
- CMD
- curl
- --fail
- --cacert
- /pki/ca.crt
- https://minio:9000/minio/health/live
interval: 5s
timeout: 3s
retries: 30
start_period: 10s
openbao:
read_only: true
security_opt: *id001
cap_drop: *id002
tmpfs: *id003
user: ${LOCAL_UID:-1000}:${LOCAL_GID:-1000}
restart: unless-stopped
cpus: '0.5'
mem_limit: 256m
networks:
- private
- edge
image: openbao/openbao:2.2.2
entrypoint:
- bao
command:
- server
- -config=/bao/config/config.hcl
environment:
BAO_ADDR: https://localhost:8200
BAO_CACERT: /pki/ca.crt
ports:
- 127.0.0.1:${BAO_PORT:-8200}:8200
volumes:
- ./certs/trust:/pki:ro
- ./certs/openbao:/identity:ro
- ./infra/openbao/config.hcl:/bao/config/config.hcl:ro
- ./secrets/state/openbao:/bao/data
mc:
read_only: true
security_opt: *id001
cap_drop: *id002
tmpfs: *id003
user: ${LOCAL_UID:-1000}:${LOCAL_GID:-1000}
restart: 'no'
cpus: '0.5'
mem_limit: 256m
networks: *id004
build:
context: ./infra/mc
image: lab7-mc:local
profiles:
- operator
entrypoint:
- /bin/sh
- /operator-entrypoint.sh
command:
- -c
- sleep 3600
volumes:
- ./certs/trust:/pki:ro
- ./infra/mc/operator-entrypoint.sh:/operator-entrypoint.sh:ro
- ./secrets/operator/minio-user:/operator/minio-user:ro
- ./secrets/operator/minio-password:/operator/minio-password:ro
- ./secrets/operator/s3-api:/operator/s3-api:ro
- ./secrets/operator/s3-worker:/operator/s3-worker:ro
environment:
MC_CONFIG_DIR: /tmp/mc-user
otel-collector-tls:
read_only: true
security_opt: *id001
cap_drop: *id002
tmpfs: *id003
user: ${LOCAL_UID:-1000}:${LOCAL_GID:-1000}
restart: unless-stopped
cpus: '0.5'
mem_limit: 256m
networks:
private:
aliases:
- otel-collector
image: envoyproxy/envoy:v1.33.2
entrypoint:
- envoy
command:
- -c
- /etc/envoy/config.yaml
- --concurrency
- '1'
- --log-level
- warning
volumes:
- ./certs/trust:/pki:ro
- ./certs/otel-collector:/identity:ro
- ./infra/envoy/otel-collector.yaml:/etc/envoy/config.yaml:ro
otel-collector:
read_only: true
security_opt: *id001
cap_drop: *id002
tmpfs: *id003
user: ${LOCAL_UID:-1000}:${LOCAL_GID:-1000}
restart: unless-stopped
cpus: '0.5'
mem_limit: 256m
network_mode: service:otel-collector-tls
depends_on:
otel-collector-tls:
condition: service_started
volumes:
- ./certs/trust:/pki:ro
- ./certs/otel-collector:/identity:ro
- ./infra/otel/collector.yaml:/etc/otelcol/config.yaml:ro
image: otel/opentelemetry-collector-contrib:0.119.0
command:
- --config=/etc/otelcol/config.yaml
loki-tls:
read_only: true
security_opt: *id001
cap_drop: *id002
tmpfs: *id003
user: ${LOCAL_UID:-1000}:${LOCAL_GID:-1000}
restart: unless-stopped
cpus: '0.5'
mem_limit: 256m
networks: *id004
image: envoyproxy/envoy:v1.33.2
entrypoint:
- envoy
command:
- -c
- /etc/envoy/config.yaml
- --concurrency
- '1'
- --log-level
- warning
volumes:
- ./certs/trust:/pki:ro
- ./certs/loki:/identity:ro
- ./infra/envoy/loki.yaml:/etc/envoy/config.yaml:ro
loki:
read_only: true
security_opt: *id001
cap_drop: *id002
tmpfs: *id003
user: ${LOCAL_UID:-1000}:${LOCAL_GID:-1000}
restart: unless-stopped
cpus: '0.5'
mem_limit: 256m
network_mode: service:loki-tls
depends_on:
loki-tls:
condition: service_started
volumes:
- ./certs/trust:/pki:ro
- ./certs/loki:/identity:ro
- ./infra/loki/loki.yaml:/etc/loki/config.yaml:ro
- ./secrets/state/loki:/loki
image: grafana/loki:3.4.2
command:
- -config.file=/etc/loki/config.yaml
tempo-tls:
read_only: true
security_opt: *id001
cap_drop: *id002
tmpfs: *id003
user: ${LOCAL_UID:-1000}:${LOCAL_GID:-1000}
restart: unless-stopped
cpus: '0.5'
mem_limit: 256m
networks: *id004
image: envoyproxy/envoy:v1.33.2
entrypoint:
- envoy
command:
- -c
- /etc/envoy/config.yaml
- --concurrency
- '1'
- --log-level
- warning
volumes:
- ./certs/trust:/pki:ro
- ./certs/tempo:/identity:ro
- ./infra/envoy/tempo.yaml:/etc/envoy/config.yaml:ro
tempo:
read_only: true
security_opt: *id001
cap_drop: *id002
tmpfs: *id003
user: ${LOCAL_UID:-1000}:${LOCAL_GID:-1000}
restart: unless-stopped
cpus: '0.5'
mem_limit: 256m
network_mode: service:tempo-tls
depends_on:
tempo-tls:
condition: service_started
volumes:
- ./certs/trust:/pki:ro
- ./certs/tempo:/identity:ro
- ./infra/tempo/tempo.yaml:/etc/tempo/config.yaml:ro
- ./secrets/state/tempo:/var/tempo
image: grafana/tempo:2.7.2
command:
- -config.file=/etc/tempo/config.yaml
prometheus-tls:
read_only: true
security_opt: *id001
cap_drop: *id002
tmpfs: *id003
user: ${LOCAL_UID:-1000}:${LOCAL_GID:-1000}
restart: unless-stopped
cpus: '0.5'
mem_limit: 256m
networks: *id004
image: envoyproxy/envoy:v1.33.2
entrypoint:
- envoy
command:
- -c
- /etc/envoy/config.yaml
- --concurrency
- '1'
- --log-level
- warning
volumes:
- ./certs/trust:/pki:ro
- ./certs/prometheus:/identity:ro
- ./infra/envoy/prometheus.yaml:/etc/envoy/config.yaml:ro
prometheus:
read_only: true
security_opt: *id001
cap_drop: *id002
tmpfs: *id003
user: ${LOCAL_UID:-1000}:${LOCAL_GID:-1000}
restart: unless-stopped
cpus: '0.5'
mem_limit: 256m
network_mode: service:prometheus-tls
depends_on:
prometheus-tls:
condition: service_started
volumes:
- ./certs/trust:/pki:ro
- ./certs/prometheus:/identity:ro
- ./infra/prometheus/prometheus.yaml:/etc/prometheus/config.yaml:ro
- ./secrets/state/prometheus:/prometheus
- ./infra/prometheus/alerts.yaml:/etc/prometheus/alerts.yaml:ro
image: prom/prometheus:v3.2.1
command:
- --config.file=/etc/prometheus/config.yaml
- --web.listen-address=127.0.0.1:19090
grafana-tls:
read_only: true
security_opt: *id001
cap_drop: *id002
tmpfs: *id003
user: ${LOCAL_UID:-1000}:${LOCAL_GID:-1000}
restart: unless-stopped
cpus: '0.5'
mem_limit: 256m
networks:
- private
- edge
image: envoyproxy/envoy:v1.33.2
entrypoint:
- envoy
command:
- -c
- /etc/envoy/config.yaml
- --concurrency
- '1'
- --log-level
- warning
volumes:
- ./certs/trust:/pki:ro
- ./certs/grafana:/identity:ro
- ./infra/envoy/grafana.yaml:/etc/envoy/config.yaml:ro
ports:
- 127.0.0.1:${GRAFANA_PORT:-3000}:3000
grafana:
read_only: true
security_opt: *id001
cap_drop: *id002
tmpfs: *id003
user: ${LOCAL_UID:-1000}:${LOCAL_GID:-1000}
restart: unless-stopped
cpus: '0.5'
mem_limit: 256m
network_mode: service:grafana-tls
depends_on:
grafana-tls:
condition: service_started
volumes:
- ./certs/trust:/pki:ro
- ./certs/grafana:/identity:ro
- ./secrets/operator/grafana-password:/run/operator/grafana-password:ro
- ./secrets/state/grafana:/var/lib/grafana
- ./secrets/grafana-datasources:/etc/grafana/provisioning/datasources:ro
- ./infra/grafana/provisioning/dashboards:/etc/grafana/provisioning/dashboards:ro
- ./infra/grafana/dashboards:/var/lib/grafana/dashboards:ro
image: grafana/grafana:11.6.0
environment:
GF_SERVER_HTTP_ADDR: 127.0.0.1
GF_SERVER_HTTP_PORT: '13000'
GF_SECURITY_ADMIN_PASSWORD__FILE: /run/operator/grafana-password
GF_USERS_ALLOW_SIGN_UP: 'false'
GF_ANALYTICS_REPORTING_ENABLED: 'false'
GF_PLUGINS_PREINSTALL_DISABLED: 'true'
networks:
private:
internal: true
edge: {}