diff options
-rw-r--r-- | .SRCINFO | 6 | ||||
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | PKGBUILD | 36 | ||||
-rw-r--r-- | Readme.md | 71 | ||||
-rw-r--r-- | default.env | 17 | ||||
-rw-r--r-- | docker-compose.yaml | 20 | ||||
-rw-r--r-- | docker.env | 19 | ||||
-rw-r--r-- | sabnzbd-docker.install | 9 | ||||
-rw-r--r-- | sabnzbd-docker.service | 2 |
9 files changed, 151 insertions, 31 deletions
@@ -10,10 +10,10 @@ pkgbase = sabnzbd-docker source = file://sabnzbd-docker-update.service source = file://docker-compose.yaml source = file://default.env - md5sums = 94ffcf6e8447d6177fdafe8ec48dbb23 + md5sums = 09d427d3b1de5bb5d14d674d18b778df md5sums = 6fd19f267a71ba90a6a4f3177570e416 md5sums = 80456723536c022e86d7e1f9970792ef - md5sums = 4a2c0fe817f64b3bd81577bef85d64e1 - md5sums = 8d223e192e5fb25de96ed7dc6fb0c8d1 + md5sums = 2b152775fc07e01aed4f13e2e738452b + md5sums = 7e7a4426d5decc539d71a4ddde152b4b pkgname = sabnzbd-docker diff --git a/.gitignore b/.gitignore index ed45410df8fc..0a9e781d318d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ pkg/ src/ *.zst +*.iml +.idea
\ No newline at end of file @@ -4,7 +4,7 @@ _packager="Romain Gallet <romain.gallet at gmail.com>" pkgver=0.3 pkgname=sabnzbd-docker pkgrel=2 -pkgdesc='Convienience launch service for Sabnzd in docker' +pkgdesc='Convenience launch service for Sabnzd, Nzbhydra2 and Sonarr in docker' arch=('x86_64') license=('MIT') groups=() @@ -15,23 +15,31 @@ optdepends=() provides=() backup=() options=() -source=("file://sabnzbd-docker.service" "file://sabnzbd-docker-update.timer" "file://sabnzbd-docker-update.service" "file://docker-compose.yaml" "file://default.env") -md5sums=('94ffcf6e8447d6177fdafe8ec48dbb23' +install=sabnzbd-docker.install +source=("file://sabnzbd-docker.service" + "file://sabnzbd-docker-update.timer" + "file://sabnzbd-docker-update.service" + "file://docker-compose.yaml" + "file://default.env" + "file://docker.env") +md5sums=('09d427d3b1de5bb5d14d674d18b778df' '6fd19f267a71ba90a6a4f3177570e416' '80456723536c022e86d7e1f9970792ef' - '4a2c0fe817f64b3bd81577bef85d64e1' - '8d223e192e5fb25de96ed7dc6fb0c8d1') + '86c471c654c795796dbef4f8f2f4bb8f' + '55a3e51b6074df2959798d99b60e38b4' + '6af9cc13d7ddf3b2721208ef4bdc156f') noextract=() - package() { - mkdir -p ${pkgdir}/opt/docker-sabnzbd - cp docker-compose.yaml ${pkgdir}/opt/docker-sabnzbd - cp default.env ${pkgdir}/opt/docker-sabnzbd + dest=${pkgdir}/opt/docker-sabnzbd + mkdir -p ${dest} + cp docker-compose.yaml ${dest} + cp default.env ${dest} # for Unit service + cp docker.env ${dest}/.env # for docker-compose - mkdir -p ${pkgdir}/etc/systemd/user/ - cp sabnzbd-docker.service ${pkgdir}/etc/systemd/user/ - cp sabnzbd-docker-update.service ${pkgdir}/etc/systemd/user/ - cp sabnzbd-docker-update.timer ${pkgdir}/etc/systemd/user/ + dest=${pkgdir}/usr/lib/systemd/user/ + mkdir -p ${dest} + cp sabnzbd-docker.service ${dest} + cp sabnzbd-docker-update.service ${dest} + cp sabnzbd-docker-update.timer ${dest} } - diff --git a/Readme.md b/Readme.md index e69de29bb2d1..1fb7649868c6 100644 --- a/Readme.md +++ b/Readme.md @@ -0,0 +1,71 @@ +Sabnzbd-docker +============== + +`sabnzbd-docker` is a service unit that starts `sabnzbd`, `nzbhydra2` and `sonarr` in their respective docker +containers. + +## Configuration + +1. Create a user config file at `~/.docker-sabnzbd.env` with the following content: + + # you may choose different paths for each service + + SABNZBD_PATH_PREFIX = /path/to/prefix + NZBHYDRA2_PATH_PREFIX = /path/to/prefix + SONARR_PATH_PREFIX = /path/to/prefix + + For example, you can run it with something like: + + cat ~/.docker-sabnzbd.env + + TZ=Europe/Madrid + COMPOSE_PROFILES=sabnzbd,nzbhydra2 # does not start sonarr + + SABNZBD_PATH_PREFIX=/data/banjo/Downloads/sabnzbd # config and logs + SABNZBD_PATH_DOWNLOADS=/data/banjo/Downloads # downloads will go one level up + + NZBHYDRA2_PATH_PREFIX=/data/banjo/Downloads/nzbhydra2 # config, logs and everything + +2. Create the following directories (for services you choose to run): + + # SABNZBD + mkdir -p /path/to/prefix/sabnzbd/config # /config + mkdir -p /path/to/prefix/sabnzbd/temp # /incomplete-downloads + mkdir -p /path/to/prefix/sabnzbd/downloads # /downloads + + # NZBHydra2 + mkdir -p /path/to/prefix/nzbhydra2/config # /config + + # Sonarr + mkdir -p /path/to/prefix/sonarr/config # /config + mkdir -p /path/to/prefix/sonarr/tv # /tv + mkdir -p /path/to/prefix/sonarr/downloads # /downloads + +3. _Optional._ Defines the services to start in the same user config file: + + COMPOSE_PROFILES=sabnzbd,nzbhydra2,sonarr # default is 'all' + +4. _Optional._ Set the ports for the services in the same user config file: + + SABNZBD_PORT = 8080 + NZBHYDRA2_PORT = 5076 + SONARR_PORT = 8989 + +## Installation + + makepkg + + pacman -U sabnzbd-docker-x.y-z-x86_64.pkg.tar.zst + +## Usage + + # Optional. sabnzbd-docker-update.timer pull new updates from docker hub each day + systemctl --user start sabnzbd-docker-update.timer + systemctl --user enable sabnzbd-docker-update.timer + + systemctl --user start sabnzbd-docker + systemctl --user enable sabnzbd-docker + +Navigate to [http://localhost:8080](http://localhost:8080) to access `sabnzbd`. + +Configure `sabnzbd`, `nzbhydra2` and `sonarr` to use the mapped directories defined in step 2.
\ No newline at end of file diff --git a/default.env b/default.env index 707edd40b5d2..acad9686ffb3 100644 --- a/default.env +++ b/default.env @@ -1,8 +1,19 @@ +# DO NOT MODIFY THIS FILE DIRECTLY +# This file is used to set default values for the environment variables used in the sabnzbd-docker.service unit file. +# +# Override values in ~/.docker-sabnzbd.env + TZ=Etc/UTC -PATH_PREFIX=/tmp +COMPOSE_PROFILES=all +# Sabnzbd SABNZBD_PORT=8080 -NZBHYDRA2_PORT=5076 -SONARR_PORT=8989 +SABNZBD_PATH_PREFIX=/tmp/sabnzbd +# NzbHydra2 +NZBHYDRA2_PORT=5076 +NZBHYDRA2_PATH_PREFIX=/tmp/nzbhydra2 +# Sonarr +SONARR_PORT=8989 +SONARR_PATH_PREFIX=/tmp/sonarr diff --git a/docker-compose.yaml b/docker-compose.yaml index 06ca05fa8718..7eaf55361c68 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -18,36 +18,36 @@ services: sabnzbd: image: lscr.io/linuxserver/sabnzbd:latest container_name: sabnzbd + profiles: ["all", "sabnzbd"] <<: *default volumes: - - ${PATH_PREFIX}/sabnzbd/config:/config - - ${PATH_PREFIX}:/downloads - - ${PATH_PREFIX}/temp:/incomplete-downloads + - ${SABNZBD_PATH_CONFIG}:/config + - ${SABNZBD_PATH_INCOMPLETE_DOWNLOADS}:/incomplete-downloads + - ${SABNZBD_PATH_DOWNLOADS}:/downloads ports: - ${SABNZBD_PORT}:8080 nzbhydra2: image: lscr.io/linuxserver/nzbhydra2:latest container_name: nzbhydra2 + profiles: ["all", "nzbhydra2"] <<: *default volumes: - - ${PATH_PREFIX}/nzbhydra2/config:/config - - ${PATH_PREFIX}:/downloads + - ${NZBHYDRA2_PATH_CONFIG}:/config ports: - ${NZBHYDRA2_PORT}:5076 sonarr: image: lscr.io/linuxserver/sonarr:latest container_name: sonarr + profiles: ["all", "sonarr"] <<: *default volumes: - - ${PATH_PREFIX}/sonarr/config:/config - - ${PATH_PREFIX}/tv:/tv - - ${PATH_PREFIX}:/downloads + - ${SONARR_PATH_CONFIG}:/config + - ${SONARR_PATH_TV}:/tv + - ${SONARR_PATH_DOWNLOADS}:/downloads ports: - ${SONARR_PORT}:8989 - networks: nzb: - diff --git a/docker.env b/docker.env new file mode 100644 index 000000000000..07b4ecd7aff4 --- /dev/null +++ b/docker.env @@ -0,0 +1,19 @@ +# DO NOT MODIFY THIS FILE DIRECTLY +# This file is used to set default values for the environment variables used in the docker-compose.yaml file. +# The package installer copies this file to /opt/sabnzbd-docker/.env. +# Only the .env file allows volume mounts to be used with environment variable substitions coming from a file. +# +# Override values in ~/.docker-sabnzbd.env + +# Sabnzbd +SABNZBD_PATH_CONFIG=${SABNZBD_PATH_PREFIX}/config +SABNZBD_PATH_INCOMPLETE_DOWNLOADS=${SABNZBD_PATH_PREFIX}/incomplete-downloads +SABNZBD_PATH_DOWNLOADS=${SABNZBD_PATH_PREFIX}/downloads + +# NzbHydra2 +NZBHYDRA2_PATH_CONFIG=${NZBHYDRA2_PATH_PREFIX}/config + +# Sonarr +SONARR_PATH_CONFIG=${SONARR_PATH_PREFIX}/config +SONARR_PATH_TV=${SONARR_PATH_PREFIX}/tv +SONARR_PATH_DOWNLOADS=${SONARR_PATH_PREFIX}/downloads
\ No newline at end of file diff --git a/sabnzbd-docker.install b/sabnzbd-docker.install new file mode 100644 index 000000000000..db45ec08f6f4 --- /dev/null +++ b/sabnzbd-docker.install @@ -0,0 +1,9 @@ +post_install() { + echo "Enable service with:" + echo " systemctl --user enable --now sabnzbd-docker.service" + + echo + + echo "Enable timer with:" + echo " systemctl --user enable --now sabnzbd-docker-update.timer" +} diff --git a/sabnzbd-docker.service b/sabnzbd-docker.service index 16480db71d2f..352569cb0585 100644 --- a/sabnzbd-docker.service +++ b/sabnzbd-docker.service @@ -14,5 +14,5 @@ ExecStart=docker compose -f /opt/docker-sabnzbd/docker-compose.yaml up ExecStop=docker compose -f /opt/docker-sabnzbd/docker-compose.yaml down [Install] -WantedBy=sabnzbd-docker-update.service +WantedBy=default.target |