Skip to content

gate Ollama install/start/pull/launch behind y/N prompts#7

Merged
StewAlexander-com merged 2 commits into
mainfrom
auto-install-ollama-prompts
May 16, 2026
Merged

gate Ollama install/start/pull/launch behind y/N prompts#7
StewAlexander-com merged 2 commits into
mainfrom
auto-install-ollama-prompts

Conversation

@StewAlexander-com
Copy link
Copy Markdown
Owner

Summary

Make ./install.sh (and ./run.sh) detect missing prerequisites and prompt the user y/N before doing anything that touches the host. The default answer is no, so a stray Enter never installs a system binary. This keeps the "minimal intervention" promise of the two-script flow while removing the prior hard requirement that the user install/start Ollama by hand.

  • install.sh — adds a confirm() helper and gates four actions behind y/N:
    • install Ollama (runs brew install ollama on macOS or the upstream curl ... | sh on Linux),
    • start ollama serve in the background (nohup, logged to /tmp/ollama-serve.log),
    • ollama pull "$TUTOR_MODEL" (default gemma3:4b),
    • exec ./run.sh to launch the app immediately after setup.
  • run.sh — mirrors the helper and offers to start ollama serve when the binary is present but the daemon is not. Bootstrapping a fresh venv via install.sh is now done in noninteractive + skip-Ollama mode so run.sh never installs system binaries silently.
  • Env contract — accepted yes responses: y, Y, yes, Yes, YES. All four prompts default to "no" otherwise.
    • TUTOR_NONINTERACTIVE=1 / PYTHON_TUTOR_NONINTERACTIVE=1 → auto-no
    • PYTHON_TUTOR_ASSUME_YES=1 → auto-yes (suitable for pre-approved unattended setup)
    • PYTHON_TUTOR_AUTOLAUNCH=1exec ./run.sh after install without asking
    • existing TUTOR_SKIP_OLLAMA=1 / TUTOR_SKIP_MODEL_PULL=1 continue to work
  • Docs — README quick start now has an "Opt-in install prompts" table and a non-interactive/CI usage block. docs/install-runtime-workflow.md gets a refreshed Decision section and a new mermaid flow diagram showing every y/N gate.
  • Tests — new scripts/smoke_prompts.sh exercises the noninteractive path, the PYTHON_TUTOR_NONINTERACTIVE alias, and the PYTHON_TUTOR_ASSUME_YES auto-launch (via a temporarily symlinked run.sh stub so CI doesn't actually start uvicorn). Wired into the existing scripts CI job.

Behavior

Default flow (interactive, no Ollama present on a Linux box):

[install] using python3.12 (Python 3.12.8)
[install] venv already present at backend/.venv
[install] upgrading pip and installing backend deps
[install] backend dependencies installed
[install] Ollama is not installed.
[install] Install Ollama now? (will run the official upstream installer) [y/N] _

Pressing Enter (no) prints the manual command and moves on. Typing y runs curl -fsSL https://ollama.com/install.sh | sh. The next prompts (Start ollama serve…, Pull gemma3:4b…, Launch the tutor now…) are gated identically.

Testing

Local, on this branch:

  • bash -n install.sh run.sh scripts/smoke_prompts.sh — syntax check.
  • TUTOR_SKIP_OLLAMA=1 TUTOR_NONINTERACTIVE=1 ./install.sh — completes, prints [auto-no] on the launch prompt, leaves backend/.venv usable.
  • PYTHON_TUTOR_NONINTERACTIVE=1 TUTOR_SKIP_OLLAMA=1 ./install.sh — alias works identically.
  • PYTHON_TUTOR_ASSUME_YES=1 TUTOR_SKIP_OLLAMA=1 ./install.sh (with run.sh symlinked to a stub) — prints [auto-yes], execs ./run.sh.
  • ./scripts/smoke_prompts.sh — all three runs green.
  • ./scripts/smoke_run.sh — server boots, /api/health returns degraded (no Ollama), / serves the SPA.
  • backend/.venv/bin/pytest -q89 passed in 3.06s.

CI runs scripts/smoke_prompts.sh alongside the existing install + run smoke jobs.


🤖 Generated by Computer

install.sh now detects missing Ollama, a stopped daemon, and a missing
default model, and prompts y/N before each system-touching step. The
default answer is "no" so pressing Enter never installs a binary.
Accepted yes responses: y, Y, yes, Yes, YES.

run.sh mirrors the prompt helper and offers to start "ollama serve"
when it sees the binary but not the daemon.

CI/unattended controls:
  TUTOR_NONINTERACTIVE=1  / PYTHON_TUTOR_NONINTERACTIVE=1  -> auto-no
  PYTHON_TUTOR_ASSUME_YES=1                                -> auto-yes
  PYTHON_TUTOR_AUTOLAUNCH=1                                -> exec run.sh

After install, the script also asks "Launch the tutor now?" and execs
./run.sh on yes (ASSUME_YES/AUTOLAUNCH auto-accept).

Adds scripts/smoke_prompts.sh covering the noninteractive path,
auto-no marker, the PYTHON_TUTOR_NONINTERACTIVE alias, and the
ASSUME_YES auto-launch via a stubbed run.sh. CI runs it after the
existing install/run smoke jobs.

Updates README quick start + troubleshooting and
docs/install-runtime-workflow.md (new mermaid flow) to document the
opt-in behaviour and env vars.
@StewAlexander-com StewAlexander-com marked this pull request as ready for review May 16, 2026 14:25
@StewAlexander-com StewAlexander-com merged commit 678fddb into main May 16, 2026
5 checks passed
@StewAlexander-com StewAlexander-com deleted the auto-install-ollama-prompts branch May 16, 2026 14:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants