From 4a5341c75eadb73056639892d996f53f42f65a43 Mon Sep 17 00:00:00 2001 From: Steven Briscoe Date: Thu, 10 Nov 2022 12:49:20 +1000 Subject: [PATCH] Auto-setup Prowlarr with Lidarr, Radarr or Sonarr (#262) Co-authored-by: Steven Briscoe --- lidarr/hooks/post-install | 24 ++++++++++++++++++++++++ lidarr/umbrel-app.yml | 2 +- prowlarr/docker-compose.yml | 11 +++++++++-- prowlarr/exports.sh | 6 +++++- prowlarr/umbrel-app.yml | 10 ++++++---- radarr/hooks/post-install | 24 ++++++++++++++++++++++++ radarr/umbrel-app.yml | 2 +- sonarr/hooks/post-install | 24 ++++++++++++++++++++++++ sonarr/umbrel-app.yml | 2 +- 9 files changed, 95 insertions(+), 10 deletions(-) create mode 100755 lidarr/hooks/post-install create mode 100755 radarr/hooks/post-install create mode 100755 sonarr/hooks/post-install diff --git a/lidarr/hooks/post-install b/lidarr/hooks/post-install new file mode 100755 index 0000000..255f4fe --- /dev/null +++ b/lidarr/hooks/post-install @@ -0,0 +1,24 @@ +#!/usr/bin/env bash +set -euo pipefail + +if "${UMBREL_ROOT}/scripts/app" ls-installed | grep --quiet 'prowlarr' +then + CONFIG_FILE="${APP_DATA_DIR}/data/config/config.xml" + + # Wait for the config.xml file to exist + # Wait for the API key property () to exist in the config file + for attempt in $(seq 1 20); do + if [[ -f "${CONFIG_FILE}" ]] && cat "${CONFIG_FILE}" | grep --quiet ''; then + echo "config.xml file exists and xml key exists..." + + # Restart Prowlarr to automatically set this up as an app + "${UMBREL_ROOT}/scripts/app" restart prowlarr + + exit + fi + sleep 1 + done + + >&2 echo "Error: Failed to locate inside: ${CONFIG_FILE}" + exit 1 +fi \ No newline at end of file diff --git a/lidarr/umbrel-app.yml b/lidarr/umbrel-app.yml index 747f62f..57a141c 100644 --- a/lidarr/umbrel-app.yml +++ b/lidarr/umbrel-app.yml @@ -1,4 +1,4 @@ -manifestVersion: 1 +manifestVersion: 1.1 id: lidarr category: Media name: Lidarr diff --git a/prowlarr/docker-compose.yml b/prowlarr/docker-compose.yml index 3622008..0959f35 100644 --- a/prowlarr/docker-compose.yml +++ b/prowlarr/docker-compose.yml @@ -21,12 +21,19 @@ services: ipv4_address: $APP_PROWLARR_IP mac: - image: getumbrel/media-app-configurator:v1.0.0@sha256:e3d8b18e0186f76dd3f3d4acacc9101b4abbf302d8f2afbb47cdd3879b1a1008 + image: getumbrel/media-app-configurator:v1.1.0@sha256:987f6a02367adf86ab1cff38e1e2d43d85e17a6fc130aae4af196fb571dff06a user: "1000:1000" restart: on-failure volumes: - ${APP_DATA_DIR}/data/config:/config environment: - DOWNLOAD_CLIENT_API_URL: "http://${APP_PROWLARR_IP}:${APP_PROWLARR_PORT}/api/v1/downloadclient" + APP_ID: "prowlarr" + APP_URL: "http://prowlarr_server_1:9696" TRANSMISSION_HOST: "transmission_server_1" TRANSMISSION_PORT: 9091 + RADARR_URL: "http://radarr_server_1:7878" + RADARR_CONFIG_XML: "${APP_PROWLARR_RADARR_CONFIG_XML}" + LIDARR_URL: "http://lidarr_server_1:8686" + LIDARR_CONFIG_XML: "${APP_PROWLARR_LIDARR_CONFIG_XML}" + SONARR_URL: "http://sonarr_server_1:8989" + SONARR_CONFIG_XML: "${APP_PROWLARR_SONARR_CONFIG_XML}" diff --git a/prowlarr/exports.sh b/prowlarr/exports.sh index 5011dd6..e2c9d58 100644 --- a/prowlarr/exports.sh +++ b/prowlarr/exports.sh @@ -1,2 +1,6 @@ export APP_PROWLARR_IP="10.21.25.8" -export APP_PROWLARR_PORT=9696 \ No newline at end of file +export APP_PROWLARR_PORT=9696 + +export APP_PROWLARR_RADARR_CONFIG_XML=$(cat "${UMBREL_ROOT}/app-data/radarr/data/config/config.xml" 2>/dev/null || echo "") +export APP_PROWLARR_LIDARR_CONFIG_XML=$(cat "${UMBREL_ROOT}/app-data/lidarr/data/config/config.xml" 2>/dev/null || echo "") +export APP_PROWLARR_SONARR_CONFIG_XML=$(cat "${UMBREL_ROOT}/app-data/sonarr/data/config/config.xml" 2>/dev/null || echo "") \ No newline at end of file diff --git a/prowlarr/umbrel-app.yml b/prowlarr/umbrel-app.yml index 7900795..96cf7bc 100644 --- a/prowlarr/umbrel-app.yml +++ b/prowlarr/umbrel-app.yml @@ -2,13 +2,14 @@ manifestVersion: 1 id: prowlarr category: Media name: Prowlarr -version: "0.4.4-nightly" +version: "0.4.4-nightly-build-2" tagline: Prowlarr is an indexer manager/proxy description: >- Prowlarr is an indexer manager/proxy built on the popular *arr .net/reactjs base stack to integrate with your various PVR apps. Prowlarr supports management of both Torrent Trackers and Usenet Indexers. It integrates seamlessly with Lidarr, Mylar3, Radarr, Readarr, and Sonarr offering complete management of your indexers with no per app Indexer setup required (we do it all). developer: Prowlarr website: https://prowlarr.com/ -dependencies: [] +dependencies: + - transmission repo: https://github.com/Prowlarr/Prowlarr support: https://github.com/Prowlarr/Prowlarr/issues port: 9696 @@ -19,8 +20,9 @@ gallery: path: "" defaultUsername: "" defaultPassword: "" +releaseNotes: >- + On installation of Sonarr, Lidarr or Radarr, Prowlarr will now automatically setup the app's connection within its settings torOnly: false permissions: - - STORAGE_DOWNLOADS -submitter: Umbrel + - STORAGE_DOWNLOADSsubmitter: Umbrel submission: https://github.com/getumbrel/umbrel-apps/commit/60878f278d544b204d8e7c96240c797f43a9b319 \ No newline at end of file diff --git a/radarr/hooks/post-install b/radarr/hooks/post-install new file mode 100755 index 0000000..255f4fe --- /dev/null +++ b/radarr/hooks/post-install @@ -0,0 +1,24 @@ +#!/usr/bin/env bash +set -euo pipefail + +if "${UMBREL_ROOT}/scripts/app" ls-installed | grep --quiet 'prowlarr' +then + CONFIG_FILE="${APP_DATA_DIR}/data/config/config.xml" + + # Wait for the config.xml file to exist + # Wait for the API key property () to exist in the config file + for attempt in $(seq 1 20); do + if [[ -f "${CONFIG_FILE}" ]] && cat "${CONFIG_FILE}" | grep --quiet ''; then + echo "config.xml file exists and xml key exists..." + + # Restart Prowlarr to automatically set this up as an app + "${UMBREL_ROOT}/scripts/app" restart prowlarr + + exit + fi + sleep 1 + done + + >&2 echo "Error: Failed to locate inside: ${CONFIG_FILE}" + exit 1 +fi \ No newline at end of file diff --git a/radarr/umbrel-app.yml b/radarr/umbrel-app.yml index 88bdd7c..24247d1 100644 --- a/radarr/umbrel-app.yml +++ b/radarr/umbrel-app.yml @@ -1,4 +1,4 @@ -manifestVersion: 1 +manifestVersion: 1.1 id: radarr category: Media name: Radarr diff --git a/sonarr/hooks/post-install b/sonarr/hooks/post-install new file mode 100755 index 0000000..255f4fe --- /dev/null +++ b/sonarr/hooks/post-install @@ -0,0 +1,24 @@ +#!/usr/bin/env bash +set -euo pipefail + +if "${UMBREL_ROOT}/scripts/app" ls-installed | grep --quiet 'prowlarr' +then + CONFIG_FILE="${APP_DATA_DIR}/data/config/config.xml" + + # Wait for the config.xml file to exist + # Wait for the API key property () to exist in the config file + for attempt in $(seq 1 20); do + if [[ -f "${CONFIG_FILE}" ]] && cat "${CONFIG_FILE}" | grep --quiet ''; then + echo "config.xml file exists and xml key exists..." + + # Restart Prowlarr to automatically set this up as an app + "${UMBREL_ROOT}/scripts/app" restart prowlarr + + exit + fi + sleep 1 + done + + >&2 echo "Error: Failed to locate inside: ${CONFIG_FILE}" + exit 1 +fi \ No newline at end of file diff --git a/sonarr/umbrel-app.yml b/sonarr/umbrel-app.yml index 1bf556f..1e97eb6 100644 --- a/sonarr/umbrel-app.yml +++ b/sonarr/umbrel-app.yml @@ -1,4 +1,4 @@ -manifestVersion: 1 +manifestVersion: 1.1 id: sonarr category: Media name: Sonarr