Ctrl K
ComunidadGuías…

docker-compose.redis.yml

Rama master · réplica de lectura del repositorio original.

Archivo original ↗Preguntar a KiBot
# Sublarr — Redis + RQ Worker stack
#
# Usage:
#   docker compose -f docker-compose.redis.yml up -d
#
# Enables persistent job queuing and Redis caching.
# The rq-worker service dequeues and executes translation jobs.
#
# Scale workers (e.g. for parallel translation):
#   docker compose -f docker-compose.redis.yml up -d --scale rq-worker=3
#
# Combine with PostgreSQL:
#   docker compose -f docker-compose.postgres.yml -f docker-compose.redis.yml up -d
#
# See docs/REDIS.md for full setup instructions.

services:
  redis:
    image: redis:7-alpine
    container_name: sublarr-redis
    # No persistence needed — job queue survives short Redis restarts via retry
    command: redis-server --save "" --appendonly no --maxmemory 256mb --maxmemory-policy allkeys-lru
    healthcheck:
      test: ["CMD", "redis-cli", "ping"]
      interval: 10s
      timeout: 5s
      retries: 5
      start_period: 10s
    restart: unless-stopped
    security_opt:
      - no-new-privileges:true
    logging:
      driver: "json-file"
      options:
        max-size: "5m"
        max-file: "2"

  sublarr:
    image: ghcr.io/abrechen2/sublarr:${VERSION:-latest}
    build:
      context: .
      args:
        VERSION: ${VERSION:-dev}
        PUID: ${PUID:-1000}
        PGID: ${PGID:-1000}
    container_name: sublarr
    depends_on:
      redis:
        condition: service_healthy
    ports:
      - "127.0.0.1:${SUBLARR_PORT:-5765}:5765"
    volumes:
      - ./config:/config
      - ${SUBLARR_MEDIA_PATH:-/media}:/media:rw
    environment:
      SUBLARR_REDIS_URL: redis://redis:6379/0
      SUBLARR_REDIS_QUEUE_ENABLED: "true"
      SUBLARR_REDIS_CACHE_ENABLED: "true"
    read_only: true
    tmpfs:
      - /tmp
    restart: unless-stopped
    deploy:
      resources:
        limits:
          cpus: '2.0'
          memory: 4G
        reservations:
          cpus: '0.5'
          memory: 512M
    security_opt:
      - no-new-privileges:true
    cap_drop:
      - ALL
    cap_add:
      - CHOWN
      - DAC_OVERRIDE
    logging:
      driver: "json-file"
      options:
        max-size: "10m"
        max-file: "3"

  rq-worker:
    image: ghcr.io/abrechen2/sublarr:${VERSION:-latest}
    build:
      context: .
      args:
        VERSION: ${VERSION:-dev}
        PUID: ${PUID:-1000}
        PGID: ${PGID:-1000}
    command: ["python", "worker.py"]
    healthcheck:
      test: ["CMD", "python", "worker_health.py"]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 30s
    depends_on:
      redis:
        condition: service_healthy
    volumes:
      - ./config:/config
      - ${SUBLARR_MEDIA_PATH:-/media}:/media:rw
    environment:
      SUBLARR_REDIS_URL: redis://redis:6379/0
    read_only: true
    tmpfs:
      - /tmp
    restart: unless-stopped
    deploy:
      resources:
        limits:
          cpus: '4.0'
          memory: 8G
        reservations:
          cpus: '1.0'
          memory: 1G
    security_opt:
      - no-new-privileges:true
    cap_drop:
      - ALL
    cap_add:
      - CHOWN
      - DAC_OVERRIDE
    logging:
      driver: "json-file"
      options:
        max-size: "10m"
        max-file: "3"