Rename: jarvisChat → cAIc (product name)
- jarvisChat/JarvisChat/jarvischat → cAIc/cAIc/caic (branded/lower) - JARVISCHAT_ env vars → CAIC_ - jc- script/config prefix → caic- - jarvis_rag → caic_rag - jarvischat.db / volumes → caic.db / caic_* - AMQP vhost/user jarvischat → caic - Syslog, loggers, docstrings all updated - 47 files, zero stale references, 148 tests pass
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# Docker Distribution — Architecture & Planning
|
||||
|
||||
> **Part of B3 (v1.0 gate).** This document catalogs every service, volume, port, configuration, and decision needed to ship jarvisChat as a `docker compose` stack. It also defines extraction (setup) and back-out (uninstall) procedures so nothing is lost when reality disagrees with the plan.
|
||||
> **Part of B3 (v1.0 gate).** This document catalogs every service, volume, port, configuration, and decision needed to ship cAIc as a `docker compose` stack. It also defines extraction (setup) and back-out (uninstall) procedures so nothing is lost when reality disagrees with the plan.
|
||||
|
||||
## 1. Stack Overview
|
||||
|
||||
@@ -15,10 +15,10 @@
|
||||
│ │ │ │ │
|
||||
│ ▼ ▼ ▼ │
|
||||
│ ┌──────────────────────────────────────────────────┐ │
|
||||
│ │ jarvisChat (FastAPI) │ │
|
||||
│ │ cAIc (FastAPI) │ │
|
||||
│ │ :8080 (HTTP) │ │
|
||||
│ │ │ │
|
||||
│ │ SQLite ◄── jarvischat.db (volume) │ │
|
||||
│ │ SQLite ◄── caic.db (volume) │ │
|
||||
│ │ Uploads ◄── /app/uploads (volume) │ │
|
||||
│ └──────────┬──────────────┬───────────────────────┘ │
|
||||
│ │ │ │
|
||||
@@ -37,7 +37,7 @@
|
||||
|
||||
| Service | Image | Role |
|
||||
|---------|-------|------|
|
||||
| **jarvisChat** | Custom `Dockerfile` | FastAPI app serving UI + API |
|
||||
| **cAIc** | Custom `Dockerfile` | FastAPI app serving UI + API |
|
||||
| **SearXNG** | `searxng/searxng:latest` | Privacy-respecting web search |
|
||||
| **Qdrant** | `qdrant/qdrant:latest` | Vector database for RAG |
|
||||
| **RabbitMQ** | `rabbitmq:4-management` | Message broker for AMQP cluster |
|
||||
@@ -57,9 +57,9 @@
|
||||
|
||||
## 2. Service Catalog
|
||||
|
||||
### 2.1 jarvisChat (FastAPI app)
|
||||
### 2.1 cAIc (FastAPI app)
|
||||
|
||||
**Image:** `jarvischat:latest` (built from `Dockerfile`)
|
||||
**Image:** `caic:latest` (built from `Dockerfile`)
|
||||
|
||||
**Ports:**
|
||||
| Container | Host | Purpose |
|
||||
@@ -69,8 +69,8 @@
|
||||
**Volumes:**
|
||||
| Container path | Type | Purpose |
|
||||
|----------------|------|---------|
|
||||
| `/app/jarvischat.db` | named volume `jarvischat_data` | SQLite database |
|
||||
| `/app/uploads` | named volume `jarvischat_uploads` | Uploaded files |
|
||||
| `/app/caic.db` | named volume `caic_data` | SQLite database |
|
||||
| `/app/uploads` | named volume `caic_uploads` | Uploaded files |
|
||||
| `/app/hardware_state.json` | (inside volume) | Cached hardware probe |
|
||||
|
||||
**Dependencies:** Wait for SearXNG, Qdrant, RabbitMQ, llama-server, Ollama before serving.
|
||||
@@ -153,7 +153,7 @@ QDRANT__SERVICE__GRPC_PORT=6334
|
||||
|
||||
**Environment:**
|
||||
```env
|
||||
RABBITMQ_DEFAULT_USER=jarvischat
|
||||
RABBITMQ_DEFAULT_USER=caic
|
||||
RABBITMQ_DEFAULT_PASS_FILE=/run/secrets/rabbitmq_password
|
||||
RABBITMQ_DEFAULT_VHOST=/
|
||||
```
|
||||
@@ -227,9 +227,9 @@ LLAMA_ARG_RPC= # optional: comma-separated RPC endpoints
|
||||
|
||||
```env
|
||||
# --- Secrets (auto-generated, change before production) ---
|
||||
JARVISCHAT_ADMIN_PIN=
|
||||
JARVISCHAT_COMPLETIONS_API_KEY=
|
||||
JARVISCHAT_ALLOW_DEFAULT_PIN=false
|
||||
CAIC_ADMIN_PIN=
|
||||
CAIC_COMPLETIONS_API_KEY=
|
||||
CAIC_ALLOW_DEFAULT_PIN=false
|
||||
RABBITMQ_PASSWORD=
|
||||
SEARXNG_SECRET_KEY=
|
||||
|
||||
@@ -257,9 +257,9 @@ LLAMA_CTX_SIZE=4096
|
||||
OLLAMA_EMBED_MODEL=all-minilm:latest
|
||||
|
||||
# --- Network ---
|
||||
JARVISCHAT_ALLOWED_CIDRS=127.0.0.0/8,::1/128,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16
|
||||
JARVISCHAT_TRUSTED_ORIGINS=
|
||||
JARVISCHAT_TRUST_X_FORWARDED_FOR=false
|
||||
CAIC_ALLOWED_CIDRS=127.0.0.0/8,::1/128,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16
|
||||
CAIC_TRUSTED_ORIGINS=
|
||||
CAIC_TRUST_X_FORWARDED_FOR=false
|
||||
```
|
||||
|
||||
### 3.2 Mapping of config.py → .env variable
|
||||
@@ -272,24 +272,24 @@ Every config.py default that references an external service must accept a matchi
|
||||
| `OLLAMA_BASE` | `OLLAMA_BASE` | Ollama |
|
||||
| `SEARXNG_BASE` | `SEARXNG_BASE` | SearXNG |
|
||||
| `QDRANT_URL` | `QDRANT_URL` | Qdrant |
|
||||
| `COMPLETIONS_API_KEY` | `JARVISCHAT_COMPLETIONS_API_KEY` | — |
|
||||
| `ALLOWED_CIDRS_RAW` | `JARVISCHAT_ALLOWED_CIDRS` | — |
|
||||
| `TRUST_X_FORWARDED_FOR` | `JARVISCHAT_TRUST_X_FORWARDED_FOR` | — |
|
||||
| `TRUSTED_ORIGINS` | `JARVISCHAT_TRUSTED_ORIGINS` | — |
|
||||
| `COMPLETIONS_API_KEY` | `CAIC_COMPLETIONS_API_KEY` | — |
|
||||
| `ALLOWED_CIDRS_RAW` | `CAIC_ALLOWED_CIDRS` | — |
|
||||
| `TRUST_X_FORWARDED_FOR` | `CAIC_TRUST_X_FORWARDED_FOR` | — |
|
||||
| `TRUSTED_ORIGINS` | `CAIC_TRUSTED_ORIGINS` | — |
|
||||
| `RAG_MAX_VECTORS` | `RAG_MAX_VECTORS` | — (calc'd from RAM) |
|
||||
|
||||
### 3.3 Secrets management
|
||||
|
||||
| Secret | Generated by | Stored in | Mounted to |
|
||||
|--------|-------------|-----------|------------|
|
||||
| `JARVISCHAT_ADMIN_PIN` | User prompt | `.env` | jarvisChat container |
|
||||
| `JARVISCHAT_COMPLETIONS_API_KEY` | Auto-generated, shown to user | `.env` | jarvisChat container |
|
||||
| `CAIC_ADMIN_PIN` | User prompt | `.env` | cAIc container |
|
||||
| `CAIC_COMPLETIONS_API_KEY` | Auto-generated, shown to user | `.env` | cAIc container |
|
||||
| `RABBITMQ_PASSWORD` | Auto-generated | `.env` + Docker secret | RabbitMQ container |
|
||||
| `SEARXNG_SECRET_KEY` | Auto-generated | `.env` | SearXNG container |
|
||||
|
||||
**Docker secrets approach:** Use `secrets:` in compose file for RabbitMQ password (mounted as file) rather than passing via env var, since `settings.yml` in SearXNG and RabbitMQ config can reference file-based secrets without env-var leakage.
|
||||
|
||||
### 3.4 Dockerfile for jarvisChat
|
||||
### 3.4 Dockerfile for cAIc
|
||||
|
||||
```dockerfile
|
||||
FROM python:3.13-slim-bookworm AS builder
|
||||
@@ -321,12 +321,12 @@ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8080"]
|
||||
|
||||
```yaml
|
||||
services:
|
||||
jarvischat:
|
||||
caic:
|
||||
build: .
|
||||
ports: ["8080:8080"]
|
||||
volumes:
|
||||
- jarvischat_data:/app/jarvischat.db
|
||||
- jarvischat_uploads:/app/uploads
|
||||
- caic_data:/app/caic.db
|
||||
- caic_uploads:/app/uploads
|
||||
env_file: .env
|
||||
depends_on:
|
||||
searxng: { condition: service_started }
|
||||
@@ -416,8 +416,8 @@ services:
|
||||
restart: unless-stopped
|
||||
|
||||
volumes:
|
||||
jarvischat_data:
|
||||
jarvischat_uploads:
|
||||
caic_data:
|
||||
caic_uploads:
|
||||
searxng_config:
|
||||
qdrant_storage:
|
||||
rabbitmq_data:
|
||||
@@ -441,11 +441,11 @@ secrets:
|
||||
|
||||
| From | To | Port | Protocol |
|
||||
|------|----|------|----------|
|
||||
| jarvisChat | llama-server | 8081 | HTTP |
|
||||
| jarvisChat | Ollama | 11434 | HTTP |
|
||||
| jarvisChat | SearXNG | 8080 | HTTP |
|
||||
| jarvisChat | Qdrant | 6333 | HTTP |
|
||||
| jarvisChat | RabbitMQ | 5672 | AMQP |
|
||||
| cAIc | llama-server | 8081 | HTTP |
|
||||
| cAIc | Ollama | 11434 | HTTP |
|
||||
| cAIc | SearXNG | 8080 | HTTP |
|
||||
| cAIc | Qdrant | 6333 | HTTP |
|
||||
| cAIc | RabbitMQ | 5672 | AMQP |
|
||||
| RabbitMQ | (cluster peers) | 4369 | EPMD |
|
||||
| RabbitMQ | (cluster peers) | 25672 | Inter-node |
|
||||
|
||||
@@ -453,7 +453,7 @@ secrets:
|
||||
|
||||
| Port | Service | Should expose? | Notes |
|
||||
|------|---------|---------------|-------|
|
||||
| 8080 | jarvisChat | ✅ Required | UI + API |
|
||||
| 8080 | cAIc | ✅ Required | UI + API |
|
||||
| 8888 | SearXNG | Optional | Only if user wants standalone search |
|
||||
| 6333 | Qdrant | Optional | Only for external tooling |
|
||||
| 5672 | RabbitMQ | Optional | Only for remote AMQP clients |
|
||||
@@ -461,7 +461,7 @@ secrets:
|
||||
| 8081 | llama-server | Optional | Only for external tooling |
|
||||
| 11434 | Ollama | Optional | Only for external tooling |
|
||||
|
||||
**Design decision:** By default, only port 8080 (jarvisChat) is published. All other services remain on the internal compose network. Advanced users can opt-in by uncommenting `ports:` blocks.
|
||||
**Design decision:** By default, only port 8080 (cAIc) is published. All other services remain on the internal compose network. Advanced users can opt-in by uncommenting `ports:` blocks.
|
||||
|
||||
### 5.3 Reverse proxy consideration
|
||||
|
||||
@@ -534,7 +534,7 @@ This is out of scope for v1.0 but documented for future.
|
||||
./docker-deploy/
|
||||
├── .env # All env vars (SECRET — add to .gitignore)
|
||||
├── docker-compose.yml # Compose stack definition
|
||||
├── Dockerfile # jarvisChat image build
|
||||
├── Dockerfile # cAIc image build
|
||||
├── secrets/
|
||||
│ └── rabbitmq_password.txt # RabbitMQ password file
|
||||
├── searxng/
|
||||
@@ -564,9 +564,9 @@ Re-running `setup.sh`:
|
||||
| Item | Removal method |
|
||||
|------|---------------|
|
||||
| Docker containers | `docker compose down -v` |
|
||||
| Docker images | `docker rmi jarvischat:latest` (ask about other images) |
|
||||
| Docker volumes | `docker volume rm jarvischat_data ...` (prompt first) |
|
||||
| Network `jarvischat_default` | Removed with compose |
|
||||
| Docker images | `docker rmi caic:latest` (ask about other images) |
|
||||
| Docker volumes | `docker volume rm caic_data ...` (prompt first) |
|
||||
| Network `caic_default` | Removed with compose |
|
||||
| `.env` file | `rm .env` |
|
||||
| `secrets/` directory | `rm -rf secrets/` |
|
||||
| `searxng/` directory | `rm -rf searxng/` |
|
||||
@@ -578,7 +578,7 @@ Re-running `setup.sh`:
|
||||
| Item | Reason |
|
||||
|------|--------|
|
||||
| `./models/*.gguf` | User data — prompt for deletion |
|
||||
| `jarvischat.db` (in volume) | Prompt: "Keep database snapshot?" |
|
||||
| `caic.db` (in volume) | Prompt: "Keep database snapshot?" |
|
||||
| `./uploads/` (in volume) | Prompt: "Keep uploaded files?" |
|
||||
| Docker Engine itself | Not installed by this project — leave it |
|
||||
|
||||
@@ -596,12 +596,12 @@ Re-running `setup.sh`:
|
||||
3. ASK: "Remove secrets/ and searxng/ directories?" (default no)
|
||||
|
||||
4. ASK: "Remove Docker images? (y/N)" (default no)
|
||||
├── Y → docker rmi jarvischat:latest
|
||||
├── Y → docker rmi caic:latest
|
||||
├── Y → docker image ls | grep searxng/qdrant/rabbitmq → prompt per image
|
||||
└── N → skip
|
||||
|
||||
5. ASK: "Keep database volume snapshot? (Y/n)" (default yes)
|
||||
├── N → docker volume rm jarvischat_data
|
||||
├── N → docker volume rm caic_data
|
||||
└── Y → leave volume (can be reattached later)
|
||||
|
||||
6. ASK: "Remove model files from ./models/? (y/N)" (default no)
|
||||
@@ -653,7 +653,7 @@ The Docker stack above defines the **coordinator** only. Workers (headless infer
|
||||
### 9.1 What a worker runs
|
||||
|
||||
```
|
||||
Worker machine (e.g. jarvis, Corsair)
|
||||
Worker machine (e.g. worker01, worker02)
|
||||
┌────────────────────────────────────┐
|
||||
│ llama-server │
|
||||
│ (single binary, no build needed) │
|
||||
@@ -717,7 +717,7 @@ The broker-mediated model is the preferred architecture for this project because
|
||||
|
||||
- [ ] `Dockerfile` written and builds clean
|
||||
- [ ] `docker-compose.yml` boots all containers
|
||||
- [ ] jarvisChat container reaches all services (env vars resolve correctly)
|
||||
- [ ] cAIc container reaches all services (env vars resolve correctly)
|
||||
- [ ] SearXNG settings.yml generated correctly by setup.sh
|
||||
- [ ] RabbitMQ password secret mounted correctly
|
||||
- [ ] GPU (NVIDIA) passes through to llama-server container
|
||||
@@ -736,7 +736,7 @@ The broker-mediated model is the preferred architecture for this project because
|
||||
|
||||
```
|
||||
docker.md ← this file (planning doc)
|
||||
Dockerfile ← jarvisChat image
|
||||
Dockerfile ← cAIc image
|
||||
docker-compose.yml ← full stack
|
||||
.env.example ← template without secrets
|
||||
setup.sh ← extraction wizard
|
||||
|
||||
Reference in New Issue
Block a user