summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorRomain Gallet2024-03-24 22:34:18 +0100
committerRomain Gallet2024-03-25 14:53:58 +0100
commit508e979ae8f4fbe498302f23acbfb30d51f253c7 (patch)
tree0fa8c4f7caff78c08787a600f22e7c764045406a
parent2d7ee6a6ee6348e14f72049b46b79a3009e323ec (diff)
downloadaur-508e979ae8f4fbe498302f23acbfb30d51f253c7.tar.gz
Separate directories to each services
-rw-r--r--.SRCINFO6
-rw-r--r--.gitignore2
-rw-r--r--PKGBUILD36
-rw-r--r--Readme.md71
-rw-r--r--default.env17
-rw-r--r--docker-compose.yaml20
-rw-r--r--docker.env19
-rw-r--r--sabnzbd-docker.install9
-rw-r--r--sabnzbd-docker.service2
9 files changed, 151 insertions, 31 deletions
diff --git a/.SRCINFO b/.SRCINFO
index f8af06e57481..bf0fed41bf08 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -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
diff --git a/PKGBUILD b/PKGBUILD
index a1d4af631e06..bbd9ac1411c3 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -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