835a8d6644
Self-hosted LifeOS (github.com/lifeos-app/lifeos, pinned 3009bf6) in local mode: no Supabase. Multi-stage build - Node builds the Vite bundle, gunicorn serves it plus the bundled Flask/SQLite API from one process. LAN-only on purpose: the backend is single-user with no auth, so anyone who reaches the port has full read/write. Needs Traefik basicAuth before it can ever be exposed publicly. Two upstream bugs patched via sed (build fails loudly if they are renamed): the chat model was hardcoded to the author's private 'sentient-teddy' bridge, and a hardcoded 30s timeout failed every first message because Ollama needs ~46s to cold-load the model (0.7s warm). Both are env vars now. SQLite stays on local disk - NFSv3 breaks WAL locking. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
29 lines
798 B
Python
29 lines
798 B
Python
"""Container entrypoint: serve the Flask API and the built SPA from one process.
|
|
|
|
Upstream's backend/serve.py does this too, but it also shells out to `npm run
|
|
build` and tries to launch a browser, neither of which works in a container.
|
|
"""
|
|
|
|
from pathlib import Path
|
|
|
|
from flask import send_file, send_from_directory
|
|
|
|
from app import app # importing app runs init_db(), creating the SQLite schema
|
|
|
|
DIST = Path(__file__).parent / "dist"
|
|
|
|
|
|
@app.route("/")
|
|
def _index():
|
|
return send_file(DIST / "index.html")
|
|
|
|
|
|
@app.route("/<path:path>")
|
|
def _static(path):
|
|
asset = DIST / path
|
|
if asset.is_file():
|
|
return send_from_directory(DIST, path)
|
|
if path.startswith("api/"):
|
|
return {"error": "Not found"}, 404
|
|
return send_file(DIST / "index.html") # SPA client-side routing
|