From 9365f3e8297b2fdfa9fd0069d21de5644c8a7fbb Mon Sep 17 00:00:00 2001 From: Adrien Poupa Date: Fri, 10 Nov 2023 18:53:29 -0500 Subject: [PATCH] feat: #15 Use Docker Compose profiles --- .env.example | 4 ++-- README.md | 28 +++++++++++++++++----------- adguardhome/docker-compose.yml | 6 ++++++ flaresolverr/docker-compose.yml | 2 ++ sabnzbd/docker-compose.yml | 2 ++ 5 files changed, 29 insertions(+), 13 deletions(-) diff --git a/.env.example b/.env.example index 98ab623..660c7c7 100644 --- a/.env.example +++ b/.env.example @@ -1,5 +1,5 @@ -COMPOSE_FILE=docker-compose.yml -COMPOSE_PATH_SEPARATOR=: +COMPOSE_PROFILES= +COMPOSE_FILE=docker-compose.yml:adguardhome/docker-compose.yml:flaresolverr/docker-compose.yml:sabnzbd/docker-compose.yml USER_ID=1000 GROUP_ID=1000 TIMEZONE="America/New_York" diff --git a/README.md b/README.md index aecaa55..e946a38 100644 --- a/README.md +++ b/README.md @@ -65,10 +65,10 @@ I am running it in Ubuntu Server 22.04; I also tested this setup on a [Synology | [Homepage](https://gethomepage.dev) | Application dashboard | [gethomepage/homepage](https://github.com/gethomepage/homepage/pkgs/container/homepage) | / | | [Traefik](https://traefik.io) | Reverse proxy | [traefik](https://hub.docker.com/_/traefik) | | | [Watchtower](https://containrrr.dev/watchtower/) | Automated Docker images update | [containrrr/watchtower](https://hub.docker.com/r/containrrr/watchtower) | | -| [Autoheal](https://github.com/willfarrell/docker-autoheal/) | Monitor and restart unhealthy docker containers | [willfarrell/autoheal](https://hub.docker.com/r/willfarrell/autoheal) | | -| [SABnzbd](https://sabnzbd.org/) | Optional - Free and easy binary newsreader | [linuxserver/sabnzbd](https://hub.docker.com/r/linuxserver/sabnzbd) | /sabnzbd | -| [FlareSolverr](https://github.com/FlareSolverr/FlareSolverr) | Optional - Proxy server to bypass Cloudflare protection in Prowlarr | [flaresolverr/flaresolverr](https://hub.docker.com/r/flaresolverr/flaresolverr) | | -| [AdGuard Home](https://adguard.com/en/adguard-home/overview.html) | Optional - Network-wide software for blocking ads & tracking | [adguard/adguardhome](https://hub.docker.com/r/adguard/adguardhome) | | +| [Autoheal](https://github.com/willfarrell/docker-autoheal/) | Monitor and restart unhealthy Docker containers | [willfarrell/autoheal](https://hub.docker.com/r/willfarrell/autoheal) | | +| [SABnzbd](https://sabnzbd.org/) | Optional - Free and easy binary newsreader
Enable with `COMPOSE_PROFILES=sabnzbd` | [linuxserver/sabnzbd](https://hub.docker.com/r/linuxserver/sabnzbd) | /sabnzbd | +| [FlareSolverr](https://github.com/FlareSolverr/FlareSolverr) | Optional - Proxy server to bypass Cloudflare protection in Prowlarr
Enable with `COMPOSE_PROFILES=flaresolverr` | [flaresolverr/flaresolverr](https://hub.docker.com/r/flaresolverr/flaresolverr) | | +| [AdGuard Home](https://adguard.com/en/adguard-home/overview.html) | Optional - Network-wide software for blocking ads & tracking
Enable with `COMPOSE_PROFILES=adguardhome` | [adguard/adguardhome](https://hub.docker.com/r/adguard/adguardhome) | | | [DHCP Relay](https://github.com/modem7/DHCP-Relay) | Optional - Docker DHCP Relay | [modem7/dhcprelay](https://hub.docker.com/r/modem7/dhcprelay) | | | [Traefik Certs Dumper](https://github.com/ldez/traefik-certs-dumper) | Optional - Dump ACME data from Traefik to certificates | [ldez/traefik-certs-dumper](https://hub.docker.com/r/ldez/traefik-certs-dumper) | | @@ -77,7 +77,7 @@ see [Optional Services](#optional-services) for more information. ## Quick Start -`cp .env.example .env`, edit to your needs then `sudo docker compose up -d`. +`cp .env.example .env`, edit to your needs then `docker compose up -d`. For the first time, run `./update-config.sh` to update the applications base URLs and set the API keys in `.env`. @@ -87,8 +87,8 @@ If you want to show Jellyfin information in the homepage, create it in Jellyfin | Variable | Description | Default | |--------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------| -| `COMPOSE_FILE` | Docker compose files to load | `docker-compose.yml` | -| `COMPOSE_PATH_SEPARATOR` | Path separator between compose files to load | `:` | +| `COMPOSE_FILE` | Docker compose files to load | | +| `COMPOSE_PROFILES` | Docker compose profiles to load (`flaresolverr`, `adguardhome`, `sabnzbd`) | | | `USER_ID` | ID of the user to use in Docker containers | `1000` | | `GROUP_ID` | ID of the user group to use in Docker containers | `1000` | | `TIMEZONE` | TimeZone used by the container. | `America/New_York` | @@ -294,10 +294,12 @@ and from the outside you need to connect to Tailscale first, then the NAS domain ## Optional Services -As their name would suggest, optional services are not launched by default. They have their own `docker-compose.yml` file -in their subfolders. To enable a service, append it to the `COMPOSE_FILE` environment variable. +Optional services are not launched by default and enabled by appending their profile name to the +`COMPOSE_PROFILES` environment variable (see [Docker documentation](https://docs.docker.com/compose/profiles)). -Say you want to enable FlareSolverr, you should have `COMPOSE_FILE=docker-compose.yml:flaresolverr/docker-compose.yml` +Say you want to enable FlareSolverr, you should have `COMPOSE_PROFILES=flaresolverr`. + +Multiple optional services can be enabled separated by commas: `COMPOSE_PROFILES=flaresolverr,adguardhome`. ### FlareSolverr @@ -305,12 +307,16 @@ In Prowlarr, add the FlareSolverr indexer with the URL http://flaresolverr:8191/ ### SABnzbd -Enable SABnzbd by setting `COMPOSE_FILE=docker-compose.yml:sabnzbd/docker-compose.yml`. It will be accessible at `/sabnzbd`. +Enable SABnzbd by setting `COMPOSE_PROFILES=sabnzbd`. It will be accessible at `/sabnzbd`. If that is not the case, the `url_base` parameter in `sabnzbd.ini` should be set to `/sabnzbd`. +Additionally, `host_whitelist` value should be set to your hostname. + ### AdGuard Home +Enable AdGuard Home by setting `COMPOSE_PROFILES=adguardhome`. + Set the `ADGUARD_HOSTNAME`, I chose a different subdomain to use secure DNS without the folder. On first run, specify the port 3000 and enable listen on all interfaces to make it work with Tailscale. diff --git a/adguardhome/docker-compose.yml b/adguardhome/docker-compose.yml index 6a7573e..329e8e4 100644 --- a/adguardhome/docker-compose.yml +++ b/adguardhome/docker-compose.yml @@ -12,6 +12,8 @@ services: - NET_ADMIN network_mode: host mem_reservation: 6m + profiles: + - adguardhome adguardhome: image: adguard/adguardhome @@ -48,6 +50,8 @@ services: - homepage.widget.url=https://${ADGUARD_HOSTNAME} - homepage.widget.username=${ADGUARD_USERNAME} - homepage.widget.password=${ADGUARD_PASSWORD} + profiles: + - adguardhome traefik-certs-dumper: image: ldez/traefik-certs-dumper @@ -65,6 +69,8 @@ services: volumes: - ./letsencrypt:/data - ./adguardhome/certs:/certs + profiles: + - adguardhome networks: adguardhome: diff --git a/flaresolverr/docker-compose.yml b/flaresolverr/docker-compose.yml index e90202a..b11e5c2 100644 --- a/flaresolverr/docker-compose.yml +++ b/flaresolverr/docker-compose.yml @@ -15,3 +15,5 @@ services: - traefik.http.routers.flaresolverr.rule=PathPrefix(`/flaresolverr`) - traefik.http.routers.flaresolverr.tls=true - traefik.http.services.flaresolverr.loadbalancer.server.port=8191 + profiles: + - flaresolverr \ No newline at end of file diff --git a/sabnzbd/docker-compose.yml b/sabnzbd/docker-compose.yml index ec9d52b..4ad2394 100644 --- a/sabnzbd/docker-compose.yml +++ b/sabnzbd/docker-compose.yml @@ -24,3 +24,5 @@ services: - homepage.href=/sabnzbd - homepage.description=Usenet - homepage.weight=6 + profiles: + - sabnzbd \ No newline at end of file