interplane.Get Omega
Read in your language

MojoLlama

Archived Mojo/MAX quantizer and serving research repository (read-only history)

Brought by drakestapleton

branch main Branches Tags History

MojoLlama / .hermes / plans / 2026-05-20_mojollama-docker-fixes.md

108 lines · 3258 bytes Raw Blame History Rendered
1# MojoLlama Docker Fix Plan
2
3**Date:** 2026-05-20
4
5---
6
7## 1. Fix engine script path resolution
8
9**`docker-entrypoint.sh:171`** — Add `benchmarks/` subdirectory:
10```bash
11ENGINE_PATH="/app/src/mojollama/benchmarks/${ENGINE_SCRIPT}"
12```
13
14## 2. Fix healthcheck port to respect `$PORT`
15
16**`Dockerfile:144-145`**:
17```dockerfile
18HEALTHCHECK --interval=30s --timeout=5s --start-period=60s --retries=3 \
19 CMD curl -sf http://localhost:${PORT:-8080}/health || exit 1
20```
21
22**`docker-compose.yml:43`** — Same fix:
23```yaml
24test: ["CMD", "curl", "-sf", "http://localhost:${PORT:-8080}/health"]
25```
26
27## 3. Remove `deploy.resources` for Zima OS compatibility
28
29**`docker-compose.yml:51-58`** — `deploy.resources` is Swarm-only, silently ignored by `docker compose up`. Replace with compose-v2-compatible approach:
30
31```yaml
32# Deploy block removed — resource limits are Swarm-only
33# Use `docker compose run --cpus=N --memory=N` instead
34# For CasaOS / Zima OS: configure resource limits in the CasaOS UI
35```
36
37## 4. Fix named volume permission clash for Zima OS
38
39**`docker-compose.yml:31`** — Named volume owned by root clashes with non-root `mojollama` user. Zima OS CasaOS expects root-owned containers. Either:
40
41- (Option A) Change config to bind mount:
42 ```yaml
43 - "${CONFIG_VOLUME:-./config}:/home/mojollama/.mojollama"
44 ```
45
46- (Option B) Create a separate mojollama-dedicated Dockerfile variant that runs as root for CasaOS
47
48**`Dockerfile:153`** — Run as root for Zima OS compatibility (CasaOS standard):
49```dockerfile
50# USER mojollama ← remove or make conditional
51```
52
53## 5. Add HuggingFace model download at startup
54
55**`Dockerfile:99-103`** — Add `huggingface_hub` to pip install list:
56```dockerfile
57RUN pip install --no-cache-dir gguf numpy transformers requests huggingface_hub
58```
59
60**`docker-entrypoint.sh`** — Before engine start, add auto-download logic:
61```bash
62# ── Auto-download model from HuggingFace if not found locally ──
63if [[ -n "$MODEL_PATH" && ! -f "$MODEL_PATH" ]]; then
64 if [[ -n "$HF_REPO" && -n "$HF_FILE" ]]; then
65 log "Downloading ${HF_REPO}/${HF_FILE}..."
66 python3 -c "
67from huggingface_hub import hf_hub_download
68import os, sys
69path = hf_hub_download(
70 repo_id='${HF_REPO}',
71 filename='${HF_FILE}',
72 local_dir='/models'
73)
74print(f'Downloaded to {path}')
75" || warn "HuggingFace download failed; server may error if model missing."
76 fi
77fi
78```
79
80**`docker-compose.yml`** — Add HuggingFace env vars:
81```yaml
82environment:
83 - HF_REPO=${HF_REPO:-}
84 - HF_FILE=${HF_FILE:-}
85```
86
87## 6. Fix `backends.py` default model path
88
89**`src/mojollama/backends.py:290`** — Change default from `/tmp/models/` to `/models/`:
90```python
91self.model_path = model_path or "/models/Qwen3-30B-A3B-Instruct-2507-Q4_K_M.gguf"
92```
93
94## 7. Default model for Zima OS (low-resource)
95
96Since Qwen3-30B is too large for low-resource devices, document that Zima OS users should use:
97
98```bash
99# Use TinyLlama (~0.7 GB) instead of Qwen3-30B (~18 GB)
100HF_REPO=bartowski/TinyLlama-1.1B-GGUF
101HF_FILE=tinyllama-1.1b.Q4_K_M.gguf
102MODEL_PATH=/models/tinyllama-1.1b.Q4_K_M.gguf
103```
104
105Or mount a local GGUF model:
106```bash
107docker compose run -v /path/to/model.gguf:/models/model.gguf:ro -e MODEL_PATH=/models/model.gguf mojollama
108```