227 lines
7.8 KiB
YAML
227 lines
7.8 KiB
YAML
# =============================================================================
|
|
# ToolsPlatform - Base Docker Compose Configuration
|
|
# =============================================================================
|
|
# This file defines all services WITHOUT exposed ports.
|
|
# Use docker-compose.dev.yml overlay for local development port exposure.
|
|
# Use docker-compose.prod.yml overlay for production configuration.
|
|
# =============================================================================
|
|
|
|
services:
|
|
# ===========================================================================
|
|
# INFRASTRUCTURE SERVICES
|
|
# ===========================================================================
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# PostgreSQL - Primary Database
|
|
# ---------------------------------------------------------------------------
|
|
postgres:
|
|
image: postgres:16-alpine
|
|
container_name: toolsplatform-postgres
|
|
restart: unless-stopped
|
|
environment:
|
|
POSTGRES_DB: ${DB_NAME}
|
|
POSTGRES_USER: ${DB_USER}
|
|
POSTGRES_PASSWORD: ${DB_PASSWORD}
|
|
volumes:
|
|
- postgres_data:/var/lib/postgresql/data
|
|
networks:
|
|
- backend
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U ${DB_USER} -d ${DB_NAME}"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
start_period: 10s
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Redis - Cache, Sessions, and Job Queue
|
|
# ---------------------------------------------------------------------------
|
|
redis:
|
|
image: redis:7-alpine
|
|
container_name: toolsplatform-redis
|
|
restart: unless-stopped
|
|
command: redis-server --appendonly yes
|
|
volumes:
|
|
- redis_data:/data
|
|
networks:
|
|
- backend
|
|
healthcheck:
|
|
test: ["CMD", "redis-cli", "ping"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
start_period: 5s
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# MinIO - S3-Compatible Object Storage
|
|
# ---------------------------------------------------------------------------
|
|
minio:
|
|
image: minio/minio:latest
|
|
container_name: toolsplatform-minio
|
|
restart: unless-stopped
|
|
command: server /data --console-address ":9001"
|
|
ports:
|
|
- "9000:9000"
|
|
- "9001:9001"
|
|
environment:
|
|
MINIO_ROOT_USER: ${MINIO_ACCESS_KEY}
|
|
MINIO_ROOT_PASSWORD: ${MINIO_SECRET_KEY}
|
|
volumes:
|
|
- minio_data:/data
|
|
networks:
|
|
- backend
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
|
|
interval: 30s
|
|
timeout: 20s
|
|
retries: 3
|
|
start_period: 10s
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Keycloak - Identity and Access Management
|
|
# ---------------------------------------------------------------------------
|
|
keycloak:
|
|
image: quay.io/keycloak/keycloak:latest
|
|
container_name: toolsplatform-keycloak
|
|
restart: unless-stopped
|
|
environment:
|
|
KEYCLOAK_ADMIN: ${KEYCLOAK_ADMIN}
|
|
KEYCLOAK_ADMIN_PASSWORD: ${KEYCLOAK_ADMIN_PASSWORD}
|
|
KC_DB: postgres
|
|
KC_DB_URL: jdbc:postgresql://postgres:5432/${DB_NAME}
|
|
KC_DB_USERNAME: ${DB_USER}
|
|
KC_DB_PASSWORD: ${DB_PASSWORD}
|
|
volumes:
|
|
- keycloak_data:/opt/keycloak/data
|
|
networks:
|
|
- backend
|
|
- frontend
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
|
|
# Tesseract OCR is installed in the worker image for image-ocr.
|
|
# ===========================================================================
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Stirling-PDF - PDF Processing (40+ tools). latest-fat = extra formats/tools.
|
|
# ---------------------------------------------------------------------------
|
|
stirling-pdf:
|
|
image: stirlingtools/stirling-pdf:latest-fat
|
|
container_name: toolsplatform-stirling
|
|
restart: unless-stopped
|
|
ports:
|
|
- "8090:8080"
|
|
environment:
|
|
SECURITY_ENABLELOGIN: "false"
|
|
SECURITY_CUSTOMGLOBALAPIKEY: "dev-api-key-change-in-production"
|
|
INSTALL_BOOK_AND_ADVANCED_HTML_OPS: "true"
|
|
# UI languages (incl. Arabic). For OCR in Arabic, add ara.traineddata to stirling_data volume.
|
|
LANGS: "en_GB,fr_FR,ar_AR"
|
|
# Max file/request size (see docs/stirling-pdf-docker-options.md). 500 MB covers PRO tier (200 MB) with headroom.
|
|
SYSTEM_MAXFILESIZE: "500"
|
|
SPRING_SERVLET_MULTIPART_MAX_FILE_SIZE: "500MB"
|
|
SPRING_SERVLET_MULTIPART_MAX_REQUEST_SIZE: "500MB"
|
|
volumes:
|
|
- stirling_data:/usr/share/tessdata
|
|
- stirling_configs:/configs
|
|
networks:
|
|
- processing
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Imagor - Image Processing and Optimization
|
|
# ---------------------------------------------------------------------------
|
|
imagor:
|
|
image: shumc/imagor:latest
|
|
container_name: toolsplatform-imagor
|
|
restart: unless-stopped
|
|
environment:
|
|
IMAGOR_UNSAFE: "1"
|
|
UPLOAD_LOADER_ENABLE: "1"
|
|
# Default is 32MB; raise to 64MB so large PNGs (e.g. 43MB) can be converted (Imagor returns 400 "maximum size exceeded" otherwise)
|
|
UPLOAD_LOADER_MAX_ALLOWED_SIZE: "67108864"
|
|
IMAGOR_AUTO_WEBP: "1"
|
|
IMAGOR_RESULT_STORAGE_PATH: "/tmp/imagor"
|
|
volumes:
|
|
- imagor_data:/tmp/imagor
|
|
networks:
|
|
- processing
|
|
# Backend network so Imagor can fetch watermark images from MinIO (image-watermark tool)
|
|
- backend
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Rembg - AI Background Removal
|
|
# Pre-downloads models (u2net, u2netp, u2net_human_seg, isnet-general-use) on
|
|
# startup; birefnet-general omitted (large, often OOM/timeout in typical Docker).
|
|
# ---------------------------------------------------------------------------
|
|
rembg:
|
|
image: danielgatis/rembg
|
|
container_name: toolsplatform-rembg
|
|
restart: unless-stopped
|
|
entrypoint: ["/bin/sh", "-c"]
|
|
command:
|
|
- |
|
|
set -e
|
|
echo "Pre-downloading rembg models to /root/.u2net ..."
|
|
rembg d u2net u2netp u2net_human_seg isnet-general-use
|
|
echo "Starting rembg server on port 7000 ..."
|
|
exec rembg s --host 0.0.0.0 --port 7000
|
|
volumes:
|
|
- rembg_models:/root/.u2net
|
|
networks:
|
|
- processing
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "curl -sf http://localhost:7000/ || exit 1"]
|
|
interval: 15s
|
|
timeout: 5s
|
|
retries: 5
|
|
start_period: 600s
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# LanguageTool - Grammar and Spell Checking
|
|
# ---------------------------------------------------------------------------
|
|
languagetool:
|
|
image: erikvl87/languagetool
|
|
container_name: toolsplatform-languagetool
|
|
restart: unless-stopped
|
|
environment:
|
|
Java_Xms: "512m"
|
|
Java_Xmx: "2g"
|
|
networks:
|
|
- processing
|
|
|
|
# =============================================================================
|
|
# NETWORKS
|
|
# =============================================================================
|
|
networks:
|
|
backend:
|
|
name: toolsplatform-backend
|
|
driver: bridge
|
|
frontend:
|
|
name: toolsplatform-frontend
|
|
driver: bridge
|
|
processing:
|
|
name: toolsplatform-processing
|
|
driver: bridge
|
|
|
|
# =============================================================================
|
|
# VOLUMES
|
|
# =============================================================================
|
|
volumes:
|
|
postgres_data:
|
|
name: toolsplatform-postgres-data
|
|
redis_data:
|
|
name: toolsplatform-redis-data
|
|
minio_data:
|
|
name: toolsplatform-minio-data
|
|
keycloak_data:
|
|
name: toolsplatform-keycloak-data
|
|
stirling_data:
|
|
name: toolsplatform-stirling-data
|
|
stirling_configs:
|
|
name: toolsplatform-stirling-configs
|
|
imagor_data:
|
|
name: toolsplatform-imagor-data
|
|
rembg_models:
|
|
name: toolsplatform-rembg-models
|