version: "3"
services:
  vpn:
    image: ghcr.io/bubuntux/nordvpn
    container_name: vpn
    cap_add:
      - NET_ADMIN
      - SYS_MODULE
    devices:
      - "/dev/net/tun"
    environment:
      - USER=${DUSER}
      - "PASS=${DNORD_PASS}"
      - CONNECT=Canada
      - TECHNOLOGY=OpenVPN
      - PROTOCOL=UDP
      - NETWORK=192.168.0.0/24
      - DNS='8.8.8.8,8.8.4.4'
      - "TZ=Europe/London"
    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
    restart: unless-stopped
    environment:
      - INTERFACE=tun0
    network_mode: "service:vpn"
    depends_on:
      - "vpn"

  swag:
    image: lscr.io/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:4.32.2
    container_name: authelia
    environment:
      - "TZ=Europe/London"
    restart: unless-stopped
    depends_on:
      - "swag"
    networks:
      - swag
    volumes:
      - /srv/docker/authelia/config:/config
    depends_on:
      - "swag"

  heimdall:
    image: lscr.io/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
    depends_on:
      - "swag"

  sabnzbd:
    image: lscr.io/linuxserver/sabnzbd
    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: lscr.io/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: lscr.io/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

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

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

  lidarr:
    image: lscr.io/linuxserver/lidarr
    container_name: lidarr
    environment:
      - "PUID=1000"
      - "PGID=100"
      - "TZ=Europe/London"
    restart: unless-stopped
    depends_on:
      - "jackett"
    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: lscr.io/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
    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: lscr.io/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: lscr.io/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:latest
    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: lscr.io/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: lscr.io/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

networks:
  swag:
    external:
      name: swag
