added webui to ollama

This commit is contained in:
Adrian Gunnar Lauterer 2024-05-04 17:32:30 +02:00
parent c936b67172
commit 16557d146d
2 changed files with 28 additions and 0 deletions

View File

@ -5,6 +5,7 @@
./base.nix
../services/podman.nix
../services/ollama.nix
../services/ollama-webui.nix
../services/whisper.nix
];

27
services/ollama-webui.nix Normal file
View File

@ -0,0 +1,27 @@
{ config, pkgs, lib, ... }:
let
openWebuiImage = "ghcr.io/open-webui/open-webui:main";
in
{
virtualisation.oci-containers = {
backend = {
image = openWebuiImage;
cmd = [ "-d" "--network=host" "-v" "open-webui:/app/backend/data" "--name" "open-webui" "--restart" "always" ];
volumes = [ "open-webui:/app/backend/data" ];
environment = {
OLLAMA_BASE_URL = "http://127.0.0.1:11434";
};
restart = "always";
};
};
services.nginx.virtualHosts."chat.${config.networking.hostName}.${config.networking.domain}" = {
forceSSL = true;
#useACMEHost = config.networking.domain; #not sure if this will work, unless
locations."/" = {
proxyWebsockets = true;
proxyPass = "http://${config.services.ollama.listenAddress}";
};
basicAuthFile = config.sops.secrets."nginx/defaultpass".path;
};
}