Skip to content

Commit

Permalink
add: perplexica, ollama, open-webui
Browse files Browse the repository at this point in the history
  • Loading branch information
jz8132543 committed Sep 24, 2024
1 parent b2afcc3 commit cbb3410
Show file tree
Hide file tree
Showing 10 changed files with 112 additions and 30 deletions.
8 changes: 8 additions & 0 deletions lib/data/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,14 @@
"on": "fra1",
"proxy": false
},
"ollama": {
"on": "fra1",
"proxy": false
},
"ollama-ui": {
"on": "fra1",
"proxy": false
},
"p": {
"on": "hkg4",
"proxy": false
Expand Down
1 change: 1 addition & 0 deletions nixos/hosts/fra1/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
nixosModules.services.ntfy
nixosModules.services.sogo
nixosModules.services.pastebin
nixosModules.services.ollama
(import nixosModules.services.matrix { })
(import nixosModules.services.keycloak { })
(import nixosModules.services.vaultwarden { })
Expand Down
8 changes: 4 additions & 4 deletions nixos/hosts/isk/_steam/dst/Caves/worldgenoverride.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
return {
override_enabled = true,
worldgen_preset = "DST_CAVE",
settings_preset = "DST_CAVE",
overrides = {},
override_enabled = true,
worldgen_preset = "DST_CAVE",
settings_preset = "DST_CAVE",
overrides = {},
}
4 changes: 2 additions & 2 deletions nixos/hosts/isk/_steam/dst/Master/worldgenoverride.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
return {
override_enabled = true,
overrides = {},
override_enabled = true,
overrides = {},
}
36 changes: 18 additions & 18 deletions nixos/hosts/isk/_steam/dst/modoverrides.lua
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
return {
--# Health Info
["workshop-375859599"] = { enabled = true },
--# Show Me
["workshop-2287303119"] = { enabled = true },
--# No Thermal Stone Durability
["workshop-466732225"] = { enabled = true },
--# Extra Equip Slots
["workshop-375850593"] = { enabled = true },
--# Display Attack Range
["workshop-2078243581"] = { enabled = true },
--# Increased Stack size
["workshop-374550642"] = { enabled = true },
--# Combined Status
["workshop-376333686"] = { enabled = true },
--# Global Positions
["workshop-378160973"] = { enabled = true },
--# Demon sword Muramasa
["workshop-1842087172"] = { enabled = true },
--# Health Info
["workshop-375859599"] = { enabled = true },
--# Show Me
["workshop-2287303119"] = { enabled = true },
--# No Thermal Stone Durability
["workshop-466732225"] = { enabled = true },
--# Extra Equip Slots
["workshop-375850593"] = { enabled = true },
--# Display Attack Range
["workshop-2078243581"] = { enabled = true },
--# Increased Stack size
["workshop-374550642"] = { enabled = true },
--# Combined Status
["workshop-376333686"] = { enabled = true },
--# Global Positions
["workshop-378160973"] = { enabled = true },
--# Demon sword Muramasa
["workshop-1842087172"] = { enabled = true },
}
2 changes: 2 additions & 0 deletions nixos/modules/base/module/misc/ports.nix
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@
ntfy = 1161;
perplexica-frontend = 3002;
perplexica-backend = 3003;
ollama-api = 11434;
ollama-ui = 11435;
};
};
}
62 changes: 62 additions & 0 deletions nixos/modules/services/ollama.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{ config, ... }:
{
services.ollama = {
enable = true;
host = "0.0.0.0";
port = config.ports.ollama-api;
};
services.open-webui = {
enable = true;
host = "0.0.0.0";
port = config.ports.ollama-ui;
environment = {
ANONYMIZED_TELEMETRY = "False";
DO_NOT_TRACK = "True";
SCARF_NO_ANALYTICS = "True";
OLLAMA_API_BASE_URL = "https://ollama.${config.networking.domain}/api";
OLLAMA_BASE_URL = "https://ollama.${config.networking.domain}";
# Disable authentication
WEBUI_AUTH = "False";
ENABLE_SIGNUP = "False";
WEBUI_URL = "http://localhost:${toString config.ports.ollama-ui}";
# Search
ENABLE_RAG_WEB_SEARCH = "True";
RAG_WEB_SEARCH_ENGINE = "searxng";
SEARXNG_QUERY_URL = "https://searx.${config.networking.domain}/search?q=<query>";
# fix crush on web search
# RAG_EMBEDDING_ENGINE = "ollama";
# RAG_EMBEDDING_MODEL = "mxbai-embed-large:latest";
PYDANTIC_SKIP_VALIDATING_CORE_SCHEMAS = "True";
};
};
# services.nextjs-ollama-llm-ui = {
# enable = true;
# hostname = "127.0.0.1";
# ollamaUrl = "https://ollama.${config.networking.domain}";
# port = 11435;
# };
services.traefik.dynamicConfigOptions.http = {
routers = {
ollama-api = {
rule = "Host(`ollama.${config.networking.domain}`)";
entryPoints = [ "https" ];
service = "ollama-api";
};
ollama-ui = {
rule = "Host(`ollama-ui.${config.networking.domain}`)";
entryPoints = [ "https" ];
service = "ollama-ui";
};
};
services = {
ollama-api.loadBalancer = {
passHostHeader = true;
servers = [ { url = "http://localhost:${toString config.ports.ollama-api}"; } ];
};
ollama-ui.loadBalancer = {
passHostHeader = true;
servers = [ { url = "http://localhost:${toString config.ports.ollama-ui}"; } ];
};
};
};
}
15 changes: 9 additions & 6 deletions nixos/modules/services/perplexica.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
virtualisation.oci-containers.containers = {
perplexica-backend = {
hostname = "perplexica-backend";
image = "elestio4test/perplexica-backend";
image = "hajowieland/perplexica-backend";
autoStart = true;
volumes = [
"${config.sops.templates.perplexica.path}:/home/perplexica/config.toml"
Expand All @@ -19,14 +19,17 @@
};
perplexica-frontend = {
hostname = "perplexica-backend";
image = "elestio4test/perplexica-frontend";
image = "hajowieland/perplexica-frontend";
autoStart = true;
labels = {
# NEXT_PUBLIC_API_URL = "http://127.0.0.1:${toString config.ports.perplexica-backend}/api";
# NEXT_PUBLIC_WS_URL = "ws://127.0.0.1:${toString config.ports.perplexica-backend}";
environment = {
NEXT_PUBLIC_API_URL = "https://perplexica-backend.${config.networking.domain}/api";
NEXT_PUBLIC_WS_URL = "wss://perplexica-backend.${config.networking.domain}";
};
cmd = [
"/bin/sh"
"-c"
"yarn build; yarn start"
];
ports = [ "127.0.0.1:${toString config.ports.perplexica-frontend}:3000" ];
};
};
Expand All @@ -44,7 +47,7 @@
[API_ENDPOINTS]
SEARXNG = "${config.services.searx.settings.server.base_url}" # SearxNG API URL
OLLAMA = "" # Ollama API URL - http://host.docker.internal:11434
OLLAMA = "https://ollama.${config.networking.domain}" # Ollama API URL - http://host.docker.internal:11434
'';
};
services.traefik.dynamicConfigOptions.http = {
Expand Down
4 changes: 4 additions & 0 deletions nixos/modules/services/searx.nix
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ in
safe_search = 0;
autocomplete = "google"; # Existing autocomplete backends: "dbpedia", "duckduckgo", "google", "startpage", "swisscows", "qwant", "wikipedia" - leave blank to turn it off by default
default_lang = "zh-CN";
formats = [
"html"
"json"
];
};
server = {
base_url = "https://${url}";
Expand Down
2 changes: 2 additions & 0 deletions terraform/cloudflare.tf
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ locals {
ntfy = { on = "fra1", proxy = false }
mail = { on = "fra1", proxy = false }
pb = { on = "fra1", proxy = false }
ollama = { on = "fra1", proxy = false }
ollama-ui = { on = "fra1", proxy = false }
"admin.m" = { on = "fra1", proxy = false }
searx = { on = "hkg4", proxy = false }
morty = { on = "hkg4", proxy = false }
Expand Down

0 comments on commit cbb3410

Please sign in to comment.