homelab-codex-ws/hosts/piha/runtime/paperless/docker-compose.override.yml

42 lines
1.6 KiB
YAML
Raw Normal View History

# PIHA-specific overrides for paperless (KB module 2).
#
# RESOURCE CONTEXT: PIHA is the RAM-bound 8 GB box shared with Home Assistant
# and monitoring. Precondition for this service is KB module 0 (piha-slim);
# after it ~3.8 Gi should be available. Ceilings below keep the whole stack
# ≤ ~1.9 Gi worst-case so paperless can never starve HA — the cgroup OOM
# killer restarts the offending container instead of the host killer picking
# a victim.
services:
paperless:
# Idle expectation ~400600 Mi (gunicorn + consumer + beat + 1 celery
# worker). The ceiling leaves room for the concurrency-1 FALLBACK OCR of
# a large PDF when SOLARIA is asleep; a pathological document gets the
# container restarted rather than the host swapping.
mem_limit: 1400m
mem_reservation: 512m
db:
# Metadata-only DB (documents live on disk, not in Postgres). Same tuning
# philosophy as kb-postgres but smaller: bounded backends because the
# SOLARIA worker also holds connections (concurrency 4 + webserver pool).
mem_limit: 384m
command:
- "postgres"
- "-c"
- "shared_buffers=96MB"
- "-c"
- "effective_cache_size=256MB"
- "-c"
- "work_mem=4MB"
- "-c"
- "maintenance_work_mem=32MB"
- "-c"
- "max_connections=50"
broker:
# Task payloads are tiny (paths + ids): even the 70k-attachment backlog
# is ~tens of MB in-queue. NO maxmemory/eviction — evicting broker keys
# would silently drop queued OCR tasks; if the limit is ever hit the
# container restarts and recovers the queue from AOF instead.
mem_limit: 256m