feat:level4

This commit is contained in:
Оля Мороз
2026-11-02 19:16:40 +03:00
parent 185f092f7a
commit ad9c28329c
19 changed files with 841 additions and 57 deletions
+55 -14
View File
@@ -2,20 +2,14 @@ x-api: &api
build:
context: .
dockerfile: Dockerfile
env_file: [.env]
environment:
APP_HOST: "0.0.0.0"
APP_PORT: "8080"
APP_ENV: "lab"
DATABASE_URL_FILE: /run/secrets/database_url
CACHE_URL_FILE: /run/secrets/cache_url
SESSION_STORE: "postgres"
SESSION_TTL_SECONDS: "3600"
# INSTANCE_ID сгенерируется в config.go
secrets: [database_url, cache_url]
env_file:
- .env
secrets: [database_url, cache_url, s3_access_key_id, s3_secret_access_key]
depends_on:
postgres: { condition: service_healthy }
redis: { condition: service_healthy }
s3: { condition: service_healthy }
s3-init: { condition: service_completed_successfully }
networks: [backend]
services:
@@ -47,6 +41,48 @@ services:
timeout: 3s
retries: 20
networks: [backend]
s3:
image: pgsty/silo:latest
command: ["server", "/data", "--console-address", ":9001"]
environment:
MINIO_ROOT_USER_FILE: /run/secrets/minio_root_user
MINIO_ROOT_PASSWORD_FILE: /run/secrets/minio_root_password
secrets: [minio_root_user, minio_root_password]
volumes: [s3data:/data]
healthcheck:
test: ["CMD", "mc", "ready", "local"]
interval: 5s
timeout: 3s
retries: 20
networks: [backend]
deploy:
resources:
limits: { cpus: "${S3_CPUS:-1.0}", memory: "${S3_MEM:-512M}" }
s3-init:
image: pgsty/silo:latest
depends_on:
s3: { condition: service_healthy }
environment:
MINIO_ROOT_USER_FILE: /run/secrets/minio_root_user
MINIO_ROOT_PASSWORD_FILE: /run/secrets/minio_root_password
S3_ACCESS_KEY_ID_FILE: /run/secrets/s3_access_key_id
S3_SECRET_ACCESS_KEY_FILE: /run/secrets/s3_secret_access_key
entrypoint: ["/bin/sh", "/bootstrap/bootstrap.sh"]
secrets:
- minio_root_user
- minio_root_password
- s3_access_key_id
- s3_secret_access_key
volumes:
- ./infra/minio/bootstrap.sh:/bootstrap/bootstrap.sh:ro
- /tmp/silo-init-data:/data
networks: [backend]
deploy:
replicas: 1
restart_policy: { condition: "no" }
api:
<<: *api
deploy:
@@ -78,12 +114,17 @@ services:
volumes:
pgdata:
redisdata:
s3data:
networks:
backend:
driver: bridge
secrets:
postgres_password: { file: ./secrets/postgres_password.txt }
database_url: { file: ./secrets/database_url.txt }
cache_url: { file: ./secrets/cache_url.txt }
postgres_password: { file: ./secrets/postgres_password.txt }
database_url: { file: ./secrets/database_url.txt }
cache_url: { file: ./secrets/cache_url.txt }
s3_access_key_id: { file: ./secrets/s3_access_key_id.txt }
s3_secret_access_key: { file: ./secrets/s3_secret_access_key.txt }
minio_root_user: { file: ./secrets/minio_root_user.txt }
minio_root_password: { file: ./secrets/minio_root_password.txt }