version: '3.8'

services:
  mariadb:
    image: mariadb:10.11
    container_name: debrideur_mariadb
    environment:
      MYSQL_ROOT_PASSWORD: ${DB_ROOT_PASSWORD:-root}
      MYSQL_DATABASE: ${DB_NAME:-debrideur}
      MYSQL_USER: ${DB_USER:-debrideur}
      MYSQL_PASSWORD: ${DB_PASSWORD:-debrideur}
    ports:
      - "${DB_PORT:-3306}:3306"
    volumes:
      - mariadb_data:/var/lib/mysql
    networks:
      - debrideur_net
    restart: unless-stopped

  redis:
    image: redis:7-alpine
    container_name: debrideur_redis
    ports:
      - "${REDIS_PORT:-6379}:6379"
    volumes:
      - redis_data:/data
    networks:
      - debrideur_net
    restart: unless-stopped

  qbittorrent:
    image: linuxserver/qbittorrent:latest
    container_name: debrideur_qbittorrent
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Europe/Budapest
      - WEBUI_PORT=8080
    ports:
      - "${QBITTORRENT_PORT:-8080}:8080"
      - "6881:6881"
      - "6881:6881/udp"
    volumes:
      - qbittorrent_config:/config
      - ${STORAGE_PATH:-./storage/downloads}:/downloads
    networks:
      - debrideur_net
    restart: unless-stopped
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:8080"]
      interval: 30s
      timeout: 10s
      retries: 3

volumes:
  mariadb_data:
  redis_data:
  qbittorrent_config:

networks:
  debrideur_net:
    driver: bridge
