mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-10-26 19:01:39 -04:00
install_llama_cpp.sh builds llama-server from the SHA-pinned v0.3.0 source tarball (single source of truth: on-device upgrade, Pi image, Live ISO, and the new docker/llm container all call it; version-marker makes re-runs no-ops). start_llama_server.sh refuses to start unless ai.yaml enables AI and the active model file exists — which also covers unmounted media. wrolpi-llm.service is installed but deliberately never enabled at boot: the Controller starts it on demand (registered in managed_services; the llm compose service follows the samba pattern), and the API's perpetual idle-unload worker asks the Controller to stop it after the configured idle minutes. llama-server is localhost-only natively, internal-network-only in docker, and never proxied by Caddy. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
147 lines
4.3 KiB
Python
147 lines
4.3 KiB
Python
"""
|
|
Code-defined default configuration for the Controller.
|
|
|
|
Controller starts with these defaults and loads overrides from
|
|
/media/wrolpi/config/controller.yaml after the drive is mounted.
|
|
"""
|
|
|
|
DEFAULT_CONFIG = {
|
|
"port": 80,
|
|
"media_directory": "/media/wrolpi",
|
|
"hide_cert_banner": False,
|
|
|
|
"drives": {
|
|
"supported_filesystems": ["ext4", "btrfs", "vfat", "exfat"],
|
|
"auto_mount": True,
|
|
"mounts": [], # Populated from controller.yaml after drive mount
|
|
},
|
|
|
|
"managed_services": [
|
|
# WROLPi services
|
|
{
|
|
"name": "wrolpi-controller",
|
|
"systemd_name": "wrolpi-controller",
|
|
"port": 80,
|
|
"viewable": True,
|
|
"use_https": False,
|
|
"description": "Controller API (FastAPI)",
|
|
},
|
|
{
|
|
"name": "wrolpi-api",
|
|
"systemd_name": "wrolpi-api",
|
|
"port": 8081,
|
|
"viewable": True,
|
|
"use_https": False,
|
|
"description": "Python API (Sanic)",
|
|
},
|
|
{
|
|
"name": "wrolpi-api-dev",
|
|
"systemd_name": "wrolpi-api-dev",
|
|
"port": 8081,
|
|
"viewable": True,
|
|
"use_https": False,
|
|
"description": "Python API (Development)",
|
|
"kind": "task",
|
|
"show_only_when_running": True,
|
|
},
|
|
{
|
|
"name": "wrolpi-app",
|
|
"systemd_name": "wrolpi-app",
|
|
"port": 3000,
|
|
"viewable": False,
|
|
"use_https": False,
|
|
"description": "React frontend",
|
|
},
|
|
{
|
|
"name": "wrolpi-app-dev",
|
|
"systemd_name": "wrolpi-app-dev",
|
|
"port": 3000,
|
|
"viewable": False,
|
|
"use_https": False,
|
|
"description": "React frontend (Development)",
|
|
"kind": "task",
|
|
"show_only_when_running": True,
|
|
},
|
|
{
|
|
"name": "wrolpi-help",
|
|
"systemd_name": "wrolpi-help",
|
|
"port": 8086,
|
|
"viewable": True,
|
|
"use_https": True,
|
|
"description": "Help documentation",
|
|
},
|
|
{
|
|
"name": "wrolpi-kiwix",
|
|
"systemd_name": "wrolpi-kiwix",
|
|
"port": 8085,
|
|
"viewable": True,
|
|
"use_https": True,
|
|
"description": "Kiwix/Zim server",
|
|
},
|
|
{
|
|
"name": "wrolpi-llm",
|
|
"systemd_name": "wrolpi-llm",
|
|
"port": 11435,
|
|
"viewable": False,
|
|
"use_https": False,
|
|
"description": "AI assistant (llama-server)",
|
|
# On-demand: started by the Controller when AI is enabled, stopped by the API when idle.
|
|
"kind": "persistent",
|
|
},
|
|
# System services
|
|
{
|
|
"name": "caddy",
|
|
"systemd_name": "caddy",
|
|
"port": 443,
|
|
"viewable": True,
|
|
"use_https": True,
|
|
"description": "Web proxy (HTTPS)",
|
|
},
|
|
# Samba file sharing services
|
|
{
|
|
"name": "smbd",
|
|
"systemd_name": "smbd",
|
|
"port": 445,
|
|
"viewable": False,
|
|
"use_https": False,
|
|
"description": "Samba file sharing",
|
|
},
|
|
{
|
|
"name": "nmbd",
|
|
"systemd_name": "nmbd",
|
|
"port": 137,
|
|
"viewable": False,
|
|
"use_https": False,
|
|
"description": "Samba NetBIOS name service",
|
|
},
|
|
# Upgrade service - only shown when running
|
|
{
|
|
"name": "wrolpi-upgrade",
|
|
"systemd_name": "wrolpi-upgrade",
|
|
"port": None,
|
|
"viewable": False,
|
|
"use_https": False,
|
|
"description": "WROLPi upgrade process",
|
|
"kind": "task",
|
|
"show_only_when_running": True,
|
|
},
|
|
],
|
|
|
|
"hotspot": {
|
|
"device": "wlan0",
|
|
"ssid": "WROLPi",
|
|
"password": "wrolpi hotspot",
|
|
"protocol": "wpa2", # wpa2 (wpa-psk) or wpa3 (sae); see get_device_hotspot_protocols
|
|
# Show a landing page (with this WROLPi's address) to devices that join the hotspot.
|
|
"captive_portal": True,
|
|
},
|
|
|
|
"throttle": {
|
|
"default_governor": "ondemand",
|
|
},
|
|
|
|
"samba": {
|
|
"shares": [],
|
|
# Each share: {"name": str, "path": str, "read_only": bool, "comment": str}
|
|
},
|
|
}
|