forked from mtusi2026/mtusi2026lab7
341 lines
8.2 KiB
YAML
341 lines
8.2 KiB
YAML
{
|
|
"services": {
|
|
"db": {
|
|
"image": "postgres:16-alpine",
|
|
"environment": {
|
|
"POSTGRES_USER": "messenger",
|
|
"POSTGRES_PASSWORD": "${DB_PASSWORD:?run setup}"
|
|
},
|
|
"volumes": [
|
|
"db:/var/lib/postgresql/data",
|
|
"./pg-start.sh:/pg-start.sh:ro",
|
|
"./pg_hba.conf:/etc/pg_hba.conf:ro",
|
|
"./.local/schema.sql:/docker-entrypoint-initdb.d/001.sql:ro",
|
|
"./.local/db.crt:/certs/db.crt:ro",
|
|
"./.local/db.key:/certs/db.key:ro"
|
|
],
|
|
"healthcheck": {
|
|
"test": [
|
|
"CMD",
|
|
"pg_isready",
|
|
"-h",
|
|
"127.0.0.1",
|
|
"-U",
|
|
"messenger"
|
|
],
|
|
"interval": "2s",
|
|
"timeout": "2s",
|
|
"retries": 30
|
|
},
|
|
"entrypoint": [
|
|
"sh",
|
|
"/pg-start.sh"
|
|
]
|
|
},
|
|
"api": {
|
|
"build": ".",
|
|
"restart": "unless-stopped",
|
|
"environment": {
|
|
"SERVICE_ROLE": "api",
|
|
"LAB": "7",
|
|
"S3_ENDPOINT": "https://objects:9443",
|
|
"AWS_CA_BUNDLE": "/certs/ca.crt",
|
|
"OTEL_EXPORTER_OTLP_ENDPOINT": "https://signals:4319",
|
|
"OTEL_EXPORTER_OTLP_CERTIFICATE": "/certs/ca.crt",
|
|
"SESSION_TTL_SECONDS": "${SESSION_TTL_SECONDS:-3600}"
|
|
},
|
|
"depends_on": [
|
|
"db",
|
|
"bao",
|
|
"api-gw"
|
|
],
|
|
"mem_limit": "320m",
|
|
"cpus": 1,
|
|
"cap_drop": [
|
|
"ALL"
|
|
],
|
|
"security_opt": [
|
|
"no-new-privileges:true"
|
|
],
|
|
"volumes": [
|
|
"./.local/ca.crt:/certs/ca.crt:ro",
|
|
"./.local/api-role.json:/run/role.json:ro"
|
|
],
|
|
"command": [
|
|
"python",
|
|
"boot.py",
|
|
"uvicorn",
|
|
"main:app",
|
|
"--host",
|
|
"127.0.0.1",
|
|
"--port",
|
|
"8080",
|
|
"--no-access-log"
|
|
],
|
|
"network_mode": "service:api-gw"
|
|
},
|
|
"api2": {
|
|
"build": ".",
|
|
"restart": "unless-stopped",
|
|
"environment": {
|
|
"SERVICE_ROLE": "api",
|
|
"LAB": "7",
|
|
"S3_ENDPOINT": "https://objects:9443",
|
|
"AWS_CA_BUNDLE": "/certs/ca.crt",
|
|
"OTEL_EXPORTER_OTLP_ENDPOINT": "https://signals:4319",
|
|
"OTEL_EXPORTER_OTLP_CERTIFICATE": "/certs/ca.crt",
|
|
"SESSION_TTL_SECONDS": "${SESSION_TTL_SECONDS:-3600}"
|
|
},
|
|
"depends_on": [
|
|
"db",
|
|
"bao",
|
|
"api2-gw"
|
|
],
|
|
"mem_limit": "320m",
|
|
"cpus": 1,
|
|
"cap_drop": [
|
|
"ALL"
|
|
],
|
|
"security_opt": [
|
|
"no-new-privileges:true"
|
|
],
|
|
"volumes": [
|
|
"./.local/ca.crt:/certs/ca.crt:ro",
|
|
"./.local/api-role.json:/run/role.json:ro"
|
|
],
|
|
"command": [
|
|
"python",
|
|
"boot.py",
|
|
"uvicorn",
|
|
"main:app",
|
|
"--host",
|
|
"127.0.0.1",
|
|
"--port",
|
|
"8080",
|
|
"--no-access-log"
|
|
],
|
|
"network_mode": "service:api2-gw"
|
|
},
|
|
"lb": {
|
|
"image": "haproxy:3.0-alpine",
|
|
"volumes": [
|
|
"./haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro",
|
|
"./.local/ca.crt:/certs/ca.crt:ro",
|
|
"./.local/ingress.pem:/certs/ingress.pem:ro",
|
|
"./.local/balancer.pem:/certs/balancer.pem:ro"
|
|
],
|
|
"mem_limit": "128m",
|
|
"command": [
|
|
"haproxy",
|
|
"-W",
|
|
"-db",
|
|
"-f",
|
|
"/usr/local/etc/haproxy/haproxy.cfg"
|
|
],
|
|
"ports": [
|
|
"127.0.0.1:${PORT:-8443}:8443"
|
|
],
|
|
"depends_on": [
|
|
"api-gw",
|
|
"api2-gw"
|
|
]
|
|
},
|
|
"s3": {
|
|
"volumes": [
|
|
"objects:/data",
|
|
"./.local/s3-secure.json:/config/access.json:ro"
|
|
],
|
|
"image": "chrislusf/seaweedfs:4.00",
|
|
"command": [
|
|
"server",
|
|
"-dir=/data",
|
|
"-ip=127.0.0.1",
|
|
"-ip.bind=127.0.0.1",
|
|
"-s3",
|
|
"-s3.port=9000",
|
|
"-s3.config=/config/access.json",
|
|
"-master.volumeSizeLimitMB=64",
|
|
"-volume.max=50"
|
|
],
|
|
"network_mode": "service:objects",
|
|
"depends_on": [
|
|
"objects"
|
|
],
|
|
"environment": {
|
|
"GOMAXPROCS": "2"
|
|
}
|
|
},
|
|
"worker": {
|
|
"build": ".",
|
|
"restart": "unless-stopped",
|
|
"environment": {
|
|
"SERVICE_ROLE": "worker",
|
|
"LAB": "7",
|
|
"S3_ENDPOINT": "https://objects:9443",
|
|
"AWS_CA_BUNDLE": "/certs/ca.crt",
|
|
"OTEL_EXPORTER_OTLP_ENDPOINT": "https://signals:4319",
|
|
"OTEL_EXPORTER_OTLP_CERTIFICATE": "/certs/ca.crt",
|
|
"SESSION_TTL_SECONDS": "${SESSION_TTL_SECONDS:-3600}"
|
|
},
|
|
"depends_on": [
|
|
"db",
|
|
"bao"
|
|
],
|
|
"command": [
|
|
"python",
|
|
"boot.py",
|
|
"python",
|
|
"worker.py"
|
|
],
|
|
"mem_limit": "320m",
|
|
"cpus": 1,
|
|
"cap_drop": [
|
|
"ALL"
|
|
],
|
|
"security_opt": [
|
|
"no-new-privileges:true"
|
|
],
|
|
"volumes": [
|
|
"./.local/ca.crt:/certs/ca.crt:ro",
|
|
"./.local/worker-role.json:/run/role.json:ro"
|
|
]
|
|
},
|
|
"telemetry": {
|
|
"image": "grafana/otel-lgtm:0.11.11",
|
|
"ports": [
|
|
"127.0.0.1:${GRAFANA_PORT:-3007}:3000"
|
|
],
|
|
"volumes": [
|
|
"signals:/data",
|
|
"./dashboard.yaml:/otel-lgtm/grafana/conf/provisioning/dashboards/messenger.yaml:ro",
|
|
"./dashboard.json:/opt/messenger-dashboards/messenger.json:ro",
|
|
"./collector.yaml:/otel-lgtm/otelcol-config.yaml:ro",
|
|
"./tempo.yaml:/otel-lgtm/tempo-config.yaml:ro",
|
|
"./loki.yaml:/otel-lgtm/loki-config.yaml:ro",
|
|
"./.local/signals.crt:/certs/signals.crt:ro",
|
|
"./.local/signals.key:/certs/signals.key:ro"
|
|
],
|
|
"networks": [
|
|
"monitor"
|
|
],
|
|
"environment": {
|
|
"GOMAXPROCS": "2"
|
|
}
|
|
},
|
|
"api-gw": {
|
|
"image": "haproxy:3.0-alpine",
|
|
"volumes": [
|
|
"./api-gw.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro",
|
|
"./.local/ca.crt:/certs/ca.crt:ro",
|
|
"./.local/api.pem:/certs/api.pem:ro"
|
|
],
|
|
"mem_limit": "128m",
|
|
"command": [
|
|
"haproxy",
|
|
"-W",
|
|
"-db",
|
|
"-f",
|
|
"/usr/local/etc/haproxy/haproxy.cfg"
|
|
]
|
|
},
|
|
"api2-gw": {
|
|
"image": "haproxy:3.0-alpine",
|
|
"volumes": [
|
|
"./api2-gw.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro",
|
|
"./.local/ca.crt:/certs/ca.crt:ro",
|
|
"./.local/api2.pem:/certs/api2.pem:ro"
|
|
],
|
|
"mem_limit": "128m",
|
|
"command": [
|
|
"haproxy",
|
|
"-W",
|
|
"-db",
|
|
"-f",
|
|
"/usr/local/etc/haproxy/haproxy.cfg"
|
|
]
|
|
},
|
|
"objects": {
|
|
"image": "haproxy:3.0-alpine",
|
|
"volumes": [
|
|
"./objects.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro",
|
|
"./.local/ca.crt:/certs/ca.crt:ro",
|
|
"./.local/objects.pem:/certs/objects.pem:ro"
|
|
],
|
|
"mem_limit": "128m",
|
|
"command": [
|
|
"haproxy",
|
|
"-W",
|
|
"-db",
|
|
"-f",
|
|
"/usr/local/etc/haproxy/haproxy.cfg"
|
|
]
|
|
},
|
|
"queue": {
|
|
"image": "redis:7.4-alpine",
|
|
"command": [
|
|
"redis-server",
|
|
"/config/redis.conf"
|
|
],
|
|
"volumes": [
|
|
"queue:/data",
|
|
"./.local/redis.conf:/config/redis.conf:ro",
|
|
"./.local/ca.crt:/certs/ca.crt:ro",
|
|
"./.local/queue.crt:/certs/queue.crt:ro",
|
|
"./.local/queue.key:/certs/queue.key:ro"
|
|
]
|
|
},
|
|
"signals": {
|
|
"image": "haproxy:3.0-alpine",
|
|
"volumes": [
|
|
"./signals.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro",
|
|
"./.local/ca.crt:/certs/ca.crt:ro",
|
|
"./.local/signals.pem:/certs/signals.pem:ro"
|
|
],
|
|
"mem_limit": "128m",
|
|
"command": [
|
|
"haproxy",
|
|
"-W",
|
|
"-db",
|
|
"-f",
|
|
"/usr/local/etc/haproxy/haproxy.cfg"
|
|
],
|
|
"networks": [
|
|
"default",
|
|
"monitor"
|
|
]
|
|
},
|
|
"bao": {
|
|
"image": "openbao/openbao:2.3.2",
|
|
"entrypoint": [
|
|
"bao"
|
|
],
|
|
"command": [
|
|
"server",
|
|
"-config=/bao/config/server.hcl"
|
|
],
|
|
"volumes": [
|
|
"vault:/bao/file",
|
|
"./bao.hcl:/bao/config/server.hcl:ro",
|
|
"./.local/bao.crt:/certs/bao.crt:ro",
|
|
"./.local/bao.key:/certs/bao.key:ro"
|
|
],
|
|
"ports": [
|
|
"127.0.0.1:${BAO_PORT:-18200}:8200"
|
|
]
|
|
}
|
|
},
|
|
"volumes": {
|
|
"db": {},
|
|
"objects": {},
|
|
"queue": {},
|
|
"signals": {},
|
|
"vault": {}
|
|
},
|
|
"networks": {
|
|
"default": {},
|
|
"monitor": {
|
|
"internal": true
|
|
}
|
|
}
|
|
}
|