Add live AI checks to system health (#3155)

* Add live AI checks to system health

Give super admins a dedicated AI status view with bounded liveness probes for LLMs, vector stores, pgvector, and embedding endpoints. Record sanitized failures in both the system debug log and Rails logger, and document the recommended local configuration.\n\nCloses #3145

* Fix AI health CI checks

* Address AI health review feedback

* Correct Ollama model preload guidance

* Distinguish OpenAI-compatible providers

* Make Ollama startup readiness explicit

* Recognize Cloudflare AI endpoints
This commit is contained in:
Juan José Mata
2026-08-24 22:41:08 +02:00
committed by GitHub
parent c26b16d36f
commit fd6f4ff078
24 changed files with 1773 additions and 120 deletions
+17 -4
View File
@@ -114,7 +114,8 @@ x-rails-env: &rails_env
AI_RESPONSE_TIMEOUT: ${AI_RESPONSE_TIMEOUT:-1200}
# Vector store — pgvector keeps all data local (requires pgvector/pgvector Docker image for db)
VECTOR_STORE_PROVIDER: pgvector
EMBEDDING_MODEL: nomic-embed-text
EMBEDDING_URI_BASE: http://ollama:11434/v1
EMBEDDING_MODEL: mxbai-embed-large
EMBEDDING_DIMENSIONS: "1024"
# NOTE: enabling OpenAI will incur costs when you use AI-related features in the app (chat, rules). Make sure you have set appropriate spend limits on your account before adding this.
# OPENAI_ACCESS_TOKEN: ${OPENAI_ACCESS_TOKEN}
@@ -182,7 +183,14 @@ services:
networks:
- sure_net
# Note: You still have to download models manually using the ollama CLI or via Open WebUI
# Ollama's OLLAMA_MODELS setting controls the model storage directory; it is
# not a preload list. Start Ollama, then pull each model once. The ollama
# volume below keeps the downloaded models across container restarts:
#
# docker compose -f compose.example.ai.yml --profile local-ai up -d --wait ollama
# docker compose -f compose.example.ai.yml exec ollama ollama pull deepseek-r1:8b
# docker compose -f compose.example.ai.yml exec ollama ollama pull llama3.1:8b
# docker compose -f compose.example.ai.yml exec ollama ollama pull mxbai-embed-large
ollama:
profiles:
- local-ai
@@ -196,7 +204,12 @@ services:
- "11434:11434"
environment:
- OLLAMA_KEEP_ALIVE=1h
- OLLAMA_MODELS=deepseek-r1:8b,llama3.1:8b,nomic-embed-text # Pre-load model on startup, you can change this to your preferred model
healthcheck:
test: ["CMD", "ollama", "list"]
interval: 5s
timeout: 5s
retries: 12
start_period: 5s
networks:
- sure_net
# Recommended: Enable GPU support
@@ -338,7 +351,7 @@ services:
- sure_net
db:
image: pgvector/pgvector:pg16
image: pgvector/pgvector:pg16-trixie
restart: unless-stopped
volumes:
- postgres-data:/var/lib/postgresql/data