SLAP documentation

Decision Log

Every architectural choice, why it was made, and what it costs. Sponsor must-have M-5 requires another organization to be able to reproduce and maintain this deployment; that is impossible if the reasoning lives only in the heads of six students.

Format: decision, date, status, alternatives considered, consequences. Decisions are reversible. If one is overturned, mark it SUPERSEDED and add a new entry rather than editing history.


D-01 - Everything runs in Docker, including Ollama#

Date: 2026-09-01 | Status: ACCEPTED | Decided by: Team SLAP

The full stack, Ollama included, runs as containers. Target is dedicated server hardware on a site LAN; Windows and macOS machines are for development.

Alternatives considered:

Consequences:


D-02 - GPU support is an optional overlay, auto-detected#

Date: 2026-09-01 | Status: ACCEPTED

docker-compose.yml is CPU-only and runs anywhere. docker-compose.gpu.yml adds NVIDIA device reservation. start_mvp.sh probes nvidia-smi and applies the overlay automatically.

Consequences:


D-03 - Private-by-default user workspaces, plus admin-published shared libraries#

Date: 2026-09-01 | Status: ACCEPTED

Each user has their own chats and their own uploaded documents, like any normal chatbot. No user can see the content of another user. An administrator can additionally publish shared Knowledge collections that all users may query.

Alternatives considered:

Consequences:


D-04 - Model selection and origin policy#

Date: 2026-09-01 | Status: ACCEPTED | Amended 2026-09-03

MVP ships llama3.2:3b for chat and nomic-embed-text for embeddings. An administrator can add other models from the Open WebUI interface without touching a command line.

Correction, 2026-10-19: the sentence above was not true while sealed. The UI's "pull from Ollama.com" needs internet, which Ollama never has (D-11), and its GGUF upload was blocked by the nginx body limit. Browser upload is made to work by D-13, on Open WebUI v0.12.0 or later.

Amendment, 2026-09-03. The original default was llama3:8b. Changed after testing on real hardware for two reasons found by actually running it:

  1. llama3:8b does not support tool calling. Open WebUI surfaces this as registry.ollama.ai/library/llama3:8b does not support tools, which is a confusing error for a non-technical user who did nothing wrong.
  2. At 4.7 GB it is slow on a machine without a GPU, which is the exact profile of the resource-constrained organizations the sponsor described.

llama3.2:3b is 2 GB, supports tools, and remains US-origin. Both models are kept installed so the pair becomes the first two rows of the benchmark matrix (S-7): same platform, same documents, two model sizes, measurable difference.

This is the first decision in this project driven by measurement rather than reasoning, which is the mode the benchmarking phase should run in.

Rationale: the sponsors expressed hesitation toward models of PRC origin (DeepSeek, Qwen), with somewhat less concern where the deployment is a closed loop. Both defaults are permissively licensed and avoid that question entirely for the MVP. This is a default, not a restriction: the platform is model-agnostic, which is the point.

Consequences:


D-05 - Three-network segmentation with a sealed vector store#

Date: 2026-09-01 | Status: SUPERSEDED BY D-11

Consequences:


D-06 - Bind to loopback by default, LAN only after signup is closed#

Date: 2026-09-01 | Status: ACCEPTED

Shipped default is HTTP_BIND=127.0.0.1. Serving the LAN requires an explicit change to 0.0.0.0.

Rationale: first boot necessarily has open registration so that an admin account can be created, and the first account created becomes administrator. Shipping a default that exposes that window to an entire hospital or plant network would be a genuine vulnerability introduced by our own deployment procedure, which is exactly what M-6 warns against. start_mvp.sh prints a warning if it detects LAN binding with signup still open.

Consequences:


D-07 - Image tags are configurable, and must be pinned before production#

Date: 2026-09-01 | Status: SUPERSEDED BY D-18

Tags come from .env. Development defaults are latest and main.

Consequences:


D-08 - Use Open WebUI native RAG; no custom ingestion service#

Date: 2026-09-01 | Status: ACCEPTED

Chunking, embedding and retrieval are handled by Open WebUI writing to Qdrant. No custom Python service.

Rationale: the sponsor was explicit that the deliverable is not the model and not novel machine learning, but the architecture, processes and controls that let an organization deploy and trust it. A custom ingestion service is more code to secure, document and maintain, for uncertain benefit.

Consequences:


D-09 - HTTP for the MVP, TLS structured in but disabled#

Date: 2026-09-01 | Status: ACCEPTED

The TLS server block is written and commented in nginx/nginx.conf.

Rationale: on a loopback-bound development machine TLS adds nothing. On a LAN server it matters, but a site with no internet route cannot use public ACME certificate authorities, so it needs an internal CA plus distribution of that CA to client machines. That distribution procedure is real work and belongs with the security phase of the sponsor timeline, in November.

