---
version: "2.1"
networks:
  pihole_net:
  swag_net:
  nextcloud_net:
  bep_net:

services:
  pihole:
    image: pihole/pihole:latest
    container_name: pihole
    networks:
      - pihole_net
    cap_add:
      - NET_ADMIN
    ports:
      - "53:53/tcp"
      - "53:53/udp"
      - "81:80/tcp"
    dns: 127.0.0.1
    environment:
      TZ: 'Europe/Paris'
      WEBPASSWORD: '${PIHOLE_WEB_PASSWORD}'
    volumes:
      - ./pihole/etc-pihole/:/etc/pihole/
      - ./pihole/etc-dnsmasq.d/:/etc/dnsmasq.d/
      - ./pihole/log/:/var/log/
    restart: unless-stopped

  swag:
    image: ghcr.io/linuxserver/swag
    container_name: swag
    networks:
      - swag_net
    cap_add:
      - NET_ADMIN
    environment:
      - PUID=998
      - PGID=998
      - TZ=Europe/Paris
      - URL=my.awesome.domaine.name
      - EMAIL=contact@my.awesome.domaine.name
    volumes:
      - ./swag:/config
    ports:
      - 443:443
      - 80:80
    restart: unless-stopped

  postgres_nextcloud:
    image: postgres
    container_name: postgres_nextcloud
    networks:
      - nextcloud_net
    environment:
      - POSTGRES_DB=nextcloud
      - POSTGRES_USER=nextcloud
      - POSTGRES_PASSWORD=${POSTGRES_NEXTCLOUD_PASSWORD}
    volumes:
      - ../data/postgres_nextcloud:/var/lib/postgresql/data
    restart: unless-stopped

  nextcloud:
    image: ghcr.io/linuxserver/nextcloud
    container_name: nextcloud
    networks:
      - swag_net
      - nextcloud_net
    depends_on:
      - swag
      - postgres_nextcloud
    environment:
      - PUID=997
      - PGID=997
      - TZ=Europe/Paris
    volumes:
      - ./nextcloud:/config
      - ../data/nextcloud:/data
    restart: unless-stopped

  wireguard_bep:
    image: ghcr.io/linuxserver/wireguard
    container_name: wireguard_bep
    networks:
      - bep_net
    cap_add:
      - NET_ADMIN
      - SYS_MODULE
    environment:
      - PUID=996
      - PGID=996
      - TZ=Europe/Paris
    volumes:
      - ./wireguard:/config
      - /lib/modules:/lib/modules
    ports:
      - 9091:9091 # Map Transmission's port
      - 9117:9117 # Map Jackett's port
    sysctls:
      - net.ipv4.conf.all.src_valid_mark=1
    restart: unless-stopped

  transmission:
    image: linuxserver/transmission:2.94-r3-ls53
    container_name: transmission
    depends_on:
      - wireguard_bep
    environment:
      - PUID=995
      - PGID=995
      - TZ=Europe/Paris
    volumes:
      - ./transmission:/config
      - ./transmission/watch:/watch
      - ../data/downloads:/downloads
    network_mode: service:wireguard_bep
    restart: unless-stopped

  jackett:
    image: ghcr.io/linuxserver/jackett
    container_name: jackett
    depends_on:
      - wireguard_bep
    environment:
      - PUID=995
      - PGID=995
      - TZ=Europe/Paris
      - AUTO_UPDATE=true
    volumes:
      - ./jackett:/config
      - ./jackett/downloads:/downloads
    network_mode: service:wireguard_bep
    restart: unless-stopped

  sonarr:
    image: ghcr.io/linuxserver/sonarr
    container_name: sonarr
    networks:
      - bep_net
    environment:
      - PUID=995
      - PGID=995
      - TZ=Europe/Paris
      - UMASK_SET=022
    volumes:
      - ./sonarr:/config
      - ../data/tvshows:/tv
      - ../data/downloads:/downloads
    ports:
      - 8989:8989
    restart: unless-stopped

  radarr:
    image: ghcr.io/linuxserver/radarr
    container_name: radarr
    networks:
      - bep_net
    environment:
      - PUID=995
      - PGID=995
      - TZ=Europe/Paris
      - UMASK_SET=022
    volumes:
      - ./radarr:/config
      - ../data/movies:/movies
      - ../data/downloads:/downloads
    ports:
      - 7878:7878
    restart: unless-stopped
