mirror of
https://gitlab.com/upRootNutrition/dotfiles.git
synced 2025-06-16 18:15:13 -05:00
feat: server test
This commit is contained in:
parent
0439073fbd
commit
4dee49841a
18 changed files with 17 additions and 45 deletions
62
nixos/modules/services/ollama.nix
Executable file
62
nixos/modules/services/ollama.nix
Executable file
|
@ -0,0 +1,62 @@
|
|||
{flake, ...}: let
|
||||
inherit (flake.config.machines.devices) server;
|
||||
inherit (flake.config.services.instances) ollama web;
|
||||
service = ollama;
|
||||
localhost = web.localhost.address0;
|
||||
host = "${service.subdomain}.${web.domains.url0}";
|
||||
in {
|
||||
services = {
|
||||
ollama = {
|
||||
acceleration = false;
|
||||
enable = true;
|
||||
group = service.name;
|
||||
host = "http://${localhost}";
|
||||
port = service.ports.port1;
|
||||
user = service.name;
|
||||
};
|
||||
|
||||
open-webui = {
|
||||
enable = true;
|
||||
host = localhost;
|
||||
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}";
|
||||
WEBUI_AUTH = "True";
|
||||
};
|
||||
};
|
||||
|
||||
caddy = {
|
||||
virtualHosts = {
|
||||
${host} = {
|
||||
extraConfig = ''
|
||||
reverse_proxy ${localhost}:${toString service.ports.port0}
|
||||
|
||||
tls ${service.ssl.cert} ${service.ssl.key}
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
fileSystems."/var/lib/${service.name}" = {
|
||||
device = service.paths.path0;
|
||||
fsType = "none";
|
||||
options = ["bind"];
|
||||
depends = [server.storage0.mount];
|
||||
};
|
||||
|
||||
systemd.tmpfiles.rules = ["Z ${service.paths.path0} 0755 ${service.name} ${service.name} -"];
|
||||
|
||||
networking = {
|
||||
firewall = {
|
||||
allowedTCPPorts = [
|
||||
service.ports.port0
|
||||
service.ports.port1
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue