lab4 done
This commit is contained in:
+161
@@ -0,0 +1,161 @@
|
||||
name: mtusi2026lab4
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:17.6-alpine3.22
|
||||
environment:
|
||||
POSTGRES_USER: messenger
|
||||
POSTGRES_DB: messenger
|
||||
POSTGRES_PASSWORD_FILE: /run/secrets/postgres_password
|
||||
secrets:
|
||||
- postgres_password
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/data
|
||||
healthcheck:
|
||||
test: [CMD-SHELL, 'pg_isready -U messenger -d messenger']
|
||||
interval: 2s
|
||||
timeout: 2s
|
||||
retries: 30
|
||||
cpus: 1.0
|
||||
mem_limit: 512m
|
||||
redis:
|
||||
image: redis:7.4.5-alpine3.21
|
||||
command: [redis-server, /usr/local/etc/redis/redis.conf]
|
||||
volumes:
|
||||
- redis_data:/data
|
||||
- ./infra/redis.conf:/usr/local/etc/redis/redis.conf:ro
|
||||
healthcheck:
|
||||
test: [CMD, redis-cli, ping]
|
||||
interval: 2s
|
||||
timeout: 2s
|
||||
retries: 30
|
||||
cpus: 0.5
|
||||
mem_limit: 128m
|
||||
minio:
|
||||
image: mtusi-minio:RELEASE.2025-09-07T16-13-09Z
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile.storage
|
||||
target: minio
|
||||
secrets: [s3_root_access_key, s3_root_secret_key]
|
||||
volumes: [s3_data:/data]
|
||||
healthcheck:
|
||||
test: [CMD, wget, -q, -T, '2', -O, /dev/null, 'http://127.0.0.1:9000/minio/health/live']
|
||||
interval: 2s
|
||||
timeout: 3s
|
||||
start_period: 15s
|
||||
retries: 30
|
||||
cpus: 1.0
|
||||
mem_limit: 512m
|
||||
stop_grace_period: 20s
|
||||
s3_bootstrap:
|
||||
image: mtusi-mc:RELEASE.2025-08-13T08-35-41Z
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile.storage
|
||||
target: mc
|
||||
entrypoint: [/bin/sh, /bootstrap.sh]
|
||||
configs:
|
||||
- source: s3_bootstrap
|
||||
target: /bootstrap.sh
|
||||
- source: s3_policy
|
||||
target: /policy.json
|
||||
secrets: [s3_root_access_key, s3_root_secret_key, s3_access_key, s3_secret_key]
|
||||
depends_on:
|
||||
minio:
|
||||
condition: service_healthy
|
||||
cpus: 0.5
|
||||
mem_limit: 512m
|
||||
migrations:
|
||||
image: mtusi-migrations:lab4
|
||||
build:
|
||||
context: .
|
||||
target: migrations
|
||||
environment:
|
||||
GOOSE_DRIVER: postgres
|
||||
GOOSE_DBSTRING: host=postgres user=messenger dbname=messenger sslmode=disable connect_timeout=5
|
||||
POSTGRES_PASSWORD_FILE: /run/secrets/postgres_password
|
||||
secrets:
|
||||
- postgres_password
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
cpus: 0.5
|
||||
mem_limit: 128m
|
||||
api:
|
||||
build: .
|
||||
image: mtusi-messenger:lab4
|
||||
environment: &api_environment
|
||||
POSTGRES_HOST: postgres
|
||||
POSTGRES_USER: messenger
|
||||
POSTGRES_DB: messenger
|
||||
POSTGRES_PASSWORD_FILE: /run/secrets/postgres_password
|
||||
POSTGRES_MAX_CONNS: '10'
|
||||
REDIS_ADDR: redis:6379
|
||||
CURSOR_KEY_FILE: /run/secrets/cursor_key
|
||||
SESSION_TTL_SECONDS: ${SESSION_TTL_SECONDS:-3600}
|
||||
QUERY_TIMEOUT_MS: '2000'
|
||||
S3_ENDPOINT: minio:9000
|
||||
S3_BUCKET: attachments
|
||||
S3_ACCESS_KEY_FILE: /run/secrets/s3_access_key
|
||||
S3_SECRET_KEY_FILE: /run/secrets/s3_secret_key
|
||||
S3_USE_SSL: 'false'
|
||||
GOMEMLIMIT: 1152MiB
|
||||
GOGC: '50'
|
||||
secrets: &api_secrets
|
||||
- postgres_password
|
||||
- cursor_key
|
||||
- s3_access_key
|
||||
- s3_secret_key
|
||||
ports:
|
||||
- '127.0.0.1:${PORT:-8080}:8080'
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
redis:
|
||||
condition: service_healthy
|
||||
migrations:
|
||||
condition: service_completed_successfully
|
||||
s3_bootstrap:
|
||||
condition: service_completed_successfully
|
||||
cpus: 1.0
|
||||
mem_limit: 1536m
|
||||
stop_grace_period: 10s
|
||||
tests:
|
||||
image: mtusi-messenger-tests:lab4
|
||||
profiles: [test]
|
||||
build:
|
||||
context: .
|
||||
target: tests
|
||||
environment:
|
||||
<<: *api_environment
|
||||
INTEGRATION_TESTS: '1'
|
||||
secrets: *api_secrets
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
redis:
|
||||
condition: service_healthy
|
||||
cpus: 1.0
|
||||
mem_limit: 1g
|
||||
configs:
|
||||
s3_bootstrap:
|
||||
file: ./infra/s3-bootstrap.sh
|
||||
s3_policy:
|
||||
file: ./infra/s3-policy.json
|
||||
secrets:
|
||||
s3_root_access_key:
|
||||
file: ./secrets/s3_root_access_key
|
||||
s3_root_secret_key:
|
||||
file: ./secrets/s3_root_secret_key
|
||||
s3_access_key:
|
||||
file: ./secrets/s3_access_key
|
||||
s3_secret_key:
|
||||
file: ./secrets/s3_secret_key
|
||||
postgres_password:
|
||||
file: ./secrets/postgres_password
|
||||
cursor_key:
|
||||
file: ./secrets/cursor_key
|
||||
volumes:
|
||||
postgres_data:
|
||||
redis_data:
|
||||
s3_data:
|
||||
Reference in New Issue
Block a user