Skip to content

Commit

Permalink
Fixed docker compose network
Browse files Browse the repository at this point in the history
Added rd mount path to repair volumes
Only check symlinks if they point to the rd mount path during repair
Added a couple more instance options to the docker compose and commented all the ones not enabled by default
  • Loading branch information
westsurname authored May 22, 2024
1 parent 9be9b82 commit c30808c
Show file tree
Hide file tree
Showing 4 changed files with 94 additions and 38 deletions.
3 changes: 2 additions & 1 deletion .env.template
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,5 @@ PYTHONUNBUFFERED=TRUE
PUID=
PGID=
UMASK=002
DOCKER_NETWORK="docker_network_default"
DOCKER_NETWORK="scripts_default"
DOCKER_NETWORK_EXTERNAL=false
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
- `PGID`: Set this to the group ID that the service should run as.
- `UMASK`: Set this to control the default file creation permissions.
- `DOCKER_NETWORK`: Set this to the name of the Docker network to be used by the services.
- `DOCKER_NETWORK_EXTERNAL`: Set this to `true` if specifying an external Docker network above, otherwise set to `false`.
## Blackhole
Expand Down
123 changes: 89 additions & 34 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: '3.8'

x-blackhole: &blackhole
build:
context: .
Expand All @@ -9,8 +7,6 @@ x-blackhole: &blackhole
env_file:
- .env
restart: unless-stopped
networks:
- ${DOCKER_NETWORK:-docker_network_default}

x-repair: &repair
build:
Expand All @@ -21,8 +17,6 @@ x-repair: &repair
env_file:
- .env
restart: unless-stopped
networks:
- ${DOCKER_NETWORK:-docker_network_default}

services:
blackhole:
Expand All @@ -36,41 +30,101 @@ services:
- ${BLACKHOLE_BASE_WATCH_PATH}/${BLACKHOLE_RADARR_PATH}:/${BLACKHOLE_BASE_WATCH_PATH}/${BLACKHOLE_RADARR_PATH}
profiles: [blackhole, blackhole_all, all]

blackhole_4k:
<<: *blackhole
container_name: blackhole_4k_service
environment:
- SONARR_HOST=${SONARR_HOST_4K}
- SONARR_API_KEY=${SONARR_API_KEY_4K}
- RADARR_HOST=${RADARR_HOST_4K}
- RADARR_API_KEY=${RADARR_API_KEY_4K}
- BLACKHOLE_BASE_WATCH_PATH=/${BLACKHOLE_BASE_WATCH_PATH}
volumes:
- ${BLACKHOLE_RD_MOUNT_TORRENTS_PATH}:${BLACKHOLE_RD_MOUNT_TORRENTS_PATH}
- ${BLACKHOLE_BASE_WATCH_PATH}/${BLACKHOLE_SONARR_PATH} 4k:/${BLACKHOLE_BASE_WATCH_PATH}/${BLACKHOLE_SONARR_PATH}
- ${BLACKHOLE_BASE_WATCH_PATH}/${BLACKHOLE_RADARR_PATH} 4k:/${BLACKHOLE_BASE_WATCH_PATH}/${BLACKHOLE_RADARR_PATH}
profiles: [blackhole_4k, blackhole_all, all]
# blackhole_4k:
# <<: *blackhole
# container_name: blackhole_4k_service
# environment:
# - SONARR_HOST=${SONARR_HOST_4K}
# - SONARR_API_KEY=${SONARR_API_KEY_4K}
# - RADARR_HOST=${RADARR_HOST_4K}
# - RADARR_API_KEY=${RADARR_API_KEY_4K}
# - BLACKHOLE_BASE_WATCH_PATH=/${BLACKHOLE_BASE_WATCH_PATH}
# volumes:
# - ${BLACKHOLE_RD_MOUNT_TORRENTS_PATH}:${BLACKHOLE_RD_MOUNT_TORRENTS_PATH}
# - ${BLACKHOLE_BASE_WATCH_PATH}/${BLACKHOLE_SONARR_PATH} 4k:/${BLACKHOLE_BASE_WATCH_PATH}/${BLACKHOLE_SONARR_PATH}
# - ${BLACKHOLE_BASE_WATCH_PATH}/${BLACKHOLE_RADARR_PATH} 4k:/${BLACKHOLE_BASE_WATCH_PATH}/${BLACKHOLE_RADARR_PATH}
# profiles: [blackhole_4k, blackhole_all, all]

# blackhole_anime:
# <<: *blackhole
# container_name: blackhole_anime_service
# environment:
# - SONARR_HOST=${SONARR_HOST_ANIME}
# - SONARR_API_KEY=${SONARR_API_KEY_ANIME}
# - RADARR_HOST=${RADARR_HOST_ANIME}
# - RADARR_API_KEY=${RADARR_API_KEY_ANIME}
# - BLACKHOLE_BASE_WATCH_PATH=/${BLACKHOLE_BASE_WATCH_PATH}
# volumes:
# - ${BLACKHOLE_RD_MOUNT_TORRENTS_PATH}:${BLACKHOLE_RD_MOUNT_TORRENTS_PATH}
# - ${BLACKHOLE_BASE_WATCH_PATH}/${BLACKHOLE_SONARR_PATH} anime:/${BLACKHOLE_BASE_WATCH_PATH}/${BLACKHOLE_SONARR_PATH}
# - ${BLACKHOLE_BASE_WATCH_PATH}/${BLACKHOLE_RADARR_PATH} anime:/${BLACKHOLE_BASE_WATCH_PATH}/${BLACKHOLE_RADARR_PATH}
# profiles: [blackhole_anime, blackhole_all, all]

