feat: Add Traefik support

This commit is contained in:
Adrien Poupa 2022-04-17 18:59:35 -04:00
parent a4088f706d
commit 6e454a7863
5 changed files with 97 additions and 29 deletions

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 + 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:
`cp .env.example .env`
For PIA + Wireguard, fill `.env` and fill it with your PIA credentials.
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.
Radarr and Sonarr may then be added via Settongs > Apps. The Prowlarr server is `http://prowlarr:9696`, the Radarr server
is `http://radarr:7878` and Sonarr `http://sonarr:8989`:
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/radarr` and Sonarr `http://sonarr:8989/sonarr`:
![](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
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.
![](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`
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
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](https://www.privateinternetaccess.com/) with [Wireguard](https://www.wireguard.com/) with port forwarding.
- [Heimdall](https://heimdall.site/): Application dashboard
- [Traefik](https://traefik.io/): Reverse proxy
## Installation
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
@ -28,19 +29,20 @@ See [configuration](./CONFIGURATION.md).
## Containers
| **Application** | **Image** | **Port** | **Notes** |
|-------------------|------------------------------------------------------------------------------------|----------|-------------------------------------------------------------------|
| Sonarr | [linuxserver/sonarr](https://hub.docker.com/r/linuxserver/sonarr) | 8989 | |
| Radarr | [linuxserver/radarr](https://hub.docker.com/r/linuxserver/radarr) | 7878 | |
| Prowlarr | [linuxserver/prowlarr:develop](https://hub.docker.com/r/linuxserver/prowlarr) | 9696 | `develop` tag as it is not stable yet |
| 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 |
| Heimdall | [linuxserver/heimdall](https://hub.docker.com/r/linuxserver/heimdall) | 80, 443 | |
| **Application** | **Image** | **URL** | **Notes** |
|-------------------|------------------------------------------------------------------------------------|--------------|-------------------------------------------------------------------|
| Sonarr | [linuxserver/sonarr](https://hub.docker.com/r/linuxserver/sonarr) | /sonarr | |
| Radarr | [linuxserver/radarr](https://hub.docker.com/r/linuxserver/radarr) | /radarr | |
| 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) | | |
| 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) | / | |
| Traefik | [traefik](https://hub.docker.com/_/traefik) | | |
## 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:
- [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
- [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
- [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!

View File

@ -1,5 +1,21 @@
version: "3.9"
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:
image: lscr.io/linuxserver/sonarr
container_name: sonarr
@ -9,9 +25,12 @@ services:
volumes:
- ./sonarr:/config
- ${DATA_ROOT}:/data
ports:
- "8989:8989"
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:
image: lscr.io/linuxserver/radarr
container_name: radarr
@ -21,9 +40,12 @@ services:
volumes:
- ./radarr:/config
- ${DATA_ROOT}:/data
ports:
- "7878:7878"
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:
image: lscr.io/linuxserver/prowlarr:develop
container_name: prowlarr
@ -32,9 +54,12 @@ services:
- PGID=${GROUP_ID}
volumes:
- ./prowlarr:/config
ports:
- "9696:9696"
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:
image: lscr.io/linuxserver/qbittorrent:14.3.9
container_name: qbittorrent
@ -50,16 +75,24 @@ services:
network_mode: "service:vpn"
depends_on:
- 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:
image: thrnz/docker-wireguard-pia
container_name: vpn
volumes:
- ./pia:/pia
- ./pia-shared:/pia-shared
ports:
- "6881:6881"
- "6881:6881/udp"
- "8080:8080"
cap_add:
- NET_ADMIN
- SYS_MODULE
@ -89,7 +122,9 @@ services:
- PGID=${GROUP_ID}
volumes:
- ./heimdall:/config
ports:
- "80:80"
- "443:443"
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