Fix website Ollama connectivity setup

This commit is contained in:
juvdiaz 2026-06-10 11:11:23 -06:00
parent ab68569dbe
commit d5abeca4b1
3 changed files with 36 additions and 2 deletions

View File

@ -670,6 +670,13 @@ website image that points at it:
./lab.sh website-translation-model
```
Ollama must also listen on the Debian host LAN address so Kubernetes pods on
other nodes can reach `OLLAMA_HOST=http://192.168.100.68:11434`:
```bash
./lab.sh website-ollama-listen
```
The CV page has two client-side presentation modes:
- `Elegant`: dark, minimal, terminal-inspired styling with a square profile

View File

@ -296,7 +296,6 @@ $curlError = curl_error($curl);
$curlErrno = curl_errno($curl);
$statusCode = (int) curl_getinfo($curl, CURLINFO_RESPONSE_CODE);
$ollamaLatencyMs = elapsed_ms($ollamaStartedAt);
curl_close($curl);
if ($rawResponse === false || $statusCode < 200 || $statusCode >= 300) {
$ollamaTimeoutCount = $curlErrno === CURLE_OPERATION_TIMEDOUT ? 1 : 0;

30
lab.sh
View File

@ -2928,6 +2928,31 @@ website_translation_model() {
echo "Ollama model ${model_name} is ready."
}
website_ollama_listen() {
local bind_address="${WEBSITE_OLLAMA_BIND_ADDRESS:-0.0.0.0:11434}"
local dropin_dir="/etc/systemd/system/ollama.service.d"
local dropin_file="${dropin_dir}/homelab-listen.conf"
require_debian_server "website-ollama-listen"
if ! systemctl cat ollama.service >/dev/null 2>&1; then
echo "ollama.service was not found on this Debian server." >&2
exit 1
fi
echo "Configuring ollama.service to listen on ${bind_address}..."
sudo mkdir -p "${dropin_dir}"
printf '[Service]\nEnvironment="OLLAMA_HOST=%s"\n' "${bind_address}" |
sudo tee "${dropin_file}" >/dev/null
sudo systemctl daemon-reload
sudo systemctl restart ollama.service
sudo systemctl is-active --quiet ollama.service
echo "Ollama service is active. Verifying http://${bind_address%:*}:11434/api/tags..."
curl -fsS "http://127.0.0.1:11434/api/tags" >/dev/null
echo "Ollama API is reachable on the Debian host."
}
apps() {
local buildx_builder_ready=false
local demos_image_built=false
@ -3287,6 +3312,9 @@ case "${1:-}" in
website-translation-model)
website_translation_model
;;
website-ollama-listen)
website_ollama_listen
;;
deploy-gitea)
deploy_gitea
;;
@ -3315,7 +3343,7 @@ case "${1:-}" in
nuke
;;
*)
echo "Usage: $0 {up|rebuild-cluster|apps|website-translation-model|deploy-gitea|bootstrap-gitea-repo|backup-gitea|drill-gitea-restore|install-gitea-runner|move-prometheus-stack-workers|doctor-versions|openwrt|nuke}"
echo "Usage: $0 {up|rebuild-cluster|apps|website-translation-model|website-ollama-listen|deploy-gitea|bootstrap-gitea-repo|backup-gitea|drill-gitea-restore|install-gitea-runner|move-prometheus-stack-workers|doctor-versions|openwrt|nuke}"
exit 1
;;
esac