From 48dbd02c9c9b460ebe01d5df377cfa08708c8593 Mon Sep 17 00:00:00 2001 From: Nick Date: Sat, 3 May 2025 15:21:41 -0500 Subject: [PATCH] feat: changed localhost address --- modules/nixos/services/ollama/default.nix | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/modules/nixos/services/ollama/default.nix b/modules/nixos/services/ollama/default.nix index 6f22497..b9b4f91 100755 --- a/modules/nixos/services/ollama/default.nix +++ b/modules/nixos/services/ollama/default.nix @@ -14,10 +14,12 @@ let web ; service = ollama; - localhost = web.localhost.address0; + localhost1 = web.localhost.address0; + localhost2 = web.localhost.address1; hostname = config.networking.hostName; host = "${service.subdomain}.${web.domains.url0}"; + localhostLogic = if hostname == mars.name then localhost2 else localhost1; caddyLogic = if hostname == ceres.name then { @@ -25,7 +27,7 @@ let virtualHosts = { ${host} = { extraConfig = '' - reverse_proxy ${localhost}:${toString service.ports.port0} + reverse_proxy ${localhostLogic}:${toString service.ports.port0} tls ${service.ssl.cert} ${service.ssl.key} ''; @@ -59,7 +61,7 @@ in { enable = true; group = service.name; - host = "http://${localhost}"; + host = "http://${localhostLogic}"; user = service.name; } // ( @@ -80,14 +82,14 @@ in ); open-webui = { enable = true; - host = localhost; + host = localhostLogic; port = service.ports.port0; environment = { ENABLE_OLLAMA_API = "True"; ANONYMIZED_TELEMETRY = "False"; DO_NOT_TRACK = "True"; SCARF_NO_ANALYTICS = "True"; - OLLAMA_BASE_URL = "http://${localhost}:${toString service.ports.port1}"; + OLLAMA_BASE_URL = "http://${localhostLogic}:${toString service.ports.port1}"; WEBUI_AUTH = "True"; }; };