feat(krz01): move ollama to compute01 via a reverse proxy
All checks were successful
Check meta / check_meta (pull_request) Successful in 16s
Check meta / check_dns (pull_request) Successful in 18s
build configuration / build_and_cache_geo01 (pull_request) Successful in 1m8s
build configuration / build_and_cache_rescue01 (pull_request) Successful in 1m17s
build configuration / build_and_cache_storage01 (pull_request) Successful in 1m21s
build configuration / build_and_cache_geo02 (pull_request) Successful in 1m9s
build configuration / build_and_cache_compute01 (pull_request) Successful in 1m52s
build configuration / build_and_cache_krz01 (pull_request) Successful in 2m0s
lint / check (pull_request) Successful in 25s
build configuration / build_and_cache_vault01 (pull_request) Successful in 1m18s
build configuration / build_and_cache_web02 (pull_request) Successful in 1m14s
build configuration / build_and_cache_bridge01 (pull_request) Successful in 1m2s
build configuration / build_and_cache_web01 (pull_request) Successful in 1m48s
Check meta / check_meta (push) Successful in 19s
Check meta / check_dns (push) Successful in 20s
build configuration / build_and_cache_geo01 (push) Successful in 1m5s
build configuration / build_and_cache_geo02 (push) Successful in 1m5s
build configuration / build_and_cache_storage01 (push) Successful in 1m27s
build configuration / build_and_cache_rescue01 (push) Successful in 1m32s
build configuration / build_and_cache_compute01 (push) Successful in 1m41s
lint / check (push) Successful in 24s
build configuration / build_and_cache_krz01 (push) Successful in 2m20s
build configuration / build_and_cache_bridge01 (push) Successful in 1m9s
build configuration / build_and_cache_web02 (push) Successful in 1m17s
build configuration / build_and_cache_vault01 (push) Successful in 1m22s
build configuration / build_and_cache_web01 (push) Successful in 1m54s

krz01 has no public web IP.

Signed-off-by: Ryan Lahfa <ryan@dgnum.eu>
This commit is contained in:
Ryan Lahfa 2024-10-10 17:35:40 +02:00
parent 363f8d3c67
commit a4de5f4d31
4 changed files with 38 additions and 26 deletions

View file

@ -21,6 +21,7 @@ lib.extra.mkConfig {
"librenms" "librenms"
"mastodon" "mastodon"
"nextcloud" "nextcloud"
"ollama-proxy"
"outline" "outline"
"plausible" "plausible"
"postgresql" "postgresql"

View file

@ -0,0 +1,27 @@
{
pkgs,
nodes,
meta,
...
}:
{
services.nginx = {
enable = true;
recommendedProxySettings = true;
virtualHosts."ollama01.beta.dgnum.eu" = {
enableACME = true;
forceSSL = true;
locations."/" = {
proxyPass = "http://${meta.network.krz01.netbirdIp}:${toString nodes.krz01.config.services.ollama.port}";
basicAuthFile = pkgs.writeText "ollama-htpasswd" ''
raito:$y$j9T$UDEHpLtM52hRGK0I4qT6M0$N75AhENLqgtJnTGaPzq51imhjZvuPr.ow81Co1ZTcX2
'';
};
};
};
networking.firewall.allowedTCPPorts = [
80
443
];
}

View file

@ -2,6 +2,8 @@
config, config,
lib, lib,
pkgs, pkgs,
meta,
name,
... ...
}: }:
@ -59,22 +61,9 @@ lib.extra.mkConfig {
]; ];
services = { services = {
nginx = {
enable = true;
recommendedProxySettings = true;
virtualHosts."ollama01.beta.dgnum.eu" = {
enableACME = true;
forceSSL = true;
locations."/" = {
proxyPass = "http://${config.services.ollama.host}:${toString config.services.ollama.port}";
basicAuthFile = pkgs.writeText "ollama-htpasswd" ''
raito:$y$j9T$UDEHpLtM52hRGK0I4qT6M0$N75AhENLqgtJnTGaPzq51imhjZvuPr.ow81Co1ZTcX2
'';
};
};
};
ollama = { ollama = {
enable = true; enable = true;
host = meta.network.${name}.netbirdIp;
package = pkgs.callPackage ./ollama.nix { package = pkgs.callPackage ./ollama.nix {
cudaPackages = pkgs.cudaPackages_11; cudaPackages = pkgs.cudaPackages_11;
# We need to thread our nvidia x11 driver for CUDA. # We need to thread our nvidia x11 driver for CUDA.
@ -83,10 +72,7 @@ lib.extra.mkConfig {
}; };
}; };
networking.firewall.allowedTCPPorts = [ networking.firewall.interfaces.wt0.allowedTCPPorts = [ config.services.ollama.port ];
80
443
];
}; };
root = ./.; root = ./.;

View file

@ -68,6 +68,12 @@ let
"support" # Zammad support "support" # Zammad support
"telegraf" # Telegraf "telegraf" # Telegraf
# Beta-grade machine learning API servers
"ollama01.beta"
"openui.beta"
"whisper.beta"
"stable-diffusion.beta"
# DGSI # DGSI
"dgsi" "dgsi"
"profil" "profil"
@ -129,14 +135,6 @@ let
"cas-eleves" "cas-eleves"
"vote" "vote"
]; ];
krz01.dual = [
# Beta-grade machine learning API servers
"ollama01.beta"
"openui.beta"
"whisper.beta"
"stable-diffusion.beta"
];
} }
) )
); );