A peer is a named reference to another LibrePortal instance. Phase 2 only
implements kind=backup-channel (friendly label over a hostname that shows
up in a shared backup repo); direct-ssh-direct and direct-ssh-via-relay
(Connect's blind-relay) are reserved enum values for Phase 3.
DB schema (db_create_tables.sh):
CREATE TABLE peers (
id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT UNIQUE NOT NULL,
kind TEXT NOT NULL DEFAULT 'backup-channel',
config_json TEXT NOT NULL DEFAULT '{}',
status TEXT DEFAULT 'unknown',
last_seen TEXT,
created_at TEXT DEFAULT CURRENT_TIMESTAMP
);
+ indexes on name and kind.
config_json is kind-specific so new transports don't need a schema
migration. For backup-channel it carries {"hostname":"","loc_idx":N}.
Bash module (scripts/peer/):
peer_helpers.sh _peerDb, peerSqlEscape, peerValidateName/Kind.
peer_add.sh peerAdd <name> <kind> [k=v ...] → INSERT, refresh
generator. Rejects unimplemented kinds early so users
don't create dead-end peer records.
peer_remove.sh peerRemove <name> → DELETE.
peer_list.sh peerList → JSON array; peerGet, peerNameForHostname
(reverse-lookup for the migrate-tab overlay).
peer_check.sh peerCheckReachable, peerCheckAll. For backup-channel
'reachable' = at least one snapshot from that hostname
visible in (preferred|any enabled) location. Updates
status + last_seen so UI dots render without re-probing.
CLI (scripts/cli/commands/peer/):
libreportal peer list
libreportal peer get <name>
libreportal peer add <name> backup-channel hostname=<host> [loc_idx=<n>]
libreportal peer remove <name>
libreportal peer check [name]
Auto-routed by cli_initialize.sh's category-discovery.
WebUI data generator (scripts/webui/data/generators/peers/webui_peers.sh):
Emits data/peers/generated/peers.json with the peerList output and a
generated_at envelope. Hooked into webuiLibrePortalUpdate alongside the
backup generators.
Frontend:
- New top-level /peers route in spa.js (PeersPage class, peers-content.html).
- 'Peers' nav item in the topbar between Backups and the right-side controls.
- Add-peer modal with friendly-name + kind + hostname + preferred-location
selector (populated from the existing backup-locations data).
- Per-peer card with status dot, last-checked time, Check + Remove buttons.
- Phase 3 kinds appear in the kind dropdown as disabled options so users
can see what's coming.
Source-array wiring:
- generate_arrays.sh auto-created files_peer.sh from the new peer/ dir.
- cli_files.sh + app_files.sh include ${peer_scripts[@]} alphabetically.
- files_webui.sh auto-picked-up the new peers/ generator subfolder.
The migrate-tab friendly-name overlay (use peer names in /backup/migrate
when a peer record exists for a hostname) is intentionally deferred — it's
a 5-line frontend lookup once peers.json is loaded; cleaner to add after
Phase 3 ships its peer-detail view.
Signed-off-by: librelad <librelad@digitalangels.vip>
49 lines
2.0 KiB
Bash
Executable File
49 lines
2.0 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# This file is auto-generated by generate_arrays.sh
|
|
# Do not edit manually - run './scripts/source/files/generate_arrays.sh run' to regenerate
|
|
|
|
cli_scripts=(
|
|
"cli/cli_initialize.sh"
|
|
"cli/cli_update.sh"
|
|
"cli/commands/app/cli_app_commands.sh"
|
|
"cli/commands/app/cli_app_header.sh"
|
|
"cli/commands/app/cli_app_restore.sh"
|
|
"cli/commands/app/cli_app_tool_list.sh"
|
|
"cli/commands/backup/cli_backup_commands.sh"
|
|
"cli/commands/backup/cli_backup_header.sh"
|
|
"cli/commands/config/cli_config_commands.sh"
|
|
"cli/commands/config/cli_config_header.sh"
|
|
"cli/commands/dockertype/cli_dockertype_commands.sh"
|
|
"cli/commands/dockertype/cli_dockertype_header.sh"
|
|
"cli/commands/firewall/cli_firewall_commands.sh"
|
|
"cli/commands/firewall/cli_firewall_header.sh"
|
|
"cli/commands/help/cli_help_commands.sh"
|
|
"cli/commands/help/cli_help_header.sh"
|
|
"cli/commands/install/cli_install_commands.sh"
|
|
"cli/commands/install/cli_install_header.sh"
|
|
"cli/commands/ip/cli_ip_commands.sh"
|
|
"cli/commands/ip/cli_ip_header.sh"
|
|
"cli/commands/peer/cli_peer_commands.sh"
|
|
"cli/commands/peer/cli_peer_header.sh"
|
|
"cli/commands/regen/cli_regen_commands.sh"
|
|
"cli/commands/regen/cli_regen_header.sh"
|
|
"cli/commands/reset/cli_reset_commands.sh"
|
|
"cli/commands/reset/cli_reset_header.sh"
|
|
"cli/commands/restore/cli_restore_commands.sh"
|
|
"cli/commands/restore/cli_restore_header.sh"
|
|
"cli/commands/setup/cli_setup_commands.sh"
|
|
"cli/commands/setup/cli_setup_header.sh"
|
|
"cli/commands/ssh/cli_ssh_commands.sh"
|
|
"cli/commands/ssh/cli_ssh_header.sh"
|
|
"cli/commands/system/cli_system_commands.sh"
|
|
"cli/commands/system/cli_system_header.sh"
|
|
"cli/commands/update/cli_update_commands.sh"
|
|
"cli/commands/update/cli_update_header.sh"
|
|
"cli/commands/validation/cli_validation_commands.sh"
|
|
"cli/commands/validation/cli_validation_header.sh"
|
|
"cli/commands/webui/cli_webui_commands.sh"
|
|
"cli/commands/webui/cli_webui_header.sh"
|
|
|
|
)
|