# blackhole_mux:
# <<: *blackhole
# container_name: blackhole_mux_service
# environment:
# - SONARR_HOST=${SONARR_HOST_MUX}
# - SONARR_API_KEY=${SONARR_API_KEY_MUX}
# - RADARR_HOST=${RADARR_HOST_MUX}
# - RADARR_API_KEY=${RADARR_API_KEY_MUX}
# - BLACKHOLE_BASE_WATCH_PATH=/${BLACKHOLE_BASE_WATCH_PATH}
# volumes:
# - ${BLACKHOLE_RD_MOUNT_TORRENTS_PATH}:${BLACKHOLE_RD_MOUNT_TORRENTS_PATH}
# - ${BLACKHOLE_BASE_WATCH_PATH}/${BLACKHOLE_SONARR_PATH} mux:/${BLACKHOLE_BASE_WATCH_PATH}/${BLACKHOLE_SONARR_PATH}
# - ${BLACKHOLE_BASE_WATCH_PATH}/${BLACKHOLE_RADARR_PATH} mux:/${BLACKHOLE_BASE_WATCH_PATH}/${BLACKHOLE_RADARR_PATH}
# profiles: [blackhole_mux, blackhole_all, all]

repair_service:
<<: *repair
container_name: repair_service
volumes:
- ${BLACKHOLE_RD_MOUNT_TORRENTS_PATH}:${BLACKHOLE_RD_MOUNT_TORRENTS_PATH}
- ${SONARR_ROOT_FOLDER}:${SONARR_ROOT_FOLDER}
- ${RADARR_ROOT_FOLDER}:${RADARR_ROOT_FOLDER}
profiles: [repair, repair_all, all]

repair_4k:
<<: *repair
container_name: repair_4k_service
environment:
- SONARR_HOST=${SONARR_HOST_4K}
- SONARR_API_KEY=${SONARR_API_KEY_4K}
- RADARR_HOST=${RADARR_HOST_4K}
- RADARR_API_KEY=${RADARR_API_KEY_4K}
volumes:
- ${SONARR_ROOT_FOLDER_4K}:${SONARR_ROOT_FOLDER}
- ${RADARR_ROOT_FOLDER_4K}:${RADARR_ROOT_FOLDER}
profiles: [repair_4k, repair_all, all]
# repair_4k:
# <<: *repair
# container_name: repair_4k_service
# environment:
# - SONARR_HOST=${SONARR_HOST_4K}
# - SONARR_API_KEY=${SONARR_API_KEY_4K}
# - RADARR_HOST=${RADARR_HOST_4K}
# - RADARR_API_KEY=${RADARR_API_KEY_4K}
# volumes:
# - ${BLACKHOLE_RD_MOUNT_TORRENTS_PATH}:${BLACKHOLE_RD_MOUNT_TORRENTS_PATH}
# - ${SONARR_ROOT_FOLDER_4K}:${SONARR_ROOT_FOLDER}
# - ${RADARR_ROOT_FOLDER_4K}:${RADARR_ROOT_FOLDER}
# profiles: [repair_4k, repair_all, all]

# repair_anime:
# <<: *repair
# container_name: repair_anime_service
# environment:
# - SONARR_HOST=${SONARR_HOST_ANIME}
# - SONARR_API_KEY=${SONARR_API_KEY_ANIME}
# - RADARR_HOST=${RADARR_HOST_ANIME}
# - RADARR_API_KEY=${RADARR_API_KEY_ANIME}
# volumes:
# - ${BLACKHOLE_RD_MOUNT_TORRENTS_PATH}:${BLACKHOLE_RD_MOUNT_TORRENTS_PATH}
# - ${SONARR_ROOT_FOLDER_ANIME}:${SONARR_ROOT_FOLDER}
# - ${RADARR_ROOT_FOLDER_ANIME}:${RADARR_ROOT_FOLDER}
# profiles: [repair_anime, repair_all, all]

# repair_mux:
# <<: *repair
# container_name: repair_mux_service
# environment:
# - SONARR_HOST=${SONARR_HOST_MUX}
# - SONARR_API_KEY=${SONARR_API_KEY_MUX}
# - RADARR_HOST=${RADARR_HOST_MUX}
# - RADARR_API_KEY=${RADARR_API_KEY_MUX}
# volumes:
# - ${BLACKHOLE_RD_MOUNT_TORRENTS_PATH}:${BLACKHOLE_RD_MOUNT_TORRENTS_PATH}
# - ${SONARR_ROOT_FOLDER_MUX}:${SONARR_ROOT_FOLDER}
# - ${RADARR_ROOT_FOLDER_MUX}:${RADARR_ROOT_FOLDER}
# profiles: [repair_mux, repair_all, all]

watchlist:
build:
Expand Down Expand Up @@ -118,5 +172,6 @@ services:
profiles: [plex_request, all]

networks:
${DOCKER_NETWORK:-docker_network_default}:
external: true
default:
name: ${DOCKER_NETWORK:-scripts_default}
external: ${DOCKER_NETWORK_EXTERNAL:-false}
5 changes: 2 additions & 3 deletions repair.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import time
from shared.arr import Sonarr, Radarr
from shared.discord import discordUpdate
from shared.shared import repair, intersperse
from shared.shared import repair, blackhole, intersperse

def parse_interval(interval_str):
"""Parse a smart interval string (e.g., '1w2d3h4m5s') into seconds."""
Expand Down Expand Up @@ -71,8 +71,7 @@ def main():
realPath = os.path.realpath(fullPath)
realPaths.append(realPath)


if os.path.islink(fullPath) and not os.path.exists(realPath):
if os.path.islink(fullPath) and realPath.startswith(blackhole['rdMountTorrentsPath']) and not os.path.exists(realPath):
brokenSymlinks.append(realPath)

# If not full season just repair individual episodes?
Expand Down

0 comments on commit c30808c

Please sign in to comment.