sonarr reached its download clients as nzbget:6789 and qbittorrent:8112 and its indexers through jackett:9117 or indexers.zurag.be - HAL container names and a public route, typed into its database by hand. Nothing on the mesh answers those names. It now requires nzbget-api, qbittorrent-api and jackett-api. A run-once step (downloads/, declared last, restart-on its bindings, credentials and settings) writes host, port, TLS, base path, user and credential into sonarr through sonarr's own API: - A download client is the mesh's when its name is downloads.<provision>.name and its kind the provider's; it is registered when missing. A jackett feed is the mesh's when its host is the bound one, one the step bound before, or one in downloads.jackett-api.adopt-hosts; the jackett indexers in downloads.jackett-api.indexers are registered when missing. Every other entry is left alone, and nothing is ever deleted. - Only connection fields, only when they differ. The stored password is masked, so the app tests the entry with the credential it holds; only if that fails is the delivered one written. Categories, priorities and "enabled" are never touched. - Each credential is tried against its provider first. A minted value (nothing accepted yet) is never written; the step exits 1 naming the exact secret accept. The step is byte-identical in sonarr, radarr, lidarr and bookshelf (the same Servarr API, v3 or v1): each module builds from its own directory, so each carries a copy, and test/downloads.test.ts fails if a sibling's copy differs. Verified: strict typecheck, the Dockerfile build, 14 unit tests; and the compiled step against fresh pinned sonarr/radarr/lidarr/bookshelf with throwaway nzbget, qBittorrent and jackett - minted credentials refused with nothing written, accepted ones registered and tested by the app, a migration-shaped radarr repointed, reruns unchanged.
206 lines
5.3 KiB
JSON
206 lines
5.3 KiB
JSON
{
|
|
"module": "sonarr",
|
|
"version": "1",
|
|
"provides": [
|
|
{
|
|
"name": "sonarr-api",
|
|
"scope": "mesh"
|
|
}
|
|
],
|
|
"serves": {
|
|
"sonarr-api": {
|
|
"scheme": "http",
|
|
"port": 8989,
|
|
"url-base": ""
|
|
}
|
|
},
|
|
"capabilities": [
|
|
"container-runtime"
|
|
],
|
|
"emits": [
|
|
"episode.grabbed",
|
|
"download.completed"
|
|
],
|
|
"consumes": [],
|
|
"own-secrets": {
|
|
"broker": "/var/lib/mesh/sonarr/broker"
|
|
},
|
|
"listens": [
|
|
{
|
|
"name": "web",
|
|
"port": 8989,
|
|
"protocol": "tcp",
|
|
"from": "mesh",
|
|
"why": "managing series: its web UI, and the API other modules reach as sonarr-api"
|
|
}
|
|
],
|
|
"accesses": [
|
|
{
|
|
"path": "/services/media/series",
|
|
"mode": "read-write"
|
|
},
|
|
{
|
|
"path": "/services/media/anime",
|
|
"mode": "read-write"
|
|
},
|
|
{
|
|
"path": "/services/media/downloads",
|
|
"mode": "read-write"
|
|
}
|
|
],
|
|
"resources": [
|
|
{
|
|
"id": "mesh-state",
|
|
"type": "directory",
|
|
"path": "/var/lib/mesh/sonarr",
|
|
"mode": "0700"
|
|
},
|
|
{
|
|
"id": "state",
|
|
"type": "directory",
|
|
"mode": "0700",
|
|
"place": "."
|
|
},
|
|
{
|
|
"id": "config",
|
|
"type": "directory",
|
|
"mode": "0700",
|
|
"owner": "1000:1000"
|
|
},
|
|
{
|
|
"id": "server",
|
|
"type": "container",
|
|
"name": "sonarr",
|
|
"image": "lscr.io/linuxserver/sonarr@sha256:a5c1a5fecbef946927ab90ad68df319ac5fe644057e5fc18cd993f01ac07b2b2",
|
|
"env": {
|
|
"PUID": "1000",
|
|
"PGID": "1000",
|
|
"TZ": "Etc/UTC"
|
|
},
|
|
"ports": [
|
|
"8989"
|
|
],
|
|
"volumes": [
|
|
"${dir:config}:/config",
|
|
"/services/media/series:/series",
|
|
"/services/media/anime:/anime",
|
|
"/services/media/downloads:/downloads"
|
|
]
|
|
},
|
|
{
|
|
"id": "runtime",
|
|
"type": "container",
|
|
"name": "mesh-sonarr",
|
|
"network": "host",
|
|
"volumes": [
|
|
"/var/lib/mesh/sonarr/broker:/run/secrets/broker:ro",
|
|
"${dir:config}:/var/lib/sonarr/config:ro"
|
|
],
|
|
"env": {
|
|
"MESH_BROKER_FILE": "/run/secrets/broker",
|
|
"MESH_SONARR_URL": "http://127.0.0.1:${port:8989}",
|
|
"MESH_SONARR_CONFIG_DIR": "/var/lib/sonarr/config"
|
|
},
|
|
"artifact": "runtime"
|
|
},
|
|
{
|
|
"id": "downloads-config",
|
|
"type": "file",
|
|
"path": "${dir:state}/downloads.json",
|
|
"mode": "0600",
|
|
"content": "{\n \"node\": \"${machine:name}\",\n \"downloads\": {\n \"nzbget-api\": {\n \"name\": \"nzbget\"\n },\n \"qbittorrent-api\": {\n \"name\": \"qbittorrent\"\n },\n \"jackett-api\": {\n \"adopt-hosts\": [],\n \"indexers\": []\n }\n }\n}\n",
|
|
"merge": "json"
|
|
},
|
|
{
|
|
"id": "downloads-memory",
|
|
"type": "directory",
|
|
"mode": "0700"
|
|
},
|
|
{
|
|
"id": "downloads",
|
|
"type": "container",
|
|
"name": "mesh-sonarr-downloads",
|
|
"network": "host",
|
|
"run-once": true,
|
|
"volumes": [
|
|
"${dir:state}/downloads.json:/run/downloads/downloads.json:ro",
|
|
"${dir:state}/nzbget-api.json:/run/downloads/nzbget-api.json:ro",
|
|
"${dir:state}/nzbget-api.secret:/run/downloads/nzbget-api.secret:ro",
|
|
"${dir:state}/qbittorrent-api.json:/run/downloads/qbittorrent-api.json:ro",
|
|
"${dir:state}/qbittorrent-api.secret:/run/downloads/qbittorrent-api.secret:ro",
|
|
"${dir:state}/jackett-api.json:/run/downloads/jackett-api.json:ro",
|
|
"${dir:state}/jackett-api.secret:/run/downloads/jackett-api.secret:ro",
|
|
"${dir:config}:/var/lib/sonarr/config:ro",
|
|
"${dir:downloads-memory}:/var/lib/downloads"
|
|
],
|
|
"env": {
|
|
"MESH_DOWNLOADS_APP": "sonarr",
|
|
"MESH_DOWNLOADS_API": "v3",
|
|
"MESH_DOWNLOADS_APP_URL": "http://127.0.0.1:${port:8989}",
|
|
"MESH_DOWNLOADS_APP_CONFIG": "/var/lib/sonarr/config/config.xml",
|
|
"MESH_DOWNLOADS_DIR": "/run/downloads",
|
|
"MESH_DOWNLOADS_SETTINGS": "/run/downloads/downloads.json",
|
|
"MESH_DOWNLOADS_MEMORY": "/var/lib/downloads/memory.json"
|
|
},
|
|
"args": [
|
|
"run",
|
|
"/app/modules/sonarr/dist/downloads/index.js"
|
|
],
|
|
"restart-on": [
|
|
"downloads-config",
|
|
"bound-nzbget-api",
|
|
"secret-nzbget-api",
|
|
"bound-qbittorrent-api",
|
|
"secret-qbittorrent-api",
|
|
"bound-jackett-api",
|
|
"secret-jackett-api"
|
|
],
|
|
"artifact": "runtime"
|
|
}
|
|
],
|
|
"requires": [
|
|
"jackett-api",
|
|
"nzbget-api",
|
|
"qbittorrent-api",
|
|
"route"
|
|
],
|
|
"contributes": {
|
|
"route": {
|
|
"label": "series",
|
|
"endpoint": "web"
|
|
}
|
|
},
|
|
"binds": {
|
|
"route": "${dir:state}/route.json",
|
|
"nzbget-api": "${dir:state}/nzbget-api.json",
|
|
"qbittorrent-api": "${dir:state}/qbittorrent-api.json",
|
|
"jackett-api": "${dir:state}/jackett-api.json"
|
|
},
|
|
"secrets": {
|
|
"nzbget-api": "${dir:state}/nzbget-api.secret",
|
|
"qbittorrent-api": "${dir:state}/qbittorrent-api.secret",
|
|
"jackett-api": "${dir:state}/jackett-api.secret"
|
|
},
|
|
"build": {
|
|
"on": [
|
|
{
|
|
"arg": "BUILD_BASE",
|
|
"module": "mesh-tools",
|
|
"artifact": "build"
|
|
},
|
|
{
|
|
"arg": "RUNTIME_BASE",
|
|
"module": "mesh-tools",
|
|
"artifact": "runtime"
|
|
}
|
|
],
|
|
"artifacts": [
|
|
{
|
|
"name": "runtime",
|
|
"kind": "image",
|
|
"from": "Dockerfile"
|
|
}
|
|
]
|
|
}
|
|
}
|