version: "3"
services:
  vpn:
    image: azinchen/nordvpn:latest
    container_name: vpn
    cap_add:
      - NET_ADMIN
    devices:
      - /dev/net/tun
    environment:
      - USER=${DNORD_USER}
      - "PASS=${DNORD_PASS}"
      - COUNTRY=Canada
      - GROUP=Standard VPN servers
      - RANDOM_TOP=20
      - RECREATE_VPN_CRON="5 */3 * * *" -e RANDOM_TOP=10
      - CHECK_CONNECTION_CRON="*/5 * * * *"
      - CHECK_CONNECTION_URL="https://www.google.com"
      - NETWORK=192.168.0.0/24
      - DNS='8.8.8.8,8.8.4.4'
      - "TZ=Europe/London"
      - OPENVPN_OPTS=--mute-replay-warnings --pull-filter ignore "ping-restart" --ping-exit 180
    ports:
      # for dante and qbittorrent
      - 1080:1080
      - 8082:8082
    sysctls:
      - net.ipv6.conf.all.disable_ipv6=1 # Recomended if using ipv4 only
      - net.ipv4.conf.all.rp_filter=2
    restart: unless-stopped

  dante:
    image: dante:latest
    container_name: dante
    privileged: true
    pull_policy: never
    restart: unless-stopped
    environment:
      - INTERFACE=tun0
    network_mode: "service:vpn"
    depends_on:
      - "vpn"

  swag:
    image: linuxserver/swag
    container_name: swag
    cap_add:
      - NET_ADMIN
    environment:
      - PUID=1000
      - PGID=100
      - URL=${DDOMAIN}
      - SUBDOMAINS=${DHOSTS}
      - VALIDATION=http
      - EMAIL=${DUSER}
      - ONLY_SUBDOMAINS=false
      - "TZ=Europe/London"
      - UMASK_SET=002
    ports:
      - 80:80
      - 443:443
      - 9091:9091
    restart: unless-stopped
    networks:
      - swag
    volumes:
      - /srv/docker/swag/config:/config

  authelia:
    image: authelia/authelia
    container_name: authelia
    environment:
      - "TZ=Europe/London"
    restart: unless-stopped
    depends_on:
      - "swag"
    networks:
      - swag
    volumes:
      - /srv/docker/authelia/config:/config

  heimdall:
    image: linuxserver/heimdall
    container_name: heimdall
    environment:
      - "PUID=1000"
      - "PGID=100"
      - "TZ=Europe/London"
    restart: unless-stopped
    depends_on:
      - "swag"
    networks:
      - swag
    ports:
      - 6465:80
    volumes:
      - /srv/docker/heimdall:/config

  homepage:
    image: ghcr.io/gethomepage/homepage:latest
    container_name: homepage
    environment:
      - "PUID=1000"
      - "PGID=1000"
      - "TZ=Europe/London"
    restart: unless-stopped
    depends_on:
      - "swag"
    networks:
      - swag
    ports:
      - 3001:3000
    volumes:
      - /srv/docker/homepage:/app/config
      - /var/run/docker.sock:/var/run/docker.sock:ro

  # dashy:
  #   image: lissy93/dashy:latest
  #   container_name: dashy
  #   environment:
  #     - "PUID=1000"
  #     - "PGID=100"
  #     - "TZ=Europe/London"
  #   restart: unless-stopped
  #   depends_on:
  #     - "swag"
  #   networks:
  #     - swag
  #   ports:
  #     - 8162:80
  #   volumes:
  #     - /srv/docker/dashy:/config

  sabnzbd:
    image: linuxserver/sabnzbd:latest
    container_name: sabnzbd
    environment:
      - "PUID=1000"
      - "PGID=100"
      - "TZ=Europe/London"
      - "UMASK_SET=002"
    restart: unless-stopped
    depends_on:
      - dante
    networks:
      - swag
    ports:
      - 8080:8080
    volumes:
      - /srv/docker/sabnzbd/config:/config
      - /srv/docker/sabnzbd/scripts:/scripts
      - /srv/DL:/downloads
      - /srv/incomplete-nzb:/incomplete

  qbittorrent:
    image: linuxserver/qbittorrent
    container_name: qbittorrent
    environment:
      - "PUID=1000"
      - "PGID=100"
      - "TZ=Europe/London"
      - "UMASK_SET=002"
      - "WEBUI_PORT=8082"
    restart: unless-stopped
    depends_on:
      - dante
    network_mode: "service:vpn"
    volumes:
      - /srv/docker/qbittorrent/config:/config
      - /srv/DL:/downloads
      - /srv/incomplete:/incomplete

  jackett:
    image: linuxserver/jackett
    container_name: jackett
    environment:
      - "PUID=1000"
      - "PGID=100"
      - "TZ=Europe/London"
    restart: unless-stopped
    depends_on:
      - "dante"
    networks:
      - swag
    ports:
      - 9117:9117
    volumes:
      - /srv/docker/jackett:/config

  prowlarr:
    image: linuxserver/prowlarr
    container_name: prowlarr
    environment:
      - "PUID=1000"
      - "PGID=100"
      - "TZ=Europe/London"
    restart: unless-stopped
    depends_on:
      - "dante"
    networks:
      - swag
    ports:
      - 9696:9696
    volumes:
      - /srv/docker/prowlarr:/config

  radarr:
    image: linuxserver/radarr
    container_name: radarr
    environment:
      - "PUID=1000"
      - "PGID=100"
      - "TZ=Europe/London"
    restart: unless-stopped
    depends_on:
      - "prowlarr"
    networks:
      - swag
    ports:
      - 7878:7878
    volumes:
      - /srv/docker/radarr/config:/config
      - /media/qnap1/Movies:/movies
      - /srv/DL:/downloads

  sonarr:
    image: linuxserver/sonarr
    container_name: sonarr
    environment:
      - "PUID=1000"
      - "PGID=100"
      - "TZ=Europe/London"
    restart: unless-stopped
    depends_on:
      - "prowlarr"
    networks:
      - swag
    ports:
      - 8989:8989
    volumes:
      - /srv/docker/sonarr/config:/config
      - /media/qnap1/TV:/tv
      - /srv/DL:/downloads

  jellyfin:
    image: linuxserver/jellyfin:latest
    container_name: jellyfin
    devices:
      - /dev/dri:/dev/dri
      - /dev/dri/renderD128:/dev/dri/renderD128
      - /dev/dri/card1:/dev/dri/card1
    environment:
      # - DOCKER_MODS=linuxserver/mods:jellyfin-opencl-intel
      - PUID=1000
      - PGID=100
      - "TZ=Europe/London"
      - JELLYFIN_PublishedServerUrl=192.168.0.10
    volumes:
      - /srv/docker/jellyfin:/config
      - /media/qnap1/TV:/data/tvshows
      - /media/qnap1/Movies:/data/movies
    ports:
      - 8096:8096
      - 8920:8920 #optional
      - 7359:7359/udp #optional
      - 1900:1900/udp #optional
    restart: unless-stopped
    networks:
      - swag

  lidarr:
    image: linuxserver/lidarr
    container_name: lidarr
    environment:
      - "PUID=1000"
      - "PGID=100"
      - "TZ=Europe/London"
    restart: unless-stopped
    depends_on:
      - "prowlarr"
    networks:
      - swag
    ports:
      - 8686:8686
    volumes:
      - /srv/docker/lidarr/config:/config
      - /media/qnap2/Music/Artists:/music
      - /srv/DL:/downloads

  tautulli:
    image: tautulli/tautulli
    container_name: tautulli
    environment:
      - "PUID=1000"
      - "PGID=100"
      - "TZ=Europe/London"
    restart: unless-stopped
    depends_on:
      - "swag"
    networks:
      - swag
    ports:
      - 8181:8181
    volumes:
      - /srv/docker/tautull:/config

  ombi:
    image: linuxserver/ombi
    container_name: ombi
    environment:
      - "PUID=1000"
      - "PGID=100"
      - "TZ=Europe/London"
      - "BASE_URL=/ombi"
    restart: unless-stopped
    depends_on:
      - "swag"
    networks:
      - swag
    ports:
      - 3579:3579
    volumes:
      - /srv/docker/ombi/config:/config

  guacamole:
    image: abesnier/guacamole:latest
    container_name: guacamole
    user: root
    environment:
      - "TZ=Europe/London"
    restart: unless-stopped
    depends_on:
      - "swag"
    networks:
      - swag
    ports:
      - 6565:8080
    volumes:
      - /srv/docker/guacamole/config:/config

  pyload:
    image: linuxserver/pyload
    container_name: pyload
    environment:
      - "PUID=1000"
      - "PGID=100"
      - "TZ=Europe/London"
      - "BASE_URL=/ombi"
    restart: unless-stopped
    ports:
      - 8000:8000
      - 7227:7223
    volumes:
      - /srv/docker/pyload/config:/config
      - /srv/DL:/downloads

  redis:
    image: sameersbn/redis:latest
    container_name: redis
    restart: unless-stopped
    depends_on:
      - "swag"
    networks:
      - swag
    volumes:
      - /srv/docker/redis:/data
      - /etc/localtime:/etc/localtime:ro

  postgres:
    image: sameersbn/postgresql:latest
    container_name: postgres
    environment:
      - 'DB_NAME=gitlabhq_production'
      - 'DB_USER=gitlab'
      - 'DB_PASS=${DDB_PASS}'
      - 'DB_EXTENSION=pg_trgm,btree_gist'
    restart: unless-stopped
    depends_on:
      - "swag"
    networks:
      - swag
    volumes:
      - /srv/docker/postgres:/var/lib/postgresql

  mariadb:
    image: linuxserver/mariadb
    container_name: mariadb
    environment:
      - PUID=1000
      - PGID=1000
      - 'MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}'
      - TZ=Europe/London
    restart: unless-stopped
    depends_on:
      - "swag"
    networks:
      - swag
    ports:
      - 3306:3306
    volumes:
      - /srv/docker/mariadb:/config

  # gitlab:
  #   image: sameersbn/gitlab:16.6.0
  #   container_name: gitlab
  #   environment:
  #     - "USERMAP_UID=1000"
  #     - "USERMAP_GID=1000"
  #     - 'GITLAB_PORT=443'
  #     - 'GITLAB_SSH_PORT=10022'
  #     - 'GITLAB_HTTPS=true'
  #     - 'DB_NAME=gitlabhq_production'
  #     - 'DB_HOST=postgres.swag'
  #     - 'DB_USER=gitlab'
  #     - 'DB_PASS=${DDB_PASS}'
  #     - 'GITLAB_HOST=git.${DDOMAIN}'
  #     - 'GITLAB_BACKUPS=daily'
  #     - 'UNICORN_WORKERS=3'
  #     - 'UNICORN_TIMEOUT=240'
  #     - 'GITLAB_WEBHOOK_TIMEOUT=240'
  #     - 'GITLAB_TIMEOUT=240'
  #     - 'SMTP_OPENSSL_VERIFY_MODE=none'
  #     - 'REDIS_HOST=redis.swag'
  #     - GITLAB_SECRETS_DB_KEY_BASE=${DGITLAB_SECRETS_DB_KEY_BASE}
  #     - GITLAB_SECRETS_SECRET_KEY_BASE=${DGITLAB_SECRETS_SECRET_KEY_BASE}
  #     - GITLAB_SECRETS_OTP_KEY_BASE=${DGITLAB_SECRETS_OTP_KEY_BASE}
  #     # - SMTP_USER=${DSMTP_USER}
  #     # - SMTP_PASS=${DSMTP_PASS}
  #     # - IMAP_USER=${DSMTP_USER}
  #     # - IMAP_PASS=${DSMTP_PASS}
  #     # - GITLAB_INCOMING_EMAIL_ADDRESS=${DGITLAB_INCOMING_EMAIL_ADDRESS}
  #   restart: unless-stopped
  #   depends_on:
  #     - "swag"
  #     - "postgres"
  #     - "redis"
  #   networks:
  #     - swag
  #   ports:
  #     - "10022:22"
  #     - "10080:80"
  #   volumes:
  #     - /var/run/docker.sock:/run/docker.sock
  #     - /usr/bin/docker:/bin/docker
  #     - /srv/docker/gitlab/data:/home/git/data
  #     - /etc/localtime:/etc/localtime:ro

  netdata:
    image: netdata/netdata
    container_name: netdata
    cap_add:
      - SYS_PTRACE
    security_opt:
      - apparmor=unconfined
    environment:
      - DOCKER_HOST=docker-proxy:2375
      - "TZ=Europe/London"
    restart: unless-stopped
    depends_on:
      - "swag"
    networks:
      - swag
    ports:
      - "19999:19999"
    volumes:
      - /srv/docker/netdata/netdatalib:/var/lib/netdata
      - /srv/docker/netdata/netdatacache:/var/cache/netdata
      - /etc/passwd:/host/etc/passwd:ro
      - /etc/group:/host/etc/group:ro
      - /proc:/host/proc:ro
      - /sys:/host/sys:ro
      - /etc/os-release:/host/etc/os-release:ro

  vscode:
    image: linuxserver/code-server
    container_name: vscode
    environment:
      - PUID=1000
      - PGID=1000
      - "TZ=Europe/London"
      - "PROXY_DOMAIN=code.${DDOMAIN}"
      - "PASSWORD=${DDEFAULT_PASSWORD}"
    restart: unless-stopped
    depends_on:
      - "swag"
    networks:
      - swag
    ports:
      - "8443:8443"
    volumes:
      - /srv/docker/vscode/config:/config

  cells:
    image: linuxserver/pydio-cells
    container_name: cells
    environment:
      - PUID=1000
      - PGID=1000
      - EXTERNALURL=cells.rmj014.com
    restart: unless-stopped
    depends_on:
      - "swag"
    networks:
      - swag
    ports:
      - "8089:8080"
    volumes:
      - /srv/docker/cells/config:/config

  wireguard:
    image: linuxserver/wireguard:latest
    container_name: wireguard
    cap_add:
      - NET_ADMIN
      - SYS_MODULE
    environment:
      - PUID=1000
      - PGID=1000
      - "TZ=Europe/London"
      - SERVERURL=rmj014.com
      - SERVERPORT=51820
      - PEERS=10
      - PEERDNS=auto
      - ALLOWEDIPS=0.0.0.0/0
      - LOG_CONFS=true
    restart: unless-stopped
    depends_on:
      - "swag"
    networks:
      - swag
    ports:
      - 51820:51820/udp
    sysctls:
      - net.ipv4.conf.all.src_valid_mark=1
    volumes:
      - /srv/docker/wireguard/config:/config
      - /lib/modules:/lib/modules

  lazylibrarian:
    image: linuxserver/lazylibrarian:latest
    container_name: lazylibrarian
    environment:
      - PUID=1000
      - PGID=100
      - TZ="Europe/London"
      - DOCKER_MODS=linuxserver/mods:universal-calibre|linuxserver/mods:lazylibrarian-ffmpeg #optional
    volumes:
      - /srv/docker/lazylibrarian/config:/config
      - /srv/DL:/downloads
      - /srv/books:/books #optional
    ports:
      - 5299:5299
    restart: unless-stopped
    depends_on:
      - "swag"
    networks:
      - swag

  gitea:
    image: gitea/gitea:latest
    container_name: gitea
    environment:
      - USER_UID=1000
      - USER_GID=100
    restart: unless-stopped
    networks:
      - swag
    depends_on:
      - "swag"
    volumes:
      - /srv/docker/gitea:/data
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
    ports:
      - "3000:3000"
      - "222:22"

networks:
  swag:
    name: swag
    external: true
