services:
  db:
    image: mariadb:10.6
    restart: always
    command: --transaction-isolation=READ-COMMITTED --log-bin=binlog --binlog-format=ROW
    volumes:
      - /mnt/8T/nextcloud/db:/var/lib/mysql
    environment:
      - MYSQL_ROOT_PASSWORD=
      - MYSQL_PASSWORD=
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud

  redis:
    image: redis:alpine
    restart: always
    networks:
      - redisnet
    expose:
      - 6379

  nextcloud:
    image: nextcloud
    restart: always
    depends_on:
      - db
      - redis
    links:
      - db
    volumes:
      - /mnt/8T/nextcloud/html:/var/www/html
    environment:
      - REDIS_HOST=redis
      - MYSQL_PASSWORD=
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud
      - MYSQL_HOST=db
      - PHP_MEMORY_LIMIT=1024M
      - PHP_UPLOAD_LIMIT=1024M
    networks:
      redisnet:
      default:
      NPM:
        ipv4_address: 10.5.0.5

  qbittorrent:
    image: lscr.io/linuxserver/qbittorrent:latest
    container_name: qbittorrent
    networks:
      NPM:
        ipv4_address: 10.5.0.2
      qb-ipv6:
        ipv6_address: 2001:3200:3200::20
    environment:
      - PUID=1000
      - PGID=1000
      - WEBUI_PORT=80
    deploy:
      resources:
        limits:
          cpus: '1.0'
          memory: 1G
    volumes:
      - /mnt/8T/container-data/qb:/config
      - /mnt/8T/torrent:/downloads
      - /download_cache:/download_cache
    restart: unless-stopped

  NPM:
    image: 'jc21/nginx-proxy-manager:latest'
    container_name: nginx-proxy-manager
    restart: unless-stopped
    networks:
      NPM:
        ipv4_address: 10.5.0.3
    ports:
#      - "0.0.0.0:81:81"
      - "[::]:81:80"
      - "[::]:444:443"
    volumes:
      - /mnt/8T/container-data/NPM/data:/data
      - /mnt/8T/container-data/NPM/letsencrypt:/etc/letsencrypt

  frp:
    restart: always
    image: snowdreamtech/frpc:0.51.0
    container_name: frpc
    network_mode: "host"
    volumes:
      - /mnt/8T/container-data/frp:/etc/frp

  web:
    image: httpd
    container_name: apache
    restart: always
    networks:
      NPM:
        ipv4_address: 10.5.0.4
    volumes:
      - /mnt/8T/www:/var/www/html:ro
      - /mnt/8T/container-data/apache/httpd.conf:/usr/local/apache2/conf/httpd.conf:ro

  jellyfin:
    image: jellyfin/jellyfin:latest
    container_name: jellyfin
    user: 1000:1000
    group_add:
      - "28"
    networks:
      NPM:
        ipv4_address: 10.5.0.6
    tmpfs:
      - /transcode
    volumes:
      - /mnt/8T/container-data/jellfin:/config
      - /mnt/8T/torrent:/media:ro
    devices:
      - /dev/dri/renderD128:/dev/dri/renderD128
    restart: 'unless-stopped'
    deploy:
      resources:
        limits:
          cpus: '1'
          memory: 1G


networks:
  redisnet:
  NPM:
    driver: bridge
    ipam:
      config:
        - subnet: 10.5.0.0/16
  qb-ipv6:
    enable_ipv6: true
    driver: bridge
    ipam:
      driver: default
      config:
        - subnet: 2001:3200:3200::/64
          gateway: 2001:3200:3200::1
