add level 3

This commit is contained in:
Матвей
2026-10-20 17:24:32 +03:00
parent 3b52b91fb7
commit e9ef559c34
33 changed files with 1138 additions and 96 deletions
+59 -2
View File
@@ -9,10 +9,20 @@ x-api: &api
SESSION_TTL_SECONDS: ${SESSION_TTL_SECONDS:-3600}
IDEMPOTENCY_TTL_SECONDS: ${IDEMPOTENCY_TTL_SECONDS:-86400}
CURSOR_SECRET_FILE: /run/secrets/cursor_secret
S3_ENDPOINT: http://s3:8333
S3_BUCKET: messenger-attachments
S3_ACCESS_KEY_ID_FILE: /run/secrets/s3_access_key_id
S3_SECRET_ACCESS_KEY_FILE: /run/secrets/s3_secret_access_key
MAX_UPLOAD_BYTES: "10485760"
MAX_IMAGE_PIXELS: "40000000"
secrets:
- database_url
- cursor_secret
- s3_access_key_id
- s3_secret_access_key
depends_on:
s3-init:
condition: service_completed_successfully
migrate:
condition: service_completed_successfully
expose:
@@ -28,9 +38,45 @@ x-api: &api
resources:
limits:
cpus: "0.50"
memory: 256M
memory: 512M
services:
s3:
image: chrislusf/seaweedfs:4.17@sha256:186de7ef977a20343ee9a5544073f081976a29e2d29ecf8379891e7bf177fbe9
command: ["server", "-dir=/data", "-ip=s3", "-ip.bind=0.0.0.0", "-s3", "-s3.config=/run/secrets/s3_config", "-master.volumeSizeLimitMB=128", "-volume.max=8", "-s3.port.iceberg=0", "-filer.exposeDirectoryData=false"]
secrets:
- s3_config
volumes:
- s3_data:/data
- ./infra/filer.toml:/etc/seaweedfs/filer.toml:ro
healthcheck:
test: ["CMD", "wget", "-q", "-O", "/dev/null", "http://localhost:9333/cluster/status"]
interval: 5s
timeout: 3s
retries: 20
deploy:
resources:
limits:
cpus: "1.0"
memory: 512M
s3-init:
build:
context: .
command: ["/app/.venv/bin/python", "-m", "src.bootstrap_s3"]
environment:
S3_ENDPOINT: http://s3:8333
S3_BUCKET: messenger-attachments
S3_ACCESS_KEY_ID_FILE: /run/secrets/s3_admin_key
S3_SECRET_ACCESS_KEY_FILE: /run/secrets/s3_admin_secret
secrets:
- s3_admin_key
- s3_admin_secret
depends_on:
s3:
condition: service_healthy
restart: "no"
postgres:
image: postgres:17.6-alpine
environment:
@@ -82,7 +128,7 @@ services:
load_balancer:
image: haproxy:3.0.11-alpine
ports:
- "8080:8080"
- "127.0.0.1:8080:8080"
volumes:
- ./infra/haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro
depends_on:
@@ -103,6 +149,16 @@ services:
memory: 128M
secrets:
s3_config:
file: ./secrets/s3.json
s3_admin_key:
file: ./secrets/s3_admin_key
s3_admin_secret:
file: ./secrets/s3_admin_secret
s3_access_key_id:
file: ./secrets/s3_access_key_id
s3_secret_access_key:
file: ./secrets/s3_secret_access_key
postgres_password:
file: ./secrets/postgres_password
database_url:
@@ -111,4 +167,5 @@ secrets:
file: ./secrets/cursor_secret
volumes:
s3_data:
postgres_data: