From aee53560e30d19ea6a493b48574d7e68c2180fff Mon Sep 17 00:00:00 2001 From: ahuston-0 Date: Sat, 13 Dec 2025 23:00:30 -0500 Subject: [PATCH] initial postgres arr migration --- systems/palatine-hill/docker/arr.nix | 40 +++++++++++++++++++++++----- systems/palatine-hill/zfs.nix | 2 +- 2 files changed, 35 insertions(+), 7 deletions(-) diff --git a/systems/palatine-hill/docker/arr.nix b/systems/palatine-hill/docker/arr.nix index 4ced2f6..1bf400c 100644 --- a/systems/palatine-hill/docker/arr.nix +++ b/systems/palatine-hill/docker/arr.nix @@ -6,6 +6,17 @@ }: let vars = import ../vars.nix; + arr_postgres_config = + container_type: + let + ctype = lib.strings.toUpper container_type; + in + { + "${ctype}__POSTGRES__HOST" = "host.docker.internal"; + "${ctype}__POSTGRES__USER" = "SOPS_ONLY"; + "${ctype}__POSTGRES__PASSWORD" = "SOPS_ONLY"; + "${ctype}__POSTGRES__PORT" = toString config.services.postgresql.settings.port; + }; in { virtualisation.oci-containers.containers = { @@ -16,12 +27,19 @@ in PUID = "600"; PGID = "100"; TZ = "America/New_York"; + POSTGRES_HOST = "host.docker.internal"; + POSTGRES_USER = "SOPS_ONLY"; + POSTGRES_PASSWORD = "SOPS_ONLY"; + POSTGRES_PORT = toString config.services.postgresql.settings.port; }; volumes = [ "${vars.primary_docker}/bazarr:/config" "${vars.primary_plex_storage}/data:/data" ]; - extraOptions = [ "--network=arrnet" ]; + extraOptions = [ + "--network=arrnet" + "--add-host=host.docker.internal:host-gateway" + ]; autoStart = true; }; prowlarr = { @@ -31,7 +49,8 @@ in PUID = "600"; PGID = "100"; TZ = "America/New_York"; - }; + } + // arr_postgres_config "prowlarr"; extraOptions = [ "--network=arrnet" ]; volumes = [ "${vars.primary_docker}/prowlarr:/config" ]; autoStart = true; @@ -43,7 +62,8 @@ in PUID = "600"; PGID = "100"; TZ = "America/New_York"; - }; + } + // arr_postgres_config "radarr"; volumes = [ "${vars.primary_docker}/radarr:/config" "${vars.primary_plex_storage}/data:/data" @@ -58,7 +78,8 @@ in PUID = "600"; PGID = "100"; TZ = "America/New_York"; - }; + } + // arr_postgres_config "sonarr"; volumes = [ "${vars.primary_docker}/sonarr:/config" "${vars.primary_plex_storage}/data:/data" @@ -73,7 +94,8 @@ in PUID = "600"; PGID = "100"; TZ = "America/New_York"; - }; + } + // arr_postgres_config "lidarr"; volumes = [ "${vars.primary_docker}/lidarr:/config" "${vars.primary_plex_storage}/data:/data" @@ -100,7 +122,8 @@ in user = "600:100"; environment = { TZ = "America/New_York"; - }; + } + // arr_postgres_config "notifiarr"; environmentFiles = [ config.sops.secrets."docker/notifiarr".path ]; volumes = [ "${vars.primary_docker}/notifiarr:/config" @@ -115,6 +138,11 @@ in PUID = "600"; PGID = "100"; TZ = "America/New_York"; + DB_TYPE = "postgres"; + DB_HOST = "host.docker.internal"; + DB_PORT = toString config.services.postgresql.settings.port; + DB_USER = "SOPS_ONLY"; + DB_PASS = "SOPS_ONLY"; }; volumes = [ "${vars.primary_docker}/overseerr:/config" ]; # TODO: remove ports later since this is going through web diff --git a/systems/palatine-hill/zfs.nix b/systems/palatine-hill/zfs.nix index 8b1bb53..8d1ca4a 100644 --- a/systems/palatine-hill/zfs.nix +++ b/systems/palatine-hill/zfs.nix @@ -49,7 +49,7 @@ daily = 30; weekly = 0; monthly = 6; - yearly = 3; + yearly = 2; autosnap = true; autoprune = true; };