From eddd9be86119dbf3613fbecd5622b3588ecdbbbe Mon Sep 17 00:00:00 2001 From: reo101 Date: Sun, 1 Sep 2024 17:40:36 +0300 Subject: [PATCH] feat(jeeves)!: re-enable `ollama` and expose it through `nginx` --- hosts/nixos/jeeves/configuration.nix | 2 +- hosts/nixos/jeeves/ollama.nix | 27 ++++++++++++++++++++++++--- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/hosts/nixos/jeeves/configuration.nix b/hosts/nixos/jeeves/configuration.nix index 8bcbe5d..d50ed62 100644 --- a/hosts/nixos/jeeves/configuration.nix +++ b/hosts/nixos/jeeves/configuration.nix @@ -13,7 +13,7 @@ # ./home-assistant ./samba.nix # ./steam.nix - # ./ollama.nix + ./ollama.nix # ./sunshine.nix # ./photoprism.nix # ./immich.nix diff --git a/hosts/nixos/jeeves/ollama.nix b/hosts/nixos/jeeves/ollama.nix index 69c9a51..87ac9ac 100644 --- a/hosts/nixos/jeeves/ollama.nix +++ b/hosts/nixos/jeeves/ollama.nix @@ -1,6 +1,7 @@ { inputs, lib, pkgs, config, ... }: { - networking.firewall.allowedTCPPorts = [11434]; + # NOTE: no need now (nginx) + # networking.firewall.allowedTCPPorts = [11434]; services.ollama = { enable = true; @@ -8,7 +9,17 @@ port = 11434; acceleration = "rocm"; environmentVariables = { - OLLAMA_ORIGINS = "*"; + # NOTE: no need now (nginx), should be only `127.0.0.1` + # OLLAMA_ORIGINS = "*"; + }; + }; + + services.nginx.virtualHosts."ollama.jeeves.local" = { + enableACME = false; + forceSSL = false; + locations."/" = { + proxyPass = "http://127.0.0.1:${builtins.toString config.services.ollama.port}"; + proxyWebsockets = true; }; }; @@ -25,6 +36,16 @@ # Disable authentication WEBUI_AUTH = "False"; }; - openFirewall = true; + # NOTE: no need now (nginx) + # openFirewall = true; + }; + + services.nginx.virtualHosts."openwebui.jeeves.local" = { + enableACME = false; + forceSSL = false; + locations."/" = { + proxyPass = "http://127.0.0.1:${builtins.toString config.services.open-webui.port}"; + proxyWebsockets = true; + }; }; }