deploy: sensible Dockerfile defaults + simplified compose snippet
Image rebuild (skip scrape) / build (push) Failing after 1h41m9s

Dockerfile now sets OLLAMA_URL=http://ollama:11434 and
RERANK_URL=http://llama-rerank:8080 as image defaults, assuming the
MCP container shares a Docker network with services named `ollama`
and `llama-rerank` (typical compose pattern). Drawbar's stack
already runs both — no cross-host IPs to maintain, no off-stack
GPU dependencies. Stays inside the trashpanda compose.

deploy/drawbar-compose-snippet.md simplified: no environment
overrides needed for the common case. Override block shown only
for stacks with non-default service names. Pull tag updated to
:corpus-2026.05.24.

Per the new architecture call:
- MCP doesn't reach out to cross-host Ollama instances (192.168.0.2,
  192.168.0.125 etc.) at serve time — only at index-build time in CI.
- All serve-time dependencies are in the same Docker network as
  the consumer apps.

Code push touches Dockerfile → image-only.yml will rebuild + push.
Future-me note: the image-only.yml needs Ollama reachable from the
Gitea Actions runner for the reindex step; that still uses the LAN
endpoints (workflow env), which is correct since indexing is CI-side
not serve-side.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-24 13:09:38 -04:00
parent 2acba0aa86
commit c5ed5560fc
2 changed files with 40 additions and 51 deletions
+7 -3
View File
@@ -46,9 +46,13 @@ ENV PYTHONUNBUFFERED=1 \
MCP_TRANSPORT=streamable-http \ MCP_TRANSPORT=streamable-http \
MCP_HOST=0.0.0.0 \ MCP_HOST=0.0.0.0 \
MCP_PORT=8000 \ MCP_PORT=8000 \
HYBRID_SEARCH=true HYBRID_SEARCH=true \
# RERANK_URL set at deploy time, e.g. http://llama-rerank:8080 OLLAMA_URL=http://ollama:11434 \
# OLLAMA_URL set at deploy time, comma-separated list RERANK_URL=http://llama-rerank:8080
# Defaults above assume the MCP container shares a Docker network
# with services named `ollama` and `llama-rerank`. Override either
# in the compose `environment:` block if your stack uses different
# service names or if you want to point at off-stack hosts.
EXPOSE 8000 EXPOSE 8000
+32 -47
View File
@@ -1,8 +1,8 @@
# Drawbar deploy — `crop-chem-docs` MCP server snippet # Drawbar deploy — `crop-chem-docs` MCP server snippet
Drop this into Drawbar's `docker-compose.yml`. Targets the existing Drop this into Drawbar's `docker-compose.yml`. Targets the existing
trashpanda infra: Ollama pool on the LAN, `llama-rerank` container trashpanda stack: shared Docker network with `ollama` + `llama-rerank`
on Tesla P4, Cloudflare Tunnel out front. service containers, Cloudflare Tunnel out front.
## Pre-reqs (one-time on the deploy host) ## Pre-reqs (one-time on the deploy host)
@@ -10,53 +10,48 @@ on Tesla P4, Cloudflare Tunnel out front.
```bash ```bash
docker login git.jpaul.io -u justin # PAT for password docker login git.jpaul.io -u justin # PAT for password
``` ```
2. **Ollama embed pool** reachable from this host (already up): 2. **`ollama` and `llama-rerank` services** are already running in
- `192.168.0.2:11434`, `192.168.0.2:11435` (Gitea-host GPUs) the same compose stack on the same Docker network. The MCP
- `192.168.0.125:11434` (Windows GPU) container resolves them by service name via Docker's embedded
3. **Reranker** reachable (already up on trashpanda): DNS — no IPs to maintain.
- `http://10.10.1.65:8082`
## Compose service ## Compose service
```yaml ```yaml
services: services:
crop-chem-docs: crop-chem-docs:
image: git.jpaul.io/justin/crop-chem-docs:latest image: git.jpaul.io/justin/crop-chem-docs:corpus-2026.05.24
# Or pin to an immutable tag for prod: # :latest for dev / Watchtower auto-pull
# image: git.jpaul.io/justin/crop-chem-docs:corpus-2026.05.24
container_name: crop-chem-docs container_name: crop-chem-docs
restart: unless-stopped restart: unless-stopped
ports: ports:
- "8001:8000" # MCP server (streamable-http). Adjust host port. - "8001:8000" # MCP server (streamable-http). Adjust host port.
environment: # No environment block needed — the image's defaults handle it:
# Embedder pool. Round-robined for parallel search. # OLLAMA_URL=http://ollama:11434
OLLAMA_URL: "http://192.168.0.2:11434,http://192.168.0.2:11435,http://192.168.0.125:11434,http://10.10.1.65:11434" # RERANK_URL=http://llama-rerank:8080
# Reranker on trashpanda's Tesla P4. # HYBRID_SEARCH=true
RERANK_URL: "http://10.10.1.65:8082" # PRODUCT_NAME=crop_chem
# Production retrieval: BM25 + dense fused, then reranked. # Override here only if your services have different names.
HYBRID_SEARCH: "true" networks:
# Override docs URL shown to the LLM if needed (default is EPA PPLS portal). - default # or whichever shared network ollama/llama-rerank are on
# PRODUCT_DOCS_URL: "https://..."
labels: labels:
# Watchtower auto-pulls :latest on update.
com.centurylinklabs.watchtower.enable: "true" com.centurylinklabs.watchtower.enable: "true"
```
# Optional: if you want Watchtower to drive auto-updates of this If your stack uses non-default service names:
# container too, you already run watchtower elsewhere — just make
# sure this container has the label above set true. ```yaml
environment:
OLLAMA_URL: "http://<your-ollama-service>:11434"
RERANK_URL: "http://<your-rerank-service>:8080"
``` ```
## Test from the host ## Test from the host
```bash ```bash
# Tool inventory (uses MCP's HTTP transport — adjust if you have a # Verify counts + indexes from inside the container:
# different MCP client probe handy): docker exec crop-chem-docs python -c \
curl -s http://localhost:8001/sse # or whichever endpoint your "from docs_mcp.server import corpus_status; print(corpus_status())"
# client expects from streamable-http
# Or exec into the container and run the stdio transport:
docker exec -it crop-chem-docs \
python -m docs_mcp.server --transport stdio < /dev/null
``` ```
## What the container exposes ## What the container exposes
@@ -69,30 +64,20 @@ docker exec -it crop-chem-docs \
| `corpus_status` | Counts + freshness; useful for health probes | | `corpus_status` | Counts + freshness; useful for health probes |
| `crop_chem_api_lessons` | Curated agronomy / label-handling knowledge — call before recommending | | `crop_chem_api_lessons` | Curated agronomy / label-handling knowledge — call before recommending |
## Versioning ## Tag scheme
Tags published by the Gitea Actions workflows:
| Tag | When | Use for | | Tag | When | Use for |
|---|---|---| |---|---|---|
| `:latest` | Every monthly refresh + every code push | Dev / Watchtower auto-pull | | `:latest` | Every monthly refresh + every code push | Dev / Watchtower auto-pull |
| `:<sha12>` | Every build | Rollback pin | | `:<sha12>` | Every build | Rollback pin |
| `:corpus-YYYY.MM.DD` | Every build | Pin to a specific corpus snapshot in prod | | `:corpus-YYYY.MM.DD` | Every build | **Production pin** (frozen corpus version) |
The `:corpus-YYYY.MM.DD` tag is the right one for production —
guarantees the running container has a known, frozen corpus that
matches the labels you've validated against.
## Updating the corpus ## Updating the corpus
Two paths: - **Monthly cron** — 1st @ 06:00 UTC, full re-scrape of Bayer + EPA PPLS,
reindex, image push. Watchtower pulls the new `:latest` automatically.
1. **Wait for the monthly cron** — 1st @ 06:00 UTC, full re-scrape - **Manual** — Gitea Actions UI → `Monthly corpus refresh` → `Run workflow`.
of Bayer + EPA PPLS, then reindex, then image push. Watchtower Optional `sources` input for single-source refresh (e.g., `bayer` only).
pulls the new `:latest` automatically.
2. **Trigger manually** in Gitea Actions UI → `Monthly corpus
refresh` → `Run workflow`. Optional `sources` input for
single-source refresh (e.g., `bayer` only).
## Switching corpus scope ## Switching corpus scope