Merge pull request #1 from AdrienPoupa/feat/add-traefik-support

Add Traefik Support
This commit is contained in:
Adrien Poupa 2022-04-20 15:27:02 -04:00 committed by GitHub
commit eb4b63efba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 102 additions and 32 deletions

View File

@ -1,6 +1,8 @@
USER_ID=1000 USER_ID=1000
GROUP_ID=1000 GROUP_ID=1000
TIMEZONE="America/New_York" TIMEZONE="America/New_York"
DATA_ROOT="/mnt/data"
DOWNLOAD_ROOT="/mnt/data/torrents"
PIA_LOCATION=ca PIA_LOCATION=ca
PIA_USER= PIA_USER=
PIA_PASS= PIA_PASS=

View File

@ -23,9 +23,7 @@ but you could use other providers:
- NordVPN + OpenVPN: [bubuntux/nordvpn](https://hub.docker.com/r/bubuntux/nordvpn/dockerfile) - NordVPN + OpenVPN: [bubuntux/nordvpn](https://hub.docker.com/r/bubuntux/nordvpn/dockerfile)
- NordVPN + Wireguard (NordLynx): [bubuntux/nordlynx](https://hub.docker.com/r/bubuntux/nordlynx) - NordVPN + Wireguard (NordLynx): [bubuntux/nordlynx](https://hub.docker.com/r/bubuntux/nordlynx)
For PIA + Wireguard, copy the example `.env` and fill it with your PIA credentials: For PIA + Wireguard, fill `.env` and fill it with your PIA credentials.
`cp .env.example .env`
The location of the server it will connect to is set by `LOC=ca`, defaulting to Montreal - Canada. The location of the server it will connect to is set by `LOC=ca`, defaulting to Montreal - Canada.
@ -68,8 +66,8 @@ place in the VPN container, the hostname for qBittorrent is the hostname of the
The indexers are configured through Prowlarr. They synchronize automatically to Radarr and Sonarr. The indexers are configured through Prowlarr. They synchronize automatically to Radarr and Sonarr.
Radarr and Sonarr may then be added via Settongs > Apps. The Prowlarr server is `http://prowlarr:9696`, the Radarr server Radarr and Sonarr may then be added via Settongs > Apps. The Prowlarr server is `http://prowlarr:9696/prowlarr`, the Radarr server
is `http://radarr:7878` and Sonarr `http://sonarr:8989`: is `http://radarr:7878/radarr` and Sonarr `http://sonarr:8989/sonarr`:
![](https://cdn.poupa.net/uploads/2022/03/sonarr.png) ![](https://cdn.poupa.net/uploads/2022/03/sonarr.png)
@ -95,7 +93,7 @@ The web UI login page can be disabled on for the local network in Settings > Web
## Heimdall ## Heimdall
Applications can be added in Items > Add. The URLs should be the static IP, ie: `http://192.168.0.10:8989/` for Sonarr Applications can be added in Items > Add. The URLs should be the static IP, ie: `http://192.168.0.10/` for Sonarr
for example. for example.
![](https://cdn.poupa.net/uploads/2022/03/homepage.png) ![](https://cdn.poupa.net/uploads/2022/03/homepage.png)

View File

@ -61,6 +61,9 @@ copy `/usr/libexec/docker/cli-plugins` rather than `$HOME/.docker/cli-plugins/do
You may then run the applications with `sudo docker compose up -d` You may then run the applications with `sudo docker compose up -d`
Then, to update the Sonarr/Radarr/Prowlarr base path, please run `./update-config.sh`.
This is only needed for the first time, and will update their `config.xml` file to set the correct path.
## NFS Share ## NFS Share
It is now time to share the folders to other local devices using NFS, as it is easy to set up and fast. It is now time to share the folders to other local devices using NFS, as it is easy to set up and fast.

View File

@ -15,12 +15,13 @@ The following applications are available:
- [PIA Wireguard VPN](https://github.com/thrnz/docker-wireguard-pia): Encapsulate qBittorrent traffic in - [PIA Wireguard VPN](https://github.com/thrnz/docker-wireguard-pia): Encapsulate qBittorrent traffic in
[PIA](https://www.privateinternetaccess.com/) with [Wireguard](https://www.wireguard.com/) with port forwarding. [PIA](https://www.privateinternetaccess.com/) with [Wireguard](https://www.wireguard.com/) with port forwarding.
- [Heimdall](https://heimdall.site/): Application dashboard - [Heimdall](https://heimdall.site/): Application dashboard
- [Traefik](https://traefik.io/): Reverse proxy
## Installation ## Installation
See [installation instructions](./INSTALL.md). See [installation instructions](./INSTALL.md).
TLDR: `cp .env.example .env`, edit to your needs then `sudo docker compose up -d` TLDR: `cp .env.example .env`, edit to your needs then `sudo docker compose up -d`, then for the first time `./update-config.sh`.
## Configuration ## Configuration
@ -28,19 +29,20 @@ See [configuration](./CONFIGURATION.md).
## Containers ## Containers
| **Application** | **Image** | **Port** | **Notes** | | **Application** | **Image** | **URL** | **Notes** |
|-------------------|------------------------------------------------------------------------------------|----------|-------------------------------------------------------------------| |-------------------|------------------------------------------------------------------------------------|--------------|-------------------------------------------------------------------|
| Sonarr | [linuxserver/sonarr](https://hub.docker.com/r/linuxserver/sonarr) | 8989 | | | Sonarr | [linuxserver/sonarr](https://hub.docker.com/r/linuxserver/sonarr) | /sonarr | |
| Radarr | [linuxserver/radarr](https://hub.docker.com/r/linuxserver/radarr) | 7878 | | | Radarr | [linuxserver/radarr](https://hub.docker.com/r/linuxserver/radarr) | /radarr | |
| Prowlarr | [linuxserver/prowlarr:develop](https://hub.docker.com/r/linuxserver/prowlarr) | 9696 | `develop` tag as it is not stable yet | | Prowlarr | [linuxserver/prowlarr:develop](https://hub.docker.com/r/linuxserver/prowlarr) | /prowlarr | `develop` tag as it is not stable yet |
| PIA Wireguard VPN | [thrnz/docker-wireguard-pia](https://hub.docker.com/r/thrnz/docker-wireguard-pia) | | | | PIA Wireguard VPN | [thrnz/docker-wireguard-pia](https://hub.docker.com/r/thrnz/docker-wireguard-pia) | | |
| qBittorrent | [linuxserver/qbittorrent:14.3.9](https://hub.docker.com/r/linuxserver/qbittorrent) | 8080 | Uses VPN network<br>Frozen to v4.3.9 due to Libtorrent 2.x issues | | qBittorrent | [linuxserver/qbittorrent:14.3.9](https://hub.docker.com/r/linuxserver/qbittorrent) | /qbittorrent | Uses VPN network<br>Frozen to v4.3.9 due to Libtorrent 2.x issues |
| Heimdall | [linuxserver/heimdall](https://hub.docker.com/r/linuxserver/heimdall) | 80, 443 | | | Heimdall | [linuxserver/heimdall](https://hub.docker.com/r/linuxserver/heimdall) | / | |
| Traefik | [traefik](https://hub.docker.com/_/traefik) | | |
## Improvement ## Improvement
There is always room for improvement. I did not need those containers so I did not include them, but maybe you could There is always room for improvement. I did not need those containers, so I did not include them, but maybe you could
benefit from: benefit from:
- [Bazarr](https://www.bazarr.media/): companion application to Sonarr and Radarr that manages and downloads subtitles - [Bazarr](https://www.bazarr.media/): companion application to Sonarr and Radarr that manages and downloads subtitles
@ -49,4 +51,7 @@ benefit from:
for some indexers in Prowlarr for some indexers in Prowlarr
- [Jackett](https://github.com/Jackett/Jackett): API Support for your favorite torrent trackers, as a Prowlarr replacement - [Jackett](https://github.com/Jackett/Jackett): API Support for your favorite torrent trackers, as a Prowlarr replacement
- [Plex](https://www.plex.tv/): Plex Media Server - [Plex](https://www.plex.tv/): Plex Media Server
- [Pi-hole](https://pi-hole.net/): DNS that blocks ads
- Use a domain name and Let's Encrypt certificate to get SSL
- Expose services with CloudFlare Tunnel
- you tell me! - you tell me!

View File

@ -1,5 +1,21 @@
version: "3.9" version: "3.9"
services: services:
traefik:
image: traefik:v2.6
container_name: traefik
command:
- --providers.docker=true
- --providers.docker.exposedbydefault=false
- --entrypoints.web.address=:80
- --entrypoints.web-secure.address=:443
- --entrypoints.web.http.redirections.entryPoint.to=web-secure
- --entrypoints.web.http.redirections.entryPoint.scheme=https
- --entrypoints.web.http.redirections.entrypoint.permanent=true
ports:
- "80:80"
- "443:443"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
sonarr: sonarr:
image: lscr.io/linuxserver/sonarr image: lscr.io/linuxserver/sonarr
container_name: sonarr container_name: sonarr
@ -8,10 +24,13 @@ services:
- PGID=${GROUP_ID} - PGID=${GROUP_ID}
volumes: volumes:
- ./sonarr:/config - ./sonarr:/config
- /mnt/data:/data - ${DATA_ROOT}:/data
ports:
- "8989:8989"
restart: unless-stopped restart: unless-stopped
labels:
- traefik.enable=true
- traefik.http.routers.sonarr.rule=PathPrefix(`/sonarr`)
- traefik.http.services.sonarr.loadbalancer.server.port=8989
- traefik.http.routers.sonarr.tls=true
radarr: radarr:
image: lscr.io/linuxserver/radarr image: lscr.io/linuxserver/radarr
container_name: radarr container_name: radarr
@ -20,10 +39,13 @@ services:
- PGID=${GROUP_ID} - PGID=${GROUP_ID}
volumes: volumes:
- ./radarr:/config - ./radarr:/config
- /mnt/data:/data - ${DATA_ROOT}:/data
ports:
- "7878:7878"
restart: unless-stopped restart: unless-stopped
labels:
- traefik.enable=true
- traefik.http.routers.radarr.rule=PathPrefix(`/radarr`)
- traefik.http.routers.radarr.tls=true
- traefik.http.services.radarr.loadbalancer.server.port=7878
prowlarr: prowlarr:
image: lscr.io/linuxserver/prowlarr:develop image: lscr.io/linuxserver/prowlarr:develop
container_name: prowlarr container_name: prowlarr
@ -32,9 +54,12 @@ services:
- PGID=${GROUP_ID} - PGID=${GROUP_ID}
volumes: volumes:
- ./prowlarr:/config - ./prowlarr:/config
ports:
- "9696:9696"
restart: unless-stopped restart: unless-stopped
labels:
- traefik.enable=true
- traefik.http.routers.prowlarr.rule=PathPrefix(`/prowlarr`)
- traefik.http.routers.prowlarr.tls=true
- traefik.http.services.prowlarr.loadbalancer.server.port=9696
qbittorrent: qbittorrent:
image: lscr.io/linuxserver/qbittorrent:14.3.9 image: lscr.io/linuxserver/qbittorrent:14.3.9
container_name: qbittorrent container_name: qbittorrent
@ -45,21 +70,29 @@ services:
- WEBUI_PORT=8080 - WEBUI_PORT=8080
volumes: volumes:
- ./qbittorrent:/config - ./qbittorrent:/config
- /mnt/data/torrents:/data/torrents - ${DOWNLOAD_ROOT}:/data/torrents
restart: unless-stopped restart: unless-stopped
network_mode: "service:vpn" network_mode: "service:vpn"
depends_on: depends_on:
- vpn - vpn
labels:
- traefik.enable=true
- traefik.http.routers.qbittorrent.rule=PathPrefix(`/qbittorrent`)
- traefik.http.routers.qbittorrent.tls=true
- traefik.http.services.qbittorrent.loadbalancer.server.port=8080
- traefik.http.routers.qbittorrent.middlewares=qbittorrent-strip-slash,qbittorrent-stripprefix
# https://github.com/qbittorrent/qBittorrent/issues/5693#issuecomment-552146296
- traefik.http.middlewares.qbittorrent-stripprefix.stripPrefix.prefixes=/qbittorrent
# https://community.traefik.io/t/middleware-to-add-the-if-needed/1895/19
- traefik.http.middlewares.qbittorrent-strip-slash.redirectregex.regex=(^.*\/qbittorrent$$)
- traefik.http.middlewares.qbittorrent-strip-slash.redirectregex.replacement=$$1/
- traefik.http.middlewares.qbittorrent-strip-slash.redirectregex.permanent=false
vpn: vpn:
image: thrnz/docker-wireguard-pia image: thrnz/docker-wireguard-pia
container_name: vpn container_name: vpn
volumes: volumes:
- ./pia:/pia - ./pia:/pia
- ./pia-shared:/pia-shared - ./pia-shared:/pia-shared
ports:
- "6881:6881"
- "6881:6881/udp"
- "8080:8080"
cap_add: cap_add:
- NET_ADMIN - NET_ADMIN
- SYS_MODULE - SYS_MODULE
@ -89,7 +122,9 @@ services:
- PGID=${GROUP_ID} - PGID=${GROUP_ID}
volumes: volumes:
- ./heimdall:/config - ./heimdall:/config
ports:
- "80:80"
- "443:443"
restart: unless-stopped restart: unless-stopped
labels:
- traefik.enable=true
- traefik.http.routers.heimdall.rule=PathPrefix(`/`)
- traefik.http.services.heimdall.loadbalancer.server.port=80
- traefik.http.routers.heimdall.tls=true

27
update-config.sh Executable file
View File

@ -0,0 +1,27 @@
#!/bin/bash
# See https://stackoverflow.com/a/44864004 for the sed GNU/BSD compatible hack
echo "Updating Radarr configuration..."
until [ -f ./radarr/config.xml ]
do
sleep 5
done
sed -i.bak "s/<UrlBase><\/UrlBase>/<UrlBase>\/radarr<\/UrlBase>/" ./radarr/config.xml && rm ./radarr/config.xml.bak
echo "Updating Sonarr configuration..."
until [ -f ./sonarr/config.xml ]
do
sleep 5
done
sed -i.bak "s/<UrlBase><\/UrlBase>/<UrlBase>\/sonarr<\/UrlBase>/" ./sonarr/config.xml && rm ./sonarr/config.xml.bak
echo "Updating Prowlarr configuration..."
until [ -f ./prowlarr/config.xml ]
do
sleep 5
done
sed -i.bak "s/<UrlBase><\/UrlBase>/<UrlBase>\/prowlarr<\/UrlBase>/" ./prowlarr/config.xml && rm ./prowlarr/config.xml.bak
echo "Restarting containers..."
docker compose restart radarr sonarr prowlarr