LibrePortal/scripts/cli/commands/app/cli_app_header.sh
librelad 26e98698d8 feat(storage): per-app placement, app move, and the READONLY marker
Phase 2 and 4 of docs/roadmap/storage-locations.md. Apps can now be
placed on a location and moved between them.

CFG_<APP>_STORAGE lands in all 37 app templates, holding a location NAME
rather than a path: names survive a migrate to a host with different
disks, paths do not. The 11 infrastructure apps that other apps reach by
literal path (traefik, prometheus, grafana, adguard, gluetun, crowdsec,
headscale, dashy, pihole, unbound, wireguard) are pinned. libreportal
itself never gets the key — it is pinned structurally by webuiDir.

Pinning needed no second config key. "Pinned" is not a fact about a value,
it is a statement about whether the field may be edited, so it goes in the
comment beside **ADVANCED** and **DEV** as **READONLY**, and the field
factory renders those disabled. That marker earns its keep beyond this
feature: derived fields already warned in prose that editing them does
nothing (crowdsec.config:72) next to a perfectly editable input.

storage_app_config.sh keeps the comment honest — it carries the resolved
path for hand-recovery and regenerates the dropdown from the registry, but
only writes when something actually changed, since the app .config is
user-editable and lives in the container-owned tree.

app move stops the app (a live copy of a running Postgres is a corrupt
copy), snapshots it, copies, verifies, and only then removes the source.
The copy runs in libreportal-ownership because it must: app data holds
rootless sub-UID files the manager can neither read nor recreate.
Verified against two real ext4 filesystems that a cross-device move
preserves uid 231141 and the payload, and that the source survives every
refusal path — unregistered destination, the WebUI app, a traversal in the
app name, and an occupied destination.

Task titles registered in both tables, with a specific rule so a move
renders as "Nextcloud - Move to bigdisk" rather than the generic fallback
dropping the destination. lp-task-names could not be run to confirm — it
borrows the WebUI container's node and no containers are running.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-24 20:37:35 +01:00

48 lines
3.2 KiB
Bash
Executable File

#!/bin/bash
# App Commands Header
# Shows available app commands and help information
cliShowAppHelp()
{
echo ""
echo "Available App Commands (* is required):"
echo ""
echo " libreportal app list [type*] - Display a list of applications"
echo " available - Show available apps to install"
echo " installed - Show installed apps"
echo ""
echo " libreportal app install [name*] [config] [--reset-network]"
echo " - Install / reinstall the specified app."
echo " On reinstall, IPs and ports are preserved by default."
echo " Pass --reset-network to re-randomize them."
echo " libreportal app add [name*] - Add an app definition from the signed registry"
echo " catalog (marketplace). It then installs like any"
echo " other app. Browse: libreportal artifact index"
echo " libreportal app uninstall [name*] - Uninstall the specified app"
echo " libreportal app move [name*] [location*] - Move the app's data to another storage"
echo " location. Stops the app, snapshots it,"
echo " copies, verifies, then removes the source."
echo " See: libreportal storage list"
echo ""
echo " libreportal app start [name*] - Start the specified app (Must be installed)"
echo " libreportal app stop [name*] - Stop the specified app (Must be installed)"
echo " libreportal app restart [name*] [service] - Restart the specified app, or just one of its"
echo " compose services when [service] is given"
echo ""
echo " libreportal app up [name*] - Docker-Compose up (Rebuild app)"
echo " libreportal app down [name*] - Docker-Compose up (Uninstall app)"
echo " libreportal app reload [name*] - Docker-Compose up & down (Reinstall app)"
echo ""
echo " libreportal app backup [name*] [password] - Backup the specified app (password optional)"
echo " libreportal app restore [name*] [file|--latest] [password] - Restore from local/remote, prefers local"
echo " libreportal app restore [name*] [local|remote1|remote2] [file] [password]"
echo " - Restore from a specific location"
echo " libreportal app status [name*] - Show status of specified app"
echo " libreportal app tool [name*] [tool*] [args]"
echo " - Run a per-app tool (Tools tab actions)."
echo " [args] is pipe-encoded: key=value|key=value"
echo " libreportal app tool list [name] - List available tools (all apps, or just [name])"
echo ""
}