v1.0.0: Docker containerization, docs, version bump

- config.py: VERSION → v1.0.0, DEFAULT_MODEL from CAIC_DEFAULT_MODEL env,
  HW_STATE_PATH from CAIC_HW_STATE_PATH env
- README.md: Docker install section (recommended), updated file structure,
  added What's New in v1.0.0, requirements note for Docker
- ai.md: Docker run path, work state updated, version to v1.0.0,
  external services table with Docker service names
- CLAUDE.md: Docker quick start, fixed dependencies note
- docker.md: checked off completed items in §10 checklist, updated §11
  file list with actual paths and status
- TASKS.md: struck through B3 [DONE]
This commit is contained in:
gramps
2026-07-19 16:40:02 -07:00
parent 55b9a2236d
commit 056ebc399f
6 changed files with 145 additions and 79 deletions
+92 -38
View File
@@ -1,6 +1,6 @@
![cAIc banner](static/readme-banner.png)
# cAIc v0.22.0
# cAIc v1.0.0
Consumer AI hardware is a wasteland of incompatibility. NVIDIA speaks CUDA, AMD speaks ROCm. Your RTX 5070 Ti lives in one machine with 16 GB VRAM; your RX 6600 XT lives in another with 12 GB. Alone, neither can run a 14B model at usable speed. Together, they could — if the software stack didn't treat heterogeneous hardware as a bug instead of a feature.
@@ -76,6 +76,34 @@ At v1.0, this ships with a Docker compose stack and setup wizard that detect CPU
Developer wiki: [Home](https://llgit.llamachile.tube/gramps/cAIc/wiki/Home) — includes [FAQ](https://llgit.llamachile.tube/gramps/cAIc/wiki/FAQ), [Installation Guide](https://llgit.llamachile.tube/gramps/cAIc/wiki/Installation), and [full architecture docs](https://llgit.llamachile.tube/gramps/cAIc/wiki/Developer-Architecture)
## What's New in v1.0.0
### Docker Containerization (B3)
- **`Dockerfile`** — multi-stage Python 3.13-slim build, healthcheck, uvicorn CMD
- **`docker-compose.yml`** — full stack: cAIc, SearXNG, Qdrant, RabbitMQ, llama-server, Ollama
- **`scripts/setup.sh`** — first-run scaffolding: generates `.env`, secrets, SearXNG config, pulls default model (~4.6GB Qwen2.5-7B Q4_K_M)
- **`.env.example`** — all environment variables documented with generation hints
- **`.dockerignore`** — excludes venv, tests, .git, models, secrets
- **`searxng-settings.yml.dist`** — SearXNG config template
- **`models/README.txt`** — instructions for placing .gguf files
- All service URLs are env-var configurable with Docker service hostnames (`http://llama-server:8081`, `http://qdrant:6333`, etc.)
- AMQP secret uses Docker secrets pattern (`/run/secrets/`)
- Only port 8080 exposed by default; all other services internal to compose network
- Graceful degradation — SearXNG and Ollama are optional (not required for startup)
### Bug Fixes & Hardening (v0.22.1)
- `config.py`: defaults changed from hardcoded LAN IPs to `localhost` for Docker compatibility
- `config.py`: `AMQP_SECRET_PATH` defaults to `/run/secrets/caic_amqp_secret`
- `config.py`: `DEFAULT_MODEL` now configurable via `CAIC_DEFAULT_MODEL` env var
- `config.py`: `HW_STATE_PATH` now configurable via `CAIC_HW_STATE_PATH` env var
- `rag.py`: `EMBED_URL` default changed to `localhost`
- `app.py`: syslog handler wrapped in try/except (container-safe)
- `db.py`: PRAGMA `journal_mode = WAL` for better concurrency
- `routers/completions.py`: `db.close()` in try/finally for proper cleanup
- `amqp.py`: subscription append moved before try for reconnect safety
- `requirements.txt`: added missing `psutil` and `jinja2`
- `tests/conftest.py`: fixed test discovery (sys.path insertion)
## What's New in v0.22.0
### Color Theme System
@@ -279,59 +307,85 @@ All user query-derived text is now encrypted with AES-256-GCM before being writt
## File Structure
```
/opt/caic/
├── amqp.py # aio-pika AMQP connection manager + subscribe/rebind
├── app.py # FastAPI app entry point
├── auth.py # PIN-based guest/admin sessions, auth routes
├── cluster.py # Cluster protocol: node registry, event log, ping/pong
├── config.py # Constants, env vars, limits, skill registry
├── crypto.py # AES-256-GCM encrypt/decrypt + key management
├── db.py # SQLite schema, connection factory
├── eviction.py # Score-based RAG eviction engine
├── gpu.py # GPU stats — rocm-smi (Linux/AMD) + system_profiler (Darwin/Apple Silicon)
├── hardware.py # Hardware self-assessment (CPU, RAM, VRAM) — Linux + Darwin
├── memory.py # FTS5 memory CRUD, remember/forget commands
├── rag.py # Qdrant vector search + system prompt assembly
├── search.py # SearXNG integration, perplexity, refusal detection
├── security.py # Rate limiting, origin checks, IP allowlist, audit
├── model_pull.py # Startup model auto-pull (llama-server → Ollama fallback)
├── triage.py # Query classification + cluster node selection
.
├── Dockerfile # Multi-stage Python 3.13-slim image
├── docker-compose.yml # Full stack: cAIc, SearXNG, Qdrant, RabbitMQ, llama-server, Ollama
├── .env.example # Environment variable template (secrets auto-generated by setup.sh)
├── .dockerignore # Excludes venv, tests, .git, models, secrets
├── requirements.txt # Python dependencies
├── amqp.py # aio-pika AMQP connection manager + subscribe/rebind
├── app.py # FastAPI app entry point
├── auth.py # PIN-based guest/admin sessions, auth routes
├── cluster.py # Cluster protocol: node registry, event log, ping/pong
├── config.py # Constants, env vars, limits, skill registry
├── crypto.py # AES-256-GCM encrypt/decrypt + key management
├── db.py # SQLite schema, connection factory
├── eviction.py # Score-based RAG eviction engine
├── gpu.py # GPU stats — rocm-smi (Linux/AMD) + system_profiler (Darwin/Apple Silicon)
├── hardware.py # Hardware self-assessment (CPU, RAM, VRAM) — Linux + Darwin
├── memory.py # FTS5 memory CRUD, remember/forget commands
├── rag.py # Qdrant vector search + system prompt assembly
├── search.py # SearXNG integration, perplexity, refusal detection
├── security.py # Rate limiting, origin checks, IP allowlist, audit
├── model_pull.py # Startup model auto-pull (llama-server → Ollama fallback)
├── triage.py # Query classification + cluster node selection
├── searxng-settings.yml.dist # SearXNG config template (copied by setup.sh)
├── routers/
│ ├── chat.py # /api/chat streaming endpoint
│ ├── cluster.py # Cluster status endpoint
│ ├── completions.py # /v1/chat/completions OpenAI-compat endpoint
│ ├── conversations.py# Conversation CRUD
│ ├── ingest.py # Terminal RAG ingest
│ ├── memories.py # Memory CRUD API
│ ├── models.py # Model listing, system stats
│ ├── presets.py # System prompt presets
│ ├── profile.py # User profile
│ ├── search_route.py # /api/search explicit search endpoint
│ ├── settings.py # Runtime settings
│ ├── skills.py # Skills management
│ └── upload.py # File attachment endpoints
│ ├── chat.py # /api/chat streaming endpoint
│ ├── cluster.py # Cluster status endpoint
│ ├── completions.py # /v1/chat/completions OpenAI-compat endpoint
│ ├── conversations.py # Conversation CRUD
│ ├── ingest.py # Terminal RAG ingest
│ ├── memories.py # Memory CRUD API
│ ├── models.py # Model listing, system stats
│ ├── presets.py # System prompt presets
│ ├── profile.py # User profile
│ ├── search_route.py # /api/search explicit search endpoint
│ ├── settings.py # Runtime settings
│ ├── skills.py # Skills management
│ └── upload.py # File attachment endpoints
├── scripts/
│ ├── setup.sh # First-run scaffolding (generates .env, secrets, pulls model)
│ ├── teardown-docker.sh # Docker stack teardown
│ ├── nuclear-clean.sh # Remove everything (bare-metal + Docker)
│ └── uninstall.sh # Bare-metal / systemd removal
├── models/ # GGUF model files (user-provided, gitignored)
├── static/
│ └── logo.png # Logo image (optional)
│ └── logo.png # Logo image (optional)
├── templates/
│ └── index.html # Frontend
│ └── index.html # Frontend
├── node_agent/
│ ├── agent.py # Standalone worker agent (AMQP client)
│ ├── agent.py # Standalone worker agent (AMQP client)
│ └── requirements.txt
└── tests/ # 200 pytest tests
└── tests/ # 214 pytest tests
```
## Requirements
- Python 3.11+ (tested on 3.13)
- Python 3.11+ (tested on 3.13) — bare-metal only; Docker handles this
- llama-server running locally or on network (OpenAI-compatible API on port 8081)
- SearXNG (optional, for web search)
- RabbitMQ (optional, for AMQP cluster — coordinator only)
- Qdrant (optional, for RAG vector search)
- WireGuard (optional, for encrypted inter-node transit — see [WireGuard-Setup.md](docs/wiki/WireGuard-Setup.md))
**Docker deployment:** All services except llama-server (GPU) and GPU drivers are provided by the compose stack. No manual service installation required.
## Installation
### Fresh Install
### Docker Install (Recommended)
```bash
git clone ssh://gitea@llgit.llamachile.tube:1319/gramps/caic.git && cd caic
scripts/setup.sh # generates .env, secrets, SearXNG config, pulls default model
docker compose up -d # boots all services
```
The setup wizard auto-generates secrets, detects disk space, downloads the default model (~4.6GB), and configures all service hostnames. Edit `.env` to customize.
Requires: Docker Engine + Compose plugin.
### Bare-Metal Install
```bash
# Create directory and venv
@@ -341,7 +395,7 @@ cd /opt/caic
python3 -m venv venv
# Install dependencies
pip install fastapi uvicorn httpx psutil jinja2 python-multipart pypdf aio-pika
pip install fastapi uvicorn httpx psutil jinja2 python-multipart pypdf aio-pika cryptography
# Set admin PIN before first startup (4 digits)
export CAIC_ADMIN_PIN=4827