3 Commits

Author SHA1 Message Date
librelad
3294ca4e41 fix(boot): source run_privileged.sh before checkConfigFilesMissingFiles
load_sources.sh calls checkConfigFilesMissingFiles() after init.sh +
variables.sh but BEFORE initilize_files.sh sources the function
manifest. checkConfigFilesMissingFiles uses runInstallOp (in
docker/command/run_privileged.sh) to copy missing config templates —
under LP_LAZY=1 that's an autoload stub that only exists once the
manifest is sourced. So when any template is genuinely missing, the
copy call hits "runInstallOp: command not found" and the file silently
never gets copied.

Symptom on a fresh CLI invocation (foreground or processor subprocess
inheriting LIBREPORTAL_TASK_EXEC=1) where a new config category was
added:
  config_check_missing.sh: line 33: runInstallOp: command not found
  ✓ Success 1 config files were missing and have been added to the
    configs folder.    ← false success: the count incremented but the
                         copy itself didn't happen

Fix: source run_privileged.sh directly in load_sources.sh just before
the missing-files check. The file is pure function definitions (runAsManager
/ runFileOp / runFileWrite / runInstallOp / runInstallWrite), no side
effects, ~150 lines — safe to source unconditionally and idempotent
with the eager/lazy load that happens later. Adds <1ms to every CLI
invocation; saves silent failures on the rare path that calls it.

Signed-off-by: librelad <librelad@digitalangels.vip>
2026-05-27 14:58:43 +01:00
librelad
dba63873f5 feat(lazy-load): flip CLI to LP_LAZY=1 by default (Phase 4)
scripts/source/load_sources.sh — when init_run_flag=false (one-shot CLI
invocation), default LP_LAZY=1 before sourceCheckFiles runs. Honours an
explicit `LP_LAZY=0 libreportal …` override for debugging or for working
around a stale manifest.

Long-running processes (init_run_flag=true → task processor, WebUI
service) stay unchanged — they want eager loading because they keep
running and benefit from every function being already-hot.

Measured on this box, 3 runs each:
  EAGER (default before this commit):
    real 0.91s / 1.12s / 0.94s   avg ~0.99s wall
    user 0.40s / 0.41s / 0.42s   avg ~0.41s CPU
  LAZY (new default for CLI):
    real 0.63s / 0.65s / 0.66s   avg ~0.65s wall
    user 0.26s / 0.27s / 0.26s   avg ~0.26s CPU

Wall: ~340ms saved per invocation (34%).
User: ~150ms saved per invocation (37%).

Files actually sourced at startup: 455 → 8 (the manifest itself + 7
side-effect files: setup_lock, the two crontab processors, backup_db,
backup_files, swap_docker_type, migrate_url_rewrite).

Safety nets:
- Missing manifest auto-falls-back to eager loading (init.sh check
  in the lazy branch sets LP_LAZY=0 if function_manifest.sh is absent).
- Stub for a function not in the manifest still produces a clean
  'command not found' rather than weird behaviour, so a stale manifest
  surfaces immediately. `libreportal regen arrays` regenerates both
  files_*.sh and function_manifest.sh.

Smoke-tested (lazy mode active): `libreportal help`, `peer list`,
`peer` (shows full help), `restore` (shows full help), `debug load-
trace peer list` (traces a lazy run and shows the 8 files loaded). All
output identical to eager mode.

Signed-off-by: librelad <librelad@digitalangels.vip>
2026-05-26 20:56:25 +01:00
librelad
875a60f90f LibrePortal v0.1.0 — initial release
A free, open, self-hosted app platform (GNU AGPLv3): one-click app deploys,
Traefik reverse proxy with automatic SSL, rootless Docker support, gluetun
VPN routing, and a web dashboard to manage it all.

Free & open forever to self-host; optional paid hosted services fund it.
See PROMISE.md.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

Signed-off-by: librelad <librelad@digitalangels.vip>
2026-05-21 20:37:54 +01:00