Guest User

Untitled

a guest
Feb 17th, 2025
481
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 7.92 KB | Software | 0 0
  1. #--------------------------------------------------------------------------------------------------
  2. #
  3. # tl;dr -
  4. #    - all services (besides plex) share a docker network, with qbittorent and prowlarr networking
  5. #      configured thru the vpn (gluetun).
  6. #    - non-VPN services like sonarr/radarr have static IPs set with hostnames mapped in the vpn service
  7. #      this way all services can talk to each other via hostname. services behind vpn use `vpn` for hostanme
  8. #    - services behind the vpn automatically restart after it reconnects
  9. #      (fixed issues with qbittorrent not working until restarted)
  10. #    - per-service settings documented below, ones that were configure or changed from their default
  11. #    - create a .env file in the same directory as this yml file with the variables below
  12. #
  13. #
  14. # ENV VARS:
  15. #    BASE_DIR=/media/data # path to root of main storage, where downloads and media libraries are stored
  16. #    CFG_DIR=/media/data/config  # root path to where configs are stored
  17. #    PUID=1000  # user id that services to run as non-root for written file ownership
  18. #    PGID=1000  # group id that services to run as non-root for written file ownership
  19. #    TZ=America/Chicago  # timezone for containers, e.g. log timestamps
  20. #    VPN_FORWARDED_PORT=35111 # port-forward configured in AirVPN
  21. #
  22. # Other misc settings:
  23. #   - host firewall: allow port 32400 (plex)
  24. #   - static host ip reservation in dhcp server (pihole)
  25. #   - router firewall: allow 1637/udp to host internal ip (AirVPN)
  26. #
  27. #--------------------------------------------------------------------------------------------------
  28.  
  29. name: servarr
  30.  
  31. # common envvars for most services
  32. x-base-env: &base-env
  33.   TZ: ${TZ}
  34.   PUID: ${PUID}
  35.   PGID: ${PGID}
  36.  
  37.  
  38. # common config for any services using the vpn
  39. x-vpn-service: &vpn-service
  40.   network_mode: service:vpn  # implies depends_on for vpn
  41.   restart: always
  42.   healthcheck:
  43.    # appears that services behind the vpn lose access to the network after it reconnects
  44.     # if we can't ping the vpn, then it probably restarted/reconnected
  45.     # exit the container and let it restart.
  46.     test: ping -c 2 vpn || kill 1
  47.     interval: 30s
  48.     timeout: 2s
  49.     retries: 1
  50.     start_period: 10s  # wait a little for the vpn to reconnect first
  51.  
  52. # common config for the non-vpn'd *arr servicers
  53. x-arr-service: &arr-service
  54.   environment:
  55.     <<: *base-env
  56.   restart: unless-stopped
  57.  
  58.  
  59. networks:
  60.  # network for all services
  61.   arr-net:
  62.     ipam:
  63.       config:
  64.        - subnet: 172.0.0.0/16
  65.  
  66.  
  67. services:
  68.  #----------------------------------------------------------------------------
  69.   # VPN - gluetun + AirVPN
  70.   #----------------------------------------------------------------------------
  71.   vpn:
  72.     image: qmcgaw/gluetun:v3.39
  73.     container_name: vpn
  74.     hostname: vpn
  75.     cap_add:
  76.      - NET_ADMIN
  77.     devices:
  78.      - /dev/net/tun:/dev/net/tun
  79.     environment:
  80.       TZ: ${TZ}
  81.       VPN_SERVICE_PROVIDER: airvpn
  82.       VPN_TYPE: wireguard
  83.       FIREWALL_VPN_INPUT_PORTS: ${VPN_FORWARDED_PORT}
  84.       HEALTH_VPN_DURATION_INITIAL: 30s  # slow down healthchecks
  85.       HEALTH_SUCCESS_WAIT_DURATION: 30s
  86.       DOT: 'off'  # disable DNS over TLS - caused a bunch of timeouts, leading to restarts
  87.     volumes:
  88.      - ${BASE_DIR}/config/wireguard/config:/config
  89.       # uses conf file from airvpn over envvars (removed ipv6 addrs tho)
  90.       - ${BASE_DIR}/config/wireguard/airvpn.conf:/gluetun/wireguard/wg0.conf
  91.     ports:
  92.      # expose ports for services behind vpn
  93.       - 8090:8090 # qbittorrent ui
  94.       - 9696:9696 # prowlarr ui
  95.     networks:
  96.      - arr-net
  97.     extra_hosts:
  98.      # use static ips for non-vpn'd services, map hostnames here (e.g. for prowlarr)
  99.       - sonarr=172.0.0.11
  100.       - radarr=172.0.0.12
  101.     restart: always
  102.  
  103.   #----------------------------------------------------------------------------
  104.   # QBittorrent
  105.   #----------------------------------------------------------------------------
  106.   #  Options:
  107.   #    Downloads:
  108.   #      [x] Use subcategories
  109.   #    Connection:
  110.   #      Peer connection protocol: TCP
  111.   #      [ ] Use UPnP / NAT-PMP port forwarding from my router
  112.   #    Advanced:
  113.   #      Network interface: tun0
  114.   #      Reannounce to all trackers when IP or port changed: [x]
  115.   #      μTP-TCP mixed mode algorithm: Prefer TCP
  116.   #
  117.   #----------------------------------------------------------------------------
  118.   qbittorrent:
  119.     image: lscr.io/linuxserver/qbittorrent:latest
  120.     container_name: qbittorrent
  121.     <<: *vpn-service
  122.     environment:
  123.       <<: *base-env
  124.       UMASK_SET: 022
  125.       WEBUI_PORT: 8090
  126.       TORRENTING_PORT: ${VPN_FORWARDED_PORT}
  127.     volumes:
  128.        - ${CFG_DIR}/qbt:/config
  129.         - ${BASE_DIR}:/data
  130.   #----------------------------------------------------------------------------
  131.   # Prowlarr
  132.   #----------------------------------------------------------------------------
  133.   #  Settings > Apps:
  134.   #    Radarr:
  135.   #      Prowlarr server: http://vpn:9696
  136.   #      Radarr server: http://radarr:7878
  137.   #      API Key: {from Radarr: Settings > General}
  138.   #    Sonarr:
  139.   #      Prowlarr server: http://vpn:9696
  140.   #      Sonarr server: http://sonarr:7878
  141.   #      API Key: {from Radarr: Settings > General}
  142.   #----------------------------------------------------------------------------
  143.   prowlarr:
  144.     image: lscr.io/linuxserver/prowlarr:latest
  145.     container_name: prowlarr
  146.     <<: *vpn-service
  147.     environment:
  148.       <<: *base-env
  149.     volumes:
  150.      - ${CFG_DIR}/prowlarr:/config
  151.  
  152.   #----------------------------------------------------------------------------
  153.   # Sonarr
  154.   #----------------------------------------------------------------------------
  155.   #  Settings:
  156.   #    Media Management:
  157.   #      RootFolders: /data/video/tv
  158.   #      Use Hardlinks instead of Copy [x]
  159.   #    Download Clients:
  160.   #      QBittorrent:
  161.   #        Host: vpn
  162.   #        Port: 8090
  163.   #        Username: admin
  164.   #        Password: <todo>
  165.   #        Category: tv
  166.   #----------------------------------------------------------------------------
  167.   sonarr:
  168.     image: lscr.io/linuxserver/sonarr:latest
  169.     container_name: sonarr
  170.     hostname: sonarr
  171.     <<: *arr-service
  172.     volumes:
  173.      - ${CFG_DIR}/sonarr:/config
  174.       - ${BASE_DIR}:/data
  175.     networks:
  176.       arr-net:
  177.         ipv4_address: 172.0.0.11
  178.     ports:
  179.      - 8989:8989  # web ui port
  180.  
  181.   #----------------------------------------------------------------------------
  182.   # Radarr
  183.   #----------------------------------------------------------------------------
  184.   #  Settings:
  185.   #    Media Management:
  186.   #      RootFolders: /data/video/movies
  187.   #      Use Hardlinks instead of Copy [x]
  188.   #    Download Clients:
  189.   #      QBittorrent:
  190.   #        Host: vpn
  191.   #        Port: 8090
  192.   #        Username: admin
  193.   #        Password: <todo>
  194.   #        Category: movies
  195.   #----------------------------------------------------------------------------
  196.   radarr:
  197.     image: lscr.io/linuxserver/radarr:latest
  198.     container_name: radarr
  199.     hostname: radarr
  200.     <<: *arr-service
  201.     volumes:
  202.      - ${CFG_DIR}/radarr:/config
  203.       - ${BASE_DIR}:/data
  204.     networks:
  205.       arr-net:
  206.         ipv4_address: 172.0.0.12
  207.     ports:
  208.      - 7878:7878 # web ui port
  209.  
  210.   #----------------------------------------------------------------------------
  211.   # Plex
  212.   #----------------------------------------------------------------------------
  213.   #  Uses host networking, accessible from anything on the network (e.g. tv)
  214.   #----------------------------------------------------------------------------
  215.   plex:
  216.     image: lscr.io/linuxserver/plex:latest
  217.     container_name: plex
  218.     network_mode: host
  219.     devices:
  220.      - /dev/dri:/dev/dri  # for intel graphics
  221.     environment:
  222.       <<: *base-env
  223.       VERSION: docker
  224.       PLEX_CLAIM: <todo>
  225.     volumes:
  226.      - ${CFG_DIR}/plex:/config
  227.       # library directories:
  228.       - ${BASE_DIR}/video/tv:/tv
  229.       - ${BASE_DIR}/video/movies:/movies
  230.     restart: unless-stopped
  231.  
  232.  
Add Comment
Please, Sign In to add comment