Files
mtusi2026lab4/compose.yaml

136 lines
4.0 KiB
YAML

name: vp-lab4-medvedev
x-api: &api
image: vp-medvedev-lab4:local
build: .
cpus: ${API_CPUS:-1}
mem_limit: ${API_MEMORY:-2g}
deploy:
replicas: ${API_REPLICAS:-2}
stop_grace_period: 10s
environment:
APP_PORT: 8080
SESSION_TTL_SECONDS: ${SESSION_TTL_SECONDS:-3600}
PG_MAX_CONNS: ${PG_MAX_CONNS:-8}
GOMEMLIMIT: ${GO_MEMORY_LIMIT:-1536MiB}
secrets: [database_url, cache_url, s3_credentials]
depends_on:
migrate: {condition: service_completed_successfully}
valkey: {condition: service_started}
bootstrap-s3: {condition: service_completed_successfully}
networks: [private]
services:
image-memory:
image: vp-medvedev-lab4:local
profiles: [tools]
entrypoint: [/image-memory.test]
command: [-test.v,-test.run,TestWorstCaseImagesWithinBudget,-test.timeout,120s]
environment:
RUN_IMAGE_STRESS: '1'
GOMEMLIMIT: 1536MiB
cpus: 2
mem_limit: 2g
integration:
image: vp-medvedev-lab4:local
profiles: [tools]
entrypoint: [/integration.test]
command: [-test.v,-test.run,'Test(ReconciliationAgainstPostgresAndPrivateS3|S3InventoryAndStatReturnComparableVersionMetadata|FixtureCleanupRejectsForeignMembership)',-test.timeout,150s]
environment:
RUN_ISOLATED_RECONCILIATION: '1'
cpus: 0.5
mem_limit: 512m
secrets: [database_url,s3_credentials]
networks: [private]
fixture-cleanup:
image: vp-medvedev-lab4:local
profiles: [tools]
entrypoint: [/fixture-cleanup]
secrets: [database_url,s3_credentials]
networks: [private]
postgres:
image: postgres:18.6@sha256:74935e72241653ca55e0414067e6d8763aceb8a810eb51b452253ec3dcfc4336
cpus: 2
mem_limit: 768m
environment:
POSTGRES_USER: messenger
POSTGRES_DB: messenger
POSTGRES_PASSWORD_FILE: /run/secrets/pg_password
secrets: [pg_password]
volumes: [postgres:/var/lib/postgresql]
healthcheck:
test: [CMD-SHELL, pg_isready -U messenger -d messenger]
interval: 2s
timeout: 2s
retries: 30
networks: [private]
valkey:
image: valkey/valkey:9@sha256:418652cfb58ef879d4978c33553735d7147016032d5aefaa14c828e611eb9dfd
cpus: 0.25
mem_limit: 128m
command: [valkey-server, /run/secrets/valkey_conf]
secrets: [valkey_conf]
volumes: [valkey:/data]
networks: [private]
migrate:
image: vp-medvedev-lab4:local
build: .
command: [-migrate]
cpus: 0.5
mem_limit: 256m
secrets: [database_url]
depends_on:
postgres: {condition: service_healthy}
networks: [private]
api:
<<: *api
lb:
image: haproxy:3.2-alpine@sha256:1c3568e520453cc8ba98c39501febcf450429c80e6cc27ecad779961d76e597c
cpus: 0.5
mem_limit: 128m
ports: ['127.0.0.1:${PUBLIC_PORT:-28204}:8080']
volumes: ['./config/haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro']
depends_on:
api: {condition: service_started}
networks: [private]
s3:
image: rustfs/rustfs:1.0.0-rc.1@sha256:f53d700fc16809070326f6ab3fb565d48e722364a7bd5a12e47d0a5abe079ce6
cpus: 1
mem_limit: 768m
environment:
RUSTFS_ACCESS_KEY_FILE: /run/secrets/s3_access
RUSTFS_SECRET_KEY_FILE: /run/secrets/s3_secret
RUSTFS_VOLUMES: /data
RUSTFS_CONSOLE_ENABLE: 'false'
secrets: [s3_access,s3_secret]
volumes: [s3:/data]
healthcheck:
test: [CMD,curl,-f,http://127.0.0.1:9000/health]
interval: 2s
timeout: 2s
retries: 40
networks: [private]
bootstrap-s3:
image: vp-medvedev-lab4:local
build: .
command: [-bootstrap-s3]
cpus: 0.5
mem_limit: 256m
secrets: [database_url,s3_root,s3_credentials]
depends_on:
s3: {condition: service_healthy}
networks: [private]
volumes:
postgres:
valkey:
s3:
networks:
private:
secrets:
pg_password: {file: .local/pg_password}
database_url: {file: .local/database_url}
cache_url: {file: .local/cache_url}
valkey_conf: {file: .local/valkey.conf}
s3_access: {file: .local/s3_access}
s3_secret: {file: .local/s3_secret}
s3_root: {file: .local/s3_root}
s3_credentials: {file: .local/s3_credentials}