Consequences:


D-10 - Decisions and non-goals are tracked in the repository#

Date: 2026-09-01 | Status: ACCEPTED

This file, SCOPE.md and REQUIREMENTS.md are treated as deliverables of equal standing with the code, because M-5 and M-6 are documentation requirements. AI_USAGE.md exists because the sponsor asked the team to report how AI was used on the project. TEAM_DECISIONS.md records which decisions a human made and what they overrode, which is the honest half of that AI-usage answer.


D-11 - Sealed by default; network access is opt-in and temporary#

Date: 2026-09-01 | Status: ACCEPTED | Supersedes D-05 Decided by: project lead (see TEAM_DECISIONS.md T-07)

The platform now has no route to the internet by default. Opening one requires explicitly running ./start_mvp.sh --online, which layers docker-compose.provision.yml, downloads models, and then removes the network again in the same run.

Topology:

Network Internal Members Why
ai_public no nginx only carries the published port
ai_ui yes nginx, open-webui
ai_data yes open-webui, qdrant
ai_infer yes open-webui, ollama

Ollama, Qdrant and Open WebUI therefore have no path to the internet at any time, including during normal operation.

This design was settled empirically rather than from documentation. We tested whether a published port works on an internal: true network: it does not, the port is unreachable from the host. We also confirmed that containers on an internal network genuinely cannot reach an external IP address. That is why nginx keeps one routable network and everything else is sealed behind it.

Alternatives considered:

Consequences:


D-12 - Offline bundle on removable media#

Date: 2026-09-01 | Status: ACCEPTED Decided by: project lead (see TEAM_DECISIONS.md T-07)

scripts/build_bundle.sh runs on a connected machine and produces a directory containing the container images (docker save), the downloaded models (the exported Ollama volume), the repository itself, a manifest of exact image digests, and SHA256 checksums. That directory is copied to a flash drive. scripts/install_offline.sh consumes it on a machine that has never had internet access.

This addresses sponsor stretch goal S-1 and super-stretch S-1b.

Alternatives considered:

Consequences:


D-13 - Admins add models through the browser; nginx lifts the body limit on that one path#

Date: 2026-10-19 | Status: ACCEPTED (pending team review)

An administrator adds a model with Admin Panel > Settings > Models > Manage > Upload a GGUF model. The file travels browser -> nginx -> Open WebUI -> Ollama, over the internal networks only, so the platform stays sealed. nginx/nginx.conf gives the path /ollama/models/upload a 10 GB body limit; every other path keeps 512 MB.

Why: after hand-over, the receiving organization adds models for years with no one to ask. A browser page is the route its admin can use without a terminal. D-04 already promised this; until now it did not work.

What was tested on 2026-10-19 (Open WebUI 0.11.3, Ollama 0.33.3), with an 808 MB Llama-3.2-1B-Instruct-Q4_K_M.gguf whose SHA-256 matched the publisher's:

Alternatives considered:

Consequences:


D-14 - Apache Tika for document text extraction, with OCR#

Date: 2026-10-19 | Status: ACCEPTED

A fifth container, apache/tika:3.3.1.0-full, extracts text for Open WebUI. The -full image bundles Tesseract, so pages that are images (scans, photographed slides) become searchable with no runtime downloads. It sits on ai_data only, read-only root filesystem, Java heap capped at 1 GB.

Measured on a 15-page lecture PDF with 3 image-only pages: built-in parser 3,589 characters, Tika 7,541, including the scanned text; 5.8 s on CPU; about 500 MB RAM.

Alternatives: Docling (better tables, but a multi-GB image that may fetch models at runtime, risky while sealed); Open WebUI's own image OCR (its library is not installed in the image, and installing it needs internet).

Consequences: +344 MB image, about +0.5 GB RAM, slower uploads for scanned PDFs. New installs use Tika automatically; an existing install must switch it once in Admin > Settings > Documents, because Open WebUI keeps its own copy of that setting. Documents uploaded before the switch keep their old text until re-uploaded.


D-15 - Ship gemma3:4b as an optional image-reading model; legacy function calling#

Date: 2026-10-19 | Status: ACCEPTED

EXTRA_MODELS (default gemma3:4b) lists optional models that start_mvp.sh --online and build_bundle.sh download next to the default, so every install and every offline bundle includes them. Gemma 3 4B reads images (screenshots, photos) as well as text; US origin (Google), so D-4's origin concern does not apply. ~3.4 GB.

llama3.2:3b stays the default: Gemma reports completion, vision but no tool calling. With Open WebUI's default (native) function calling, it attaches built-in tools to every request, and Gemma refused with does not support tools. DEFAULT_MODEL_PARAMS={"function_calling":"legacy"} makes Open WebUI inject retrieved documents into the prompt instead, which any model handles.

