119 lines
3.3 KiB
YAML
119 lines
3.3 KiB
YAML
# =============================================================================
|
|
# ToolsPlatform - Production Overlay: Resource Limits & Volumes
|
|
# =============================================================================
|
|
# Adds memory limits and reservations so no single container can starve others
|
|
# on an 8 GB host. Use with base + staging (or dev) for app services.
|
|
#
|
|
# Usage (staging/production):
|
|
# docker compose -f docker-compose.yml -f docker-compose.dev.yml -f docker-compose.staging.yml -f docker-compose.prod.yml --env-file ../.env.staging up -d
|
|
#
|
|
# Base volumes (docker-compose.yml) are already named and persistent; this file
|
|
# only adds deploy.resources. When you add Phase 10 (Prometheus, Grafana, Loki,
|
|
# Promtail, backup), add deploy.resources to those services too.
|
|
#
|
|
# Volumes (from base): postgres_data, redis_data, minio_data, keycloak_data,
|
|
# stirling_data, stirling_configs, imagor_data, rembg_models — all named and
|
|
# appropriate per image; no changes needed here.
|
|
# =============================================================================
|
|
|
|
services:
|
|
# ---------------------------------------------------------------------------
|
|
# INFRASTRUCTURE - Limits tuned for postgres:16-alpine, redis:7-alpine,
|
|
# minio/minio, keycloak (Java), and processing images.
|
|
# ---------------------------------------------------------------------------
|
|
postgres:
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
memory: 768M
|
|
reservations:
|
|
memory: 256M
|
|
|
|
redis:
|
|
command: redis-server --appendonly yes --maxmemory 400mb --maxmemory-policy allkeys-lru
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
memory: 512M
|
|
reservations:
|
|
memory: 128M
|
|
|
|
minio:
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
memory: 512M
|
|
reservations:
|
|
memory: 128M
|
|
|
|
keycloak:
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
memory: 1G
|
|
reservations:
|
|
memory: 512M
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# PROCESSING - Stirling (Java fat), Imagor (Go), Rembg (Python/ML),
|
|
# LanguageTool (Java 2g heap).
|
|
# ---------------------------------------------------------------------------
|
|
stirling-pdf:
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
memory: 1536M
|
|
reservations:
|
|
memory: 512M
|
|
|
|
imagor:
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
memory: 512M
|
|
reservations:
|
|
memory: 128M
|
|
|
|
rembg:
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
memory: 1280M
|
|
reservations:
|
|
memory: 512M
|
|
|
|
languagetool:
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
memory: 2048M
|
|
reservations:
|
|
memory: 512M
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# APPLICATION (when using dev + staging overlay: api-gateway, worker, frontend)
|
|
# ---------------------------------------------------------------------------
|
|
api-gateway:
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
memory: 1536M
|
|
reservations:
|
|
memory: 256M
|
|
|
|
worker:
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
memory: 512M
|
|
reservations:
|
|
memory: 256M
|
|
|
|
frontend:
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
memory: 512M
|
|
reservations:
|
|
memory: 256M
|