public-release phases 1-3: read-only public mode, gunicorn container, demo bootstrap, CI, README

- before_request guard: visitors browse + explore; writes need PHYSCOM_ADMIN_TOKEN login
- SameSite=Lax/HttpOnly cookies, persisted secret key, debug off unless FLASK_DEBUG=1
- non-root gunicorn container with healthcheck; physcom demo --if-empty on first start
- landing page Top Concepts, write controls hidden from visitors
- CI workflow, pyproject metadata, compose Ollama parity, README rewrite
- tests/test_web_access.py: access control + GET smoke test of every page

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2026-09-25 15:40:02 -05:00
parent 2e38a6cf73
commit 8171fc023e
23 changed files with 510 additions and 112 deletions

View File

@@ -1,3 +1,12 @@
x-env: &env
PHYSCOM_DB: /app/data/physcom.db
LLM_PROVIDER: ${LLM_PROVIDER:-}
GEMINI_API_KEY: ${GEMINI_API_KEY:-}
GEMINI_MODEL: ${GEMINI_MODEL:-gemini-2.0-flash}
OLLAMA_MODEL: ${OLLAMA_MODEL:-qwen2.5:7b}
# Ollama running on the host machine, not in this container.
OLLAMA_HOST: ${OLLAMA_HOST:-http://host.docker.internal:11434}
services:
web:
build: .
@@ -6,37 +15,24 @@ services:
volumes:
- physcom-data:/app/data
environment:
- PHYSCOM_DB=/app/data/physcom.db
- FLASK_SECRET_KEY=${FLASK_SECRET_KEY:-}
- LLM_PROVIDER=${LLM_PROVIDER:-}
- GEMINI_API_KEY=${GEMINI_API_KEY:-}
- GEMINI_MODEL=${GEMINI_MODEL:-gemini-2.0-flash}
<<: *env
FLASK_SECRET_KEY: ${FLASK_SECRET_KEY:-}
# Visitors are read-only; log in at /login with this token to edit or run.
PHYSCOM_ADMIN_TOKEN: ${PHYSCOM_ADMIN_TOKEN:-}
PHYSCOM_SECURE_COOKIES: ${PHYSCOM_SECURE_COOKIES:-0}
extra_hosts:
- "host.docker.internal:host-gateway"
restart: unless-stopped
expose:
- 5000
cli:
build: .
volumes:
- physcom-data:/app/data
environment:
- PHYSCOM_DB=/app/data/physcom.db
- LLM_PROVIDER=${LLM_PROVIDER:-}
- GEMINI_API_KEY=${GEMINI_API_KEY:-}
- GEMINI_MODEL=${GEMINI_MODEL:-gemini-2.0-flash}
entrypoint: ["python", "-m", "physcom"]
environment: *env
extra_hosts:
- "host.docker.internal:host-gateway"
entrypoint: ["physcom"]
profiles: [cli]
# Future: replace SQLite with a dedicated DB service
# db:
# image: postgres:16
# volumes:
# - pgdata:/var/lib/postgresql/data
# environment:
# - POSTGRES_DB=physcom
# - POSTGRES_USER=physcom
# - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
volumes:
physcom-data:
# pgdata: