new stuff
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
{ config, containerCfg, pkgs, lib, builder, name, ... }:
|
||||
let
|
||||
serverCfg = config.syscfg.server;
|
||||
defaultModules = ["prowlarr" "sonarr" "radarr" "lidarr" "flaresolverr" ];
|
||||
|
||||
mkServarrImage = appName: appPkg: binaryPath: pkgs.dockerTools.streamLayeredImage {
|
||||
name = appPkg.name;
|
||||
@@ -25,7 +26,9 @@ let
|
||||
"${serverCfg.dataPath}/media:/media" # Fast hardlinking requires a single shared root
|
||||
"${serverCfg.configPath}/servarr:/config-root"
|
||||
];
|
||||
in {
|
||||
in
|
||||
assert containerCfg.subpath == null || throw "Error: Servarr does not support subpath.";
|
||||
{
|
||||
sops = true;
|
||||
# db = [ "prowlarr" "sonarr" "radarr" ]; -> one db for each
|
||||
|
||||
@@ -37,6 +40,7 @@ in {
|
||||
];
|
||||
|
||||
containers = {
|
||||
}// lib.optionalAttrs (builtins.elem "prowlarr" (containerCfg.extra.modules or defaultModules)) {
|
||||
prowlarr = builder.mkContainer {
|
||||
subdomain = containerCfg.subdomain;
|
||||
subpath = "prowlarr";
|
||||
@@ -48,7 +52,7 @@ in {
|
||||
"PROWLARR__AUTH__METHOD" = "External";
|
||||
"PROWLARR__SERVER__PORT" = "8989";
|
||||
"PROWLARR__SERVER__URLBASE" = "/prowlarr";
|
||||
"RADARR__LOG__ANALYTICSENABLED" = "False";
|
||||
"PROWLARR__LOG__ANALYTICSENABLED" = "False";
|
||||
};
|
||||
extraOptions = [
|
||||
"--user=0:0"
|
||||
@@ -58,6 +62,7 @@ in {
|
||||
overrides.volumes = sharedVolumes ++ [ "${serverCfg.configPath}/servarr/prowlarr:/config" ];
|
||||
};
|
||||
|
||||
}// lib.optionalAttrs (builtins.elem "radarr" (containerCfg.extra.modules or defaultModules)) {
|
||||
radarr = builder.mkContainer {
|
||||
subdomain = containerCfg.subdomain;
|
||||
subpath = "radarr";
|
||||
@@ -79,6 +84,7 @@ in {
|
||||
overrides.volumes = sharedVolumes ++ [ "${serverCfg.configPath}/servarr/radarr:/config" ];
|
||||
};
|
||||
|
||||
}// lib.optionalAttrs (builtins.elem "sonarr" (containerCfg.extra.modules or defaultModules)) {
|
||||
sonarr = builder.mkContainer {
|
||||
subdomain = containerCfg.subdomain;
|
||||
subpath = "sonarr";
|
||||
@@ -90,7 +96,7 @@ in {
|
||||
"SONARR__AUTH__METHOD" = "External";
|
||||
"SONARR__SERVER__PORT" = "8989";
|
||||
"SONARR__SERVER__URLBASE" = "/sonarr";
|
||||
"RADARR__LOG__ANALYTICSENABLED" = "False";
|
||||
"SONARR__LOG__ANALYTICSENABLED" = "False";
|
||||
};
|
||||
extraOptions = [
|
||||
"--user=0:0"
|
||||
@@ -100,8 +106,15 @@ in {
|
||||
overrides.volumes = sharedVolumes ++ [ "${serverCfg.configPath}/servarr/sonarr:/config" ];
|
||||
};
|
||||
|
||||
#bazarr = ...
|
||||
|
||||
}// lib.optionalAttrs (builtins.elem "readarr" (containerCfg.extra.modules or defaultModules)) {
|
||||
readarr = throw "Not Implemented";
|
||||
}// lib.optionalAttrs (builtins.elem "mylarr" (containerCfg.extra.modules or defaultModules)) {
|
||||
mylarr = throw "Not Implemented";
|
||||
}// lib.optionalAttrs (builtins.elem "bazarr" (containerCfg.extra.modules or defaultModules)) {
|
||||
bazarr = throw "Not Implemented";
|
||||
}// lib.optionalAttrs (builtins.elem "seerr" (containerCfg.extra.modules or defaultModules)) {
|
||||
seerr = throw "Not Implemented";
|
||||
}// lib.optionalAttrs (builtins.elem "flaresolverr" (containerCfg.extra.modules or defaultModules)) {
|
||||
flaresolverr = builder.mkContainer {
|
||||
image = "ghcr.io/flaresolverr/flaresolverr:latest";
|
||||
port = 8191;
|
||||
@@ -111,12 +124,69 @@ in {
|
||||
};
|
||||
};
|
||||
|
||||
# setup = {
|
||||
# trigger = "prowlarr"; # Triggers atomic environment verification on main controller
|
||||
# envFile = config.sops.secrets."SERVARR".path;
|
||||
# script = pkgs.writeShellScript "setup-servarr" ''
|
||||
# echo "Validating multi-container path permission nodes..."
|
||||
# # mkdir -p ${serverCfg.configPath}/servarr/{prowlarr,radarr,sonarr}
|
||||
# '';
|
||||
# };
|
||||
}
|
||||
setup = {
|
||||
trigger = "prowlarr"; # Triggers atomic environment verification on main controller
|
||||
envFile = config.sops.secrets."SERVARR".path;
|
||||
script = pkgs.writeShellScript "setup-servarr" ''
|
||||
|
||||
${lib.optionalString (lib.all (x: builtins.elem x (containerCfg.extra.modules or defaultModules)) [ "prowlarr" "flaresolverr" ]) ''
|
||||
PROWL_PROXY=$(${pkgs.curl}/bin/curl -s -X GET 'https://${containerCfg.subdomain}.${serverCfg.domain}/prowlarr/api/v1/indexerProxy' \
|
||||
-H "X-Api-Key: $PROWLARR__AUTH__APIKEY" -H 'X-Prowlarr-Client: true' \
|
||||
-H 'Accept: application/json' -H 'Content-Type: application/json')
|
||||
|
||||
${pkgs.curl}/bin/curl -s -X POST 'https://${containerCfg.subdomain}.${serverCfg.domain}/prowlarr/api/v1/indexerProxy' \
|
||||
-H "X-Api-Key: $PROWLARR__AUTH__APIKEY" -H 'X-Prowlarr-Client: true' \
|
||||
-H 'Accept: application/json' -H 'Content-Type: application/json' \
|
||||
-d '{"onHealthIssue":false,"supportsOnHealthIssue":false,"includeHealthWarnings":false,"name":"FlareSolverr","fields":[{"name":"host","value":"http://servarr-flaresolverr:8191/"},{"name":"requestTimeout","value":60}],"implementationName":"FlareSolverr","implementation":"FlareSolverr","configContract":"FlareSolverrSettings","infoLink":"https://wiki.servarr.com/prowlarr/supported#flaresolverr","tags":[]}'
|
||||
''}
|
||||
|
||||
PROWL_APPS=$(${pkgs.curl}/bin/curl -s -X GET 'https://${containerCfg.subdomain}.${serverCfg.domain}/prowlarr/api/v1/applications' \
|
||||
-H "X-Api-Key: $PROWLARR__AUTH__APIKEY" -H 'X-Prowlarr-Client: true' \
|
||||
-H 'Accept: application/json' -H 'Content-Type: application/json')
|
||||
|
||||
${lib.optionalString (lib.all (x: builtins.elem x (containerCfg.extra.modules or defaultModules)) [ "prowlarr" "sonarr" ]) ''
|
||||
${pkgs.curl}/bin/curl -s -X POST 'https://${containerCfg.subdomain}.${serverCfg.domain}/prowlarr/api/v1/applications' \
|
||||
-H "X-Api-Key: $PROWLARR__AUTH__APIKEY" -H 'X-Prowlarr-Client: true' \
|
||||
-H 'Accept: application/json' -H 'Content-Type: application/json' \
|
||||
-d '{"syncLevel":"fullSync","enable":true,"fields":[{"name":"prowlarrUrl","value":"http://servarr-prowlarr:8989"},{"name":"baseUrl","value":"https://servarr-sonarr:8989"},{"name":"apiKey","value":"'"$SONARR__AUTH__APIKEY"'"},{"name":"syncCategories","value":[5000,5010,5020,5030,5040,5045,5050,5090]},{"name":"animeSyncCategories","value":[5070]},{"name":"syncAnimeStandardFormatSearch","value":true},{"name":"syncRejectBlocklistedTorrentHashesWhileGrabbing","value":false}],"implementationName":"Sonarr","implementation":"Sonarr","configContract":"SonarrSettings","infoLink":"https://wiki.servarr.com/prowlarr/supported#sonarr","tags":[],"name":"Sonarr"}'
|
||||
''}
|
||||
|
||||
${lib.optionalString (lib.all (x: builtins.elem x (containerCfg.extra.modules or defaultModules)) [ "prowlarr" "lidarr" ]) ''
|
||||
${pkgs.curl}/bin/curl -s -X POST 'https://${containerCfg.subdomain}.${serverCfg.domain}/prowlarr/api/v1/applications' \
|
||||
-H "X-Api-Key: $PROWLARR__AUTH__APIKEY" -H 'X-Prowlarr-Client: true' \
|
||||
-H 'Accept: application/json' -H 'Content-Type: application/json' \
|
||||
-d '{"syncLevel":"fullSync","enable":true,"fields":[{"name":"prowlarrUrl","value":"http://servarr-prowlarr:8989"},{"name":"baseUrl","value":"https://servarr-lidarr:8989"},{"name":"apiKey","value":"'"$LIDARR__AUTH__APIKEY"'"},{"name":"syncCategories","value":[5000,5010,5020,5030,5040,5045,5050,5090]},{"name":"animeSyncCategories","value":[5070]},{"name":"syncAnimeStandardFormatSearch","value":true},{"name":"syncRejectBlocklistedTorrentHashesWhileGrabbing","value":false}],"implementationName":"Lidarr","implementation":"Lidarr","configContract":"LidarrSettings","infoLink":"https://wiki.servarr.com/prowlarr/supported#lidarr","tags":[],"name":"Lidarr"}'
|
||||
''}
|
||||
|
||||
${lib.optionalString (lib.all (x: builtins.elem x (containerCfg.extra.modules or defaultModules)) [ "prowlarr" "radarr" ]) ''
|
||||
${pkgs.curl}/bin/curl -s -X POST 'https://${containerCfg.subdomain}.${serverCfg.domain}/prowlarr/api/v1/applications' \
|
||||
-H "X-Api-Key: $PROWLARR__AUTH__APIKEY" -H 'X-Prowlarr-Client: true' \
|
||||
-H 'Accept: application/json' -H 'Content-Type: application/json' \
|
||||
-d '{"syncLevel":"fullSync","enable":true,"fields":[{"name":"prowlarrUrl","value":"http://servarr-prowlarr:8989"},{"name":"baseUrl","value":"https://servarr-radarr:8989"},{"name":"apiKey","value":"'"$RADARR__AUTH__APIKEY"'"},{"name":"syncCategories","value":[5000,5010,5020,5030,5040,5045,5050,5090]},{"name":"animeSyncCategories","value":[5070]},{"name":"syncAnimeStandardFormatSearch","value":true},{"name":"syncRejectBlocklistedTorrentHashesWhileGrabbing","value":false}],"implementationName":"Radarr","implementation":"Radarr","configContract":"RadarrSettings","infoLink":"https://wiki.servarr.com/prowlarr/supported#lidarr","tags":[],"name":"Radarr"}'
|
||||
''}
|
||||
|
||||
|
||||
${lib.optionalString (lib.all (x: builtins.elem x (containerCfg.extra.modules or defaultModules)) [ "prowlarr" "flaresolverr" ]) ''
|
||||
''}
|
||||
|
||||
${lib.optionalString ((lib.all (x: builtins.elem x (containerCfg.extra.modules or defaultModules)) [ "prowlarr" ]) && serverCfg.containers?transmission ) ''
|
||||
PROWL_DL=$(${pkgs.curl}/bin/curl -s -X GET 'https://${containerCfg.subdomain}.${serverCfg.domain}/prowlarr/api/v1/downloadclient' \
|
||||
-H "X-Api-Key: $PROWLARR__AUTH__APIKEY" -H 'X-Prowlarr-Client: true' \
|
||||
-H 'Accept: application/json' -H 'Content-Type: application/json')
|
||||
|
||||
${pkgs.curl}/bin/curl -s -X POST 'https://${containerCfg.subdomain}.${serverCfg.domain}/prowlarr/api/v1/downloadclient' \
|
||||
-H "X-Api-Key: $PROWLARR__AUTH__APIKEY" -H 'X-Prowlarr-Client: true' \
|
||||
-H 'Accept: application/json' -H 'Content-Type: application/json' \
|
||||
-d '{"enable":true,"protocol":"torrent","priority":1,"categories":[],"supportsCategories":true,"name":"Transmission","fields":[{"name":"host","value":"transmission-server"},{"name":"port","value":9091},{"name":"useSsl","value":false},{"name":"urlBase","value":"/transmission/"},{"name":"username"},{"name":"password"},{"name":"category"},{"name":"directory"},{"name":"priority","value":0},{"name":"addPaused","value":false}],"implementationName":"Transmission","implementation":"Transmission","configContract":"TransmissionSettings","infoLink":"https://wiki.servarr.com/prowlarr/supported#transmission","tags":[]}'
|
||||
''}
|
||||
${lib.optionalString (lib.all (x: builtins.elem x (containerCfg.extra.modules or defaultModules)) [ "prowlarr" ]) ''
|
||||
PROWL_IDX=$(${pkgs.curl}/bin/curl -s -X GET 'https://${containerCfg.subdomain}.${serverCfg.domain}/prowlarr/api/v1/indexer' \
|
||||
-H "X-Api-Key: $PROWLARR__AUTH__APIKEY" -H 'X-Prowlarr-Client: true' \
|
||||
-H 'Accept: application/json' -H 'Content-Type: application/json')
|
||||
echo $PROWL_IDX
|
||||
#... For extra.indexer -> ...
|
||||
''}
|
||||
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user