Tested 2026-10-19 on macOS (CPU): Gemma correctly read the title and merged status from a screenshot of a GitHub page (~1 min). llama3.2:3b still answered a question from an uploaded PDF correctly, with its source.

Consequences: +3.4 GB per install and bundle (set EXTRA_MODELS= empty to skip). Only one model stays loaded (OLLAMA_MAX_LOADED_MODELS=1), so switching models costs a reload. Built-in tool features (memory, notes as tools) are off by default. Existing installs must set Function Calling to Legacy once in the admin panel (D-13's persistent-config caveat, issue #10).

Also: the launchers' fallback chat model is now llama3.2:3b (was llama3:8b, contradicting D-04), and model presence is checked by exact name, so gemma3:12b no longer counts as gemma3:4b.


D-16 - Every approved user can use every enabled model#

Date: 2026-10-19 | Status: ACCEPTED

BYPASS_MODEL_ACCESS_CONTROL=true. Open WebUI shows a model only to admins until someone gives it a database entry with access rules, and models pulled through Ollama never get one. Tested with a non-admin account: it saw zero models and every chat was refused. SLAP was usable by the admin alone.

With the setting, the same account sees every enabled model and can chat. Its view of other users' files, chats and Knowledge is unchanged (empty lists, 404/401 on direct access), because document access is a separate control that stays on (D-03). Model control stays with admins: only they can upload models (D-13) or switch one off in Admin > Settings > Models, which hides it and refuses direct requests for it.

Read from the environment at every start, so it also fixes existing installs.

Alternative: mark each model Public by hand. Rejected: a manual step per model and per install, repeated after every new model, which a site with no one to ask will miss. Per-group model restriction (S-5) would need it; not built.

Admin notes: switch off nomic-embed-text so users don't pick it (tested: document search keeps working). Open WebUI quirk: the first time a model is switched off, switching it back on without reloading the page silently fails; reload first.


D-17 - nginx checks for an admin before accepting a model upload; config edits apply on re-run#

Date: 2026-10-19 | Status: ACCEPTED | Amends D-13

/ollama/models/upload now uses nginx auth_request against Open WebUI's admin-only /ollama/config. Tested: a request with no login or from a regular user is refused with 401 in ~4 ms with 0 bytes of an 808 MB upload sent (before: 401 only after all 808 MB had arrived). An admin passes.

nginx now mounts the nginx/ directory and starts with -c /etc/nginx/slap/nginx.conf; start_mvp.sh tests and reloads the config on every run and refuses a broken one. Before, a single-file mount kept the old file after an editor replaced it, so edits silently never applied. Tested by editing the file and re-running start_mvp.sh.


D-18 - Pin every image to the tested version; Open WebUI 0.11.3 -> v0.12.3#

Date: 2026-10-19 | Status: ACCEPTED | Answers NB-04 question 1 (tag, not digest)

Image Pinned Was
ollama/ollama 0.33.3 latest
ghcr.io/open-webui/open-webui v0.12.3 main (0.11.3 on the test machine)
qdrant/qdrant v1.19.1 latest
nginx 1.27.5-alpine 1.27-alpine
apache/tika 3.3.1.0-full (already pinned)

Versions live only in docker-compose.yml, under new names (OPEN_WEBUI_VERSION etc.), so an old .env that still says OPEN_WEBUI_TAG=main can no longer override them. build_bundle.sh reads its image list from the same file (docker compose config --images), and verify_offline.sh probes with whatever nginx image is running. Tags, not digests: readable, and the bundle's MANIFEST already records exact digests.

Upgrade tested on the macOS dev machine (after copying the data volumes by hand, since Open WebUI migrates its database one way): chats, users, files and settings all kept; a regular user's existing login kept working; Tika + document Q&A, Gemma reading a screenshot, and the offline check all pass. The admin browser upload of an 808 MB GGUF now creates a working model (the upstream bug blocking D-13 is fixed in 0.12). Still true on 0.12.3: Ollama keeps two copies of an uploaded model, and the model toggle quirk from D-16 (reload before switching a model back on).


D-19 - OCR images inside PDFs; search with the user's own words#

Date: 2026-10-19 | Status: ACCEPTED | Fixes issue #18

Two causes of retrieval misses found by testing an 8-question set against a 15-page lecture PDF (scanned pages, charts) on Open WebUI v0.12.3:

  1. Chart text was never extracted. Tika OCRs only pages with no text, so numbers inside a chart on a text page (13.7%, 86.3%) were missing. PDF_EXTRACT_IMAGES=true makes Tika OCR embedded images too: 7,499 -> 12,213 characters, chart numbers present; retrieval found the right passage for 8/8 questions (was 6/8). Extraction took ~12 s instead of ~6 s.
  2. Chat searched with a rewrite, not the question. By default the model first rewrites the question into search queries; llama3.2:3b dropped "toothpaste", so the right passage was never retrieved. ENABLE_RETRIEVAL_QUERY_GENERATION=false searches with the question as typed. Toothpaste, table tennis, 36 men, 13.7%, the PSU survey and the four food-security levels were then all answered correctly in chat.

Hybrid search (BM25 + vector) was tested and did not help: with no reranking model (and downloading one is not possible sealed) its final ranking falls back to vector similarity, 6/8 like plain vector search.

Consequences: slower uploads for PDFs with many images; logos and photos may add some OCR noise. Vague follow-up questions ("and in 2021?") are searched as typed, so they retrieve less well than a self-contained question. Both settings apply at first boot only; existing installs: Admin > Settings > Documents > PDF Extract Images (OCR) on, and Admin > Settings > Interface > Retrieval Query Generation off; then re-upload documents. One document is a small test set: a larger, labelled one is still needed (NB-05, S-4).


D-20 - Settings come from the repo on every start; signup closed by default#

Date: 2026-10-20 | Status: ACCEPTED | Fixes issue #10

ENABLE_PERSISTENT_CONFIG=false. Open WebUI otherwise copies its settings into its database on first boot and ignores docker-compose.yml and .env afterwards, so every setting changed since then (Tika, image OCR, legacy function calling, search with the user's words) had to be clicked by hand on each existing install, and an upgrade could not carry settings.

Tested on an install set back to the old values: after a plain ./start_mvp.sh, all four took the repo's values with no clicks. Users and roles, chats, files, a Knowledge collection, model on/off switches and the regular user's existing login all survived. A Tika + OCR upload and a retrieval question worked end to end.

What changes for admins: Admin Panel settings pages now apply until the next restart, then revert to the repo's values (tested: top-K 5 -> 7 -> restart -> 5). Change settings in docker-compose.yml or .env instead. Everything admins do in the app is data and persists: users and approvals, documents, Knowledge, model on/off switches (tested across a restart).

Signup: Open WebUI used to close signup by writing to its own settings after the first account, which this setting now ignores. ENABLE_SIGNUP in .env is therefore the one real switch, and now defaults to false. Tested on a fresh, empty instance: with signup off the first account is still allowed and becomes admin (Open WebUI never gates the first admin), and a second signup is refused (403). start_mvp.sh warns on every run while signup is open. An existing install whose .env still says ENABLE_SIGNUP=true will have signup open (new accounts wait as pending) until it is set to false.


D-21 - Two ways to add models: a models folder on the drive, or an optional timed download window#

Date: 2026-10-20 | Status: ACCEPTED (pending team review) | Amends D-11, D-12

Starting assumption: the target machine has no internet, not even for setup. Adding models should still be as simple as possible.

  1. Models folder (the default). The bundle's models/ folder holds every model: the exported Ollama archive, plus any .gguf files. build_bundle.sh copies .gguf files from the build machine's ./models into it, so SHA256SUMS covers them. More can be dropped in on the drive later. bash install.sh, now written at the top of the bundle, runs the installer, which imports them with import_models.sh <folder>. That script now accepts any folder. It copies each file into ./models (the only folder Ollama can see), imports it, deletes the copy, and records the file's SHA-256 in model-imports.log.
  2. Download window (optional). ./start_mvp.sh --window (30 minutes; --window=N for 1 to 240) starts the whole platform with the provisioning network on Ollama only, so an admin can use Admin Panel > Settings > Models > Manage > Pull a model from Ollama.com. The window ends on its timer, on Ctrl+C, or on a kill or hang-up, then re-seals exactly as --online does. Any later ./start_mvp.sh or ./stop_mvp.sh removes a provisioning network left behind by a run that was cut off.
  3. ALLOW_ONLINE in .env. false makes --online and --window refuse to run. Unset means true, so older .env files keep working. A fresh offline install writes false. A connected install keeps true, so the README quick start still works. build_bundle.sh ignores it: it only runs on the build machine.

A site's own .gguf files add to the default models; they never replace them. The bundle always carries CHAT_MODEL and EMBED_MODEL. File names cannot contain :, so an imported file can never match a name like llama3.2:3b, and replacing the embedding model would change document search.

Alternatives considered:

Tested 2026-10-20 on the Windows development machine (Git Bash). The running stack was on older, unpinned images (ollama:latest, Open WebUI main):

Tested 2026-10-29 on a Linux PC (Ryzen 7600X, no GPU, pinned images), during the public demo setup (T-14):

Not yet tested:

Consequences:

Source: docs/DECISIONS.md in the CapstoneLocalAI repository (local working copy). Built Dec 3, 2026.