fix: wait for Ollama API before pulling model
- Wait loop now checks HTTP endpoint (127.0.0.1:11434/api/tags) instead of just the CLI version - Increased retries from 10 to 15 (30s → 30s with 2s intervals) - Uses sudo -u ollama for pull so models go to correct user directory
This commit is contained in:
parent
378c8e5b98
commit
bb11a7f32c
1 changed files with 13 additions and 4 deletions
17
install.sh
17
install.sh
|
|
@ -185,13 +185,22 @@ case "$AI_CHOICE" in
|
|||
else
|
||||
info "Ollama already installed"
|
||||
fi
|
||||
# Wait for Ollama to be ready
|
||||
for i in $(seq 1 10); do
|
||||
if ollama --version &>/dev/null; then break; fi
|
||||
# Wait for Ollama server to be ready (API endpoint, not just CLI)
|
||||
info "Waiting for Ollama server..."
|
||||
for i in $(seq 1 15); do
|
||||
if curl -sf http://127.0.0.1:11434/api/tags > /dev/null 2>&1; then
|
||||
info "Ollama server is ready"
|
||||
break
|
||||
fi
|
||||
sleep 2
|
||||
done
|
||||
info "Pulling model $AI_MODEL (this may take a while)..."
|
||||
sudo_if ollama pull "$AI_MODEL" 2>&1 | tail -3
|
||||
# Pull as the ollama user so models are in the right place
|
||||
if id -u ollama &>/dev/null; then
|
||||
sudo -u ollama ollama pull "$AI_MODEL" 2>&1 | tail -3
|
||||
else
|
||||
ollama pull "$AI_MODEL" 2>&1 | tail -3
|
||||
fi
|
||||
AI_BASE_URL="http://localhost:11434"
|
||||
;;
|
||||
*)
|
||||
|
|
|
|||
Loading…
Reference in a new issue