From 143309ed3cd0d7a1d5526aea1bf1f2ca200c8533 Mon Sep 17 00:00:00 2001 From: virant Date: Sat, 31 Oct 2026 18:42:24 +0100 Subject: [PATCH 01/11] feat: add experimental Proxmox Backup Server plugin Bootstrap private credentials before starting PBS, retain tier-backed data, and expose its direct HTTPS interface. Pin the runtime secret-logging fixes and smoothfs durability fixes in both backend and appliance validation paths. Record live validation and the dependency release gate before shipping. --- docs/OPERATIONS.md | 6 +- docs/compose-plugins.md | 23 ++ docs/pbs-plugin.md | 204 ++++++++++++++++++ runtime/README.md | 12 +- .../0001-idempotent-bridge-masquerade.patch | 28 --- scripts/build-smoothnas-runtime.sh | 4 +- scripts/ci/smoothfs-ref | 2 +- scripts/pbs-plugin-smoke.py | 140 ++++++++++++ tierd-ui/src/pages/Plugins/PluginDetail.tsx | 7 + tierd-ui/src/pages/Plugins/Plugins.tsx | 25 ++- tierd-ui/src/utils/pluginWebUI.ts | 21 ++ tierd/go.mod | 2 +- tierd/go.sum | 2 + .../api/localplugins/pbs/compose.yaml | 152 +++++++++++++ tierd/internal/api/pbs_plugin_test.go | 138 ++++++++++++ tierd/internal/api/plugins.go | 6 + tierd/internal/plugin/compose/meta.go | 24 ++- tierd/internal/plugin/manifest.go | 29 ++- tierd/internal/plugin/pbs_lifecycle_test.go | 78 +++++++ tierd/internal/plugin/webui_test.go | 34 +++ 20 files changed, 881 insertions(+), 56 deletions(-) create mode 100644 docs/pbs-plugin.md create mode 100644 scripts/pbs-plugin-smoke.py create mode 100644 tierd-ui/src/utils/pluginWebUI.ts create mode 100644 tierd/internal/api/localplugins/pbs/compose.yaml create mode 100644 tierd/internal/api/pbs_plugin_test.go create mode 100644 tierd/internal/plugin/pbs_lifecycle_test.go create mode 100644 tierd/internal/plugin/webui_test.go diff --git a/docs/OPERATIONS.md b/docs/OPERATIONS.md index 4ddc73cb..35931875 100644 --- a/docs/OPERATIONS.md +++ b/docs/OPERATIONS.md @@ -87,11 +87,11 @@ make install-runtime # installs the daemon + smoothnas-runtime.service ``` The runtime wraps [LXC2Docker](https://github.com/games-on-whales/LXC2Docker) -(defaulting to upstream `main`; pin with `LXC2DOCKER_REF`). Build hosts need +(pinned to a tested upstream commit; override with `LXC2DOCKER_REF`). Build hosts need `golang-go`, `pkg-config`, `build-essential`, and `lxc-dev`; runtime hosts need `lxc`, `lxc-templates`, `skopeo`, `umoci`, `rsync`, `nftables`, -`iptables`, `iproute2`, and `uidmap`. SmoothNAS carries no local LXC2Docker -patches — fixes land upstream and are picked up on the next runtime build. +`iptables`, `iproute2`, and `uidmap`. Runtime fixes are pinned upstream; reviewed downstream corrections in +`runtime/patches/` are applied by the same build path used for releases. See [../runtime/README.md](../runtime/README.md) for detail. ### Kernel and OpenZFS diff --git a/docs/compose-plugins.md b/docs/compose-plugins.md index 26a6e05f..d6f0279c 100644 --- a/docs/compose-plugins.md +++ b/docs/compose-plugins.md @@ -93,3 +93,26 @@ services: SmoothNAS-specific concerns compose doesn't: tiered-volume bind resolution + pin, the cross-project host-port guard, and treating `docker compose ps` as the source of truth for state (cached, with a periodic reconcile sweep). + +## Direct web interfaces + +For an application that needs its own HTTPS origin, declare a direct link +instead of `x-smoothnas.ui` (the iframe/proxy target): + +```yaml +x-smoothnas: + webUI: + scheme: https + port: 8007 + path: / +services: + server: + image: example/server:1.0 + ports: ["8007:8007"] +``` + +`webUI.port` must match a fixed published TCP port; `scheme` is `http` or +`https`, and `path` is an absolute path. The Open action uses the hostname of +the current appliance page and opens a new tab. It does not route through +SmoothNAS nginx or inject authentication. The application owns its certificate +and login. See [the PBS plugin guide](pbs-plugin.md) for a complete example. diff --git a/docs/pbs-plugin.md b/docs/pbs-plugin.md new file mode 100644 index 00000000..716972e1 --- /dev/null +++ b/docs/pbs-plugin.md @@ -0,0 +1,204 @@ +# Proxmox Backup Server plugin + +The in-tree **pbs** plugin runs Proxmox Backup Server on SmoothNAS so Proxmox +VE can send VM and container backups to the NAS. It is experimental until the +appliance checks below have passed on the storage configuration in use. +Sending SmoothNAS files to an external PBS is a separate integration. + +## Delivery status + +This is a development branch, not a released appliance feature. The live +results below cover the explicitly listed test baseline. Before shipping: + +- Merge and release the smoothfs directory-sync and inode-reuse fixes from + `fix/pbs-storage-durability`. This branch ports the validated fixes onto + smoothfs 0.3.4; its head is `c1392ccd1bde24dc89d5166d5d9b403497ca3dda`. +- Publish the corresponding `smoothfs-dkms` and `smoothfs-samba-vfs` packages. + `scripts/ci/smoothfs-ref` requires that fixed ref; the existing minimum-version + check deliberately refuses an appliance build until a release contains it. +- Build the pinned runtime with the retained downstream bridge patch. The pin + includes the credential-logging fixes from `fix/container-request-secrets`. +- Validate the resulting appliance package on a fresh guest, including loading + its packaged module and repeating backup, restore, movement and reboot checks. + +The Go module pin alone does not update a running appliance's kernel module. +The plugin refuses a datastore whose module lacks directory-sync support. +Keep the plugin experimental pending sustained-load and retention testing. + +## Install and connect + +1. Open **Plugins → Install**, select **pbs**, and choose the storage tiers for + configuration, state, logs and datastore. Supply an initial administrator + password of at least 12 characters without line breaks, materialise, then start. +2. Click **Open**. PBS opens directly at `https://:8007/` in a new + tab. Accept its self-signed certificate after checking its fingerprint, or + configure a trusted certificate in PBS. The appliance address must be + reachable directly from both your browser and the Proxmox VE nodes. +3. Log in as `admin@pbs` (user `admin`, realm **Proxmox Backup authentication + server**). Add a directory datastore, for example `backups`, with backing + path **`/datastore`**. No host disks need to be exposed to PBS. +4. Configure PBS prune, verification and garbage-collection schedules. PBS owns + these jobs; SmoothNAS owns the container lifecycle and storage placement. +5. Create a dedicated PBS user and API token for Proxmox VE. Give both the user + and its privilege-separated token `DatastoreBackup` on + `/datastore/backups` (or the chosen namespace). Use a separate identity with + the necessary read privileges for restore operations. +6. In Proxmox VE, open **Datacenter → Storage → Add → Proxmox Backup Server**. + Enter the NAS hostname, datastore `backups`, token identity + `user@pbs!token-name`, token secret, and PBS certificate fingerprint. Run a + small VM/container backup and restore it to a new guest before scheduling + production backups. + +The image is the unofficial +[ayufan PBS container](https://github.com/ayufan/pve-backup-server-dockerfiles), +pinned to `v4.2.0-1`. This is not an officially supported Proxmox deployment. +Its public default password is never installed: the plugin bootstraps its own +configuration and salted SHA-512 password hash before starting any PBS daemon. +The container's `backup` account uses UID/GID 1000 to match smoothfs ownership, +while keeping PBS's private directory permissions. Startup also checks datastore +directory `fsync` and refuses filesystems that cannot provide it. +The initial password is a SmoothNAS secret; subsequent password changes belong +in PBS. Restart and reinstall do not reset existing credentials. Configuration +from unrelated PBS installations is refused rather than overwritten. + +The initial memory limit is 4 GiB. Increase it for larger stores; upstream +recommends an additional GiB per TiB. Fast local storage is preferred for PBS's +chunk/index workload. The plugin requests no privileged mode, host network, +raw disk devices, or SMART capabilities. SmoothNAS manages the disks. PBS tape, +in-container disk formatting, ZFS administration, and PAM/shell access are +outside this plugin's scope. + +## Data retention and recovery + +All four volumes are tier-backed binds. **Uninstall preserves them.** Compose +teardown removes containers and project files; these binds are not native +manifest volume rows subject to the installer's recursive deletion. + +Paths are `/.plugins/pbs/compose/{config,state,logs,datastore}`. +Record each volume's tier before uninstall. Reinstall **pbs** with the same +assignments to reuse those paths; its administrator credentials, certificates, +datastore configuration and backup contents remain intact. A different tier +selects a different directory and does not migrate the old data. Reinstalling +also requires reentering any SmoothNAS configuration settings because its +database records and initial secret were removed. + +Keep configuration and datastore together in a recovery plan. A datastore +recovered without its configuration can be attached to a fresh PBS installation +using PBS's **Reuse existing datastore** option. Keep client-side encryption +keys independently; the server cannot recreate them. Avoid simultaneous PBS +instances writing the same datastore. A second PBS on another machine can +provide an independent copy through PBS sync jobs. + +## Appliance validation + +Use a disposable datastore for these checks. Unit tests exercise bootstrap, +catalog metadata, secret storage and lifecycle routing. Live results from a +fresh VM on the `.252` Proxmox test host are recorded below; other storage and +hardware configurations still need validation. + +On the appliance, first check that the plugin starts with `/run` on tmpfs and +that an empty/short initial password prevents startup. Check that the upstream +default password fails and the chosen password authenticates. Restart PBS and +confirm that certificates, credentials and datastore configuration persist. + +Probe the actual datastore mount from the host (substitute its real tier path): + +```sh +python3 scripts/pbs-plugin-smoke.py \ + --filesystem /mnt/media/.plugins/pbs/compose/datastore +``` + +The probe creates and removes its own temporary directory, checking explicit +timestamp updates, locking, rename and file/directory `fsync`. PBS updates chunk +access times explicitly; `noatime` alone does not establish incompatibility. +Both timestamp updates and timestamp preservation during tier movement still +need to pass real backup/GC/restore checks. + +On a Linux client with the official `proxmox-backup-client`, use credentials +with backup, read and prune privileges in the validation datastore. Set +`PBS_REPOSITORY`, `PBS_FINGERPRINT` and `PBS_PASSWORD_FILE` without putting +the secret in command history. The script creates a unique backup group, +uploads two versions, restores and compares hashes/permissions/symlinks, +prunes only that group, then restores again: + +```sh +export PBS_REPOSITORY='validation@pbs!test@nas.example:validation' +export PBS_FINGERPRINT='' +export PBS_PASSWORD_FILE='/secure/path/pbs-token' +python3 scripts/pbs-plugin-smoke.py --workdir /tmp/pbs-validation-01 +``` + +Run **Verify** with previously verified snapshots included, then **Start GC** +in PBS and wait for both tasks to succeed. Rerun: + +```sh +python3 scripts/pbs-plugin-smoke.py --workdir /tmp/pbs-validation-01 --restore-only +``` + +Repeat after smoothfs tier movement and after uninstall/reinstall with the +same tiers. Also test daemon/host restart, concurrent backups, a full datastore, +and loss of a backing tier. GC has a roughly 24-hour grace period: an immediate +GC/restore pass does not prove eventual reclamation. Run it again after that +period and confirm referenced chunks remain readable and unreferenced chunks +are reclaimed. Do not change the appliance clock to force this test. + +References: [PBS installation](https://pbs.proxmox.com/docs/installation.html), +[datastore requirements](https://pbs.proxmox.com/docs/storage.html), +[maintenance and GC](https://pbs.proxmox.com/docs/maintenance.html), +[Proxmox VE integration](https://pbs.proxmox.com/docs/pve-integration.html). + + +## Live validation — 31 October 2026 + +The run used a fresh Debian 13 VM on `pvetest` (`192.168.1.252`, PVE 9.2.6), +Linux `7.2.11+deb13-cloud-amd64`, LXC2Docker, two separate XFS-backed smoothfs +mounts, and the pinned PBS `v4.2.0-1` image. Native PVE backup/restore used the +host's Proxmox Backup Client 4.2.3. Both backing disks share the host's physical +storage; this run tests behavior, not independent disk-failure protection. + +The initial run found two smoothfs blockers: directory `fsync` returned +`EINVAL`, and reuse of an old backing inode after tier movement redirected +unrelated writes into a moved chunk. The latter was reproduced in a small +regression test before fixing cache invalidation/validation and persisting the +destination object identity. The original failing fixture was discarded, and +the backup/restore tests were repeated with fresh data on the fixed module. + +The successful live run used these dependency refs: + +| Component | Tested ref | Required fixes | +|---|---|---| +| smoothfs | `v0.2.28-0.20261031160744-d0edccd6ea2c` | Directory sync, safe inode reuse after movement, persistent destination identity. | +| LXC2Docker | `ff6d6d8f9f6f62ea4b2fe7592e88a10ed20569bb` | Stop logging full create requests and failure configurations containing credentials. | + +The delivery branch now pins the forward-ported smoothfs fixes at +`v0.3.5-0.20261031173954-c1392ccd1bde` in both the Go module and protocol gate. +That rebased ref has not repeated the full live matrix recorded here. + +Deploy the updated runtime **and rebuild/load the updated smoothfs module** +with the plugin. Reboot an existing appliance to load its rebuilt module; +installing a new backend binary alone does not replace a loaded kernel module. +The startup sync check rejects the older module without directory-sync support. + +Completed checks on the fixed module: + +| Check | Result | +|---|---| +| Authentication | Chosen password accepted; public image default rejected. Current administrator and token secrets absent from runtime journal. | +| File backups | Two versions backed up; restored hashes, modes and symlinks matched before and after pruning. | +| Tier movement | Every referenced chunk of the retained file archive moved to the other tier using the production movement worker. Restore and PBS verification passed after 2,048 unrelated create/write/unlink cycles. | +| Garbage collection | Only disposable test chunks were artificially aged, without changing the system clock. GC removed two unreferenced chunks (2.001 MiB), retained 142 live chunks, and restore/verification passed. | +| Proxmox containers | `vzdump` to PBS and `pct restore` of a fresh 515.6 MiB unprivileged CT passed; sentinel bytes, mode and mapped ownership matched. | +| Proxmox VMs | `vzdump` to PBS and `qmrestore` of a fresh stopped VM with a 1 GiB disk passed; a random disk payload matched byte-for-byte. | +| Uninstall/reinstall | Checked configuration and live chunks retained byte-for-byte; the original password, certificate, token and backup remained usable. A different initial password supplied on reinstall did not reset the existing password. | +| Application restart | Restart with the image's `SIGHUP` stop signal passed. | +| VM reboot | The rebuilt module and two-tier pool mounted, PBS restarted automatically, the same certificate and credentials worked, and restore plus verification of all three backup groups passed. | +| Kernel regressions | Directory sync, actual source-inode reuse, open-file cutover, concurrent getattr/cutover and nested movement passed. | + +Cleanup was verified: all five temporary guests, their disks, temporary PBS +storage entries, credentials, leases, snippets and host scratch files were +removed. The host's existing guests were left running. + +The plugin remains experimental. This run does not cover full-datastore or +backing-disk loss, abrupt power failure, sustained load, or every lower +filesystem. The immediate GC test exercises the age cutoff with disposable +chunk timestamps; it does not replace a multi-day retention soak. diff --git a/runtime/README.md b/runtime/README.md index 25afc3ac..f2764a60 100644 --- a/runtime/README.md +++ b/runtime/README.md @@ -19,19 +19,19 @@ The build target writes `bin/docker-lxc-daemon`. Appliance installs place it at `/usr/lib/smoothnas/docker-lxc-daemon` and install `runtime/smoothnas-runtime.service`. -The upstream source is pinned to the reviewed LXC2Docker commit: +The upstream source is pinned to the tested LXC2Docker commit that removes +container request and failure-config logging of credentials: ```text https://github.com/games-on-whales/LXC2Docker.git -7171568494541a1c9a776670a1623f3db64d7e46 +ff6d6d8f9f6f62ea4b2fe7592e88a10ed20569bb ``` Set `LXC2DOCKER_REF=` to evaluate a newer revision. Downstream corrections are applied by the same build path used for releases. - SmoothNAS carries runtime corrections in `runtime/patches/`. The build script applies them after checking out LXC2Docker; a patch that no longer applies fails -the build. The bridge correction replaces only the owned postrouting chain in -one nft transaction, preserving published port DNAT rules and removing old -duplicate masquerade rules. Bridge and port-forward mutations share `nftMu`. +the build. The pinned upstream already bounds masquerade rules in one nft transaction. +The bridge correction serializes bridge and port-forward mutations with +`nftMu` and checks that published port DNAT rules survive repeated reconciliation. diff --git a/runtime/patches/0001-idempotent-bridge-masquerade.patch b/runtime/patches/0001-idempotent-bridge-masquerade.patch index 2bd3d74d..584c740b 100644 --- a/runtime/patches/0001-idempotent-bridge-masquerade.patch +++ b/runtime/patches/0001-idempotent-bridge-masquerade.patch @@ -9,34 +9,6 @@ iface, err := net.InterfaceByName(BridgeName) if err != nil || iface == nil { // Bridge doesn't exist — create it and assign the gateway IP. -@@ -69,18 +71,16 @@ - } - } - -- // Ensure the nftables table exists with the masquerade rule. -- // Using "nft -f" with a table block is idempotent — it merges into any -- // existing table rather than replacing it. -+ // Reconcile only our postrouting chain in one atomic transaction. -+ // A table block appends rules on every call; flush removes old duplicates -+ // while retaining prerouting/output DNAT rules used by published ports. - nftRule := fmt.Sprintf(` --table ip %s { -- chain postrouting { -- type nat hook postrouting priority srcnat; policy accept; -- ip saddr 10.100.0.0/24 oifname != "%s" masquerade -- ct status dnat masquerade -- } --} --`, NATTableName, BridgeName) -+add table ip %s -+add chain ip %s postrouting { type nat hook postrouting priority srcnat; policy accept; } -+flush chain ip %s postrouting -+add rule ip %s postrouting ip saddr 10.100.0.0/24 oifname != "%s" masquerade -+add rule ip %s postrouting ct status dnat masquerade -+`, NATTableName, NATTableName, NATTableName, NATTableName, BridgeName, NATTableName) - cmd := exec.Command("nft", "-f", "-") - cmd.Stdin = strings.NewReader(nftRule) - if out, err := cmd.CombinedOutput(); err != nil { --- /dev/null +++ b/internal/lxc/network_nat_integration_test.go @@ -0,0 +1,51 @@ diff --git a/scripts/build-smoothnas-runtime.sh b/scripts/build-smoothnas-runtime.sh index 427462b7..f9adf4d0 100755 --- a/scripts/build-smoothnas-runtime.sh +++ b/scripts/build-smoothnas-runtime.sh @@ -1,12 +1,12 @@ #!/usr/bin/env bash -# Build the SmoothNAS plugin runtime daemon from a reviewed upstream commit. +# Build the SmoothNAS plugin runtime daemon from a tested upstream LXC2Docker commit. set -euo pipefail SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" PROJECT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)" LXC2DOCKER_REPO="${LXC2DOCKER_REPO:-https://github.com/games-on-whales/LXC2Docker.git}" -LXC2DOCKER_REF="${LXC2DOCKER_REF:-7171568494541a1c9a776670a1623f3db64d7e46}" +LXC2DOCKER_REF="${LXC2DOCKER_REF:-ff6d6d8f9f6f62ea4b2fe7592e88a10ed20569bb}" BUILD_DIR="${PROJECT_DIR}/runtime/build/LXC2Docker" OUT="${PROJECT_DIR}/bin/docker-lxc-daemon" diff --git a/scripts/ci/smoothfs-ref b/scripts/ci/smoothfs-ref index 82dfc31b..2558944d 100644 --- a/scripts/ci/smoothfs-ref +++ b/scripts/ci/smoothfs-ref @@ -1 +1 @@ -13b4491ba43bca6f6b67f35add7026083505d228 +c1392ccd1bde24dc89d5166d5d9b403497ca3dda diff --git a/scripts/pbs-plugin-smoke.py b/scripts/pbs-plugin-smoke.py new file mode 100644 index 00000000..2d42e997 --- /dev/null +++ b/scripts/pbs-plugin-smoke.py @@ -0,0 +1,140 @@ +#!/usr/bin/env python3 +"""Validate a PBS plugin datastore and exercise a disposable backup group. + +Credentials use the normal PBS_* environment variables. Run --restore-only +again after PBS verification/GC, tier movement, or plugin reinstall. +""" + +import argparse +import datetime +import fcntl +import hashlib +import json +import os +from pathlib import Path +import subprocess +import tempfile +import time +import uuid + + +def filesystem_probe(path): + # Use a new sibling directory, never modify actual PBS chunks or indexes. + with tempfile.TemporaryDirectory(prefix=".smoothnas-pbs-probe-", dir=path) as tmp: + root = Path(tmp) + source = root / "chunk.tmp" + with source.open("wb") as handle: + handle.write(b"PBS filesystem probe\n") + handle.flush() + os.fsync(handle.fileno()) + chunk = root / "chunk" + source.rename(chunk) + old = time.time_ns() - 3 * 24 * 3600 * 10**9 + os.utime(chunk, ns=(old, old)) + current = time.time_ns() + os.utime(chunk, ns=(current, old)) + st = chunk.stat() + if abs(st.st_atime_ns - current) > 10**9 or abs(st.st_mtime_ns - old) > 10**9: + raise RuntimeError("Explicit chunk atime update did not preserve mtime") + with chunk.open("rb") as first, chunk.open("rb") as second: + fcntl.flock(first, fcntl.LOCK_EX | fcntl.LOCK_NB) + try: + fcntl.flock(second, fcntl.LOCK_EX | fcntl.LOCK_NB) + except BlockingIOError: + pass + else: + raise RuntimeError("Conflicting datastore locks were both granted") + fd = os.open(root, os.O_RDONLY | os.O_DIRECTORY) + try: + os.fsync(fd) + finally: + os.close(fd) + print("Filesystem probe passed: timestamp updates, locking, rename and fsync") + + +def client(args, *command): + cmd = [args.client, *command] + if args.namespace: + cmd += ["--ns", args.namespace] + subprocess.run(cmd, check=True) + + +def contents(root): + result = {} + for path in sorted(root.rglob("*")): + name = str(path.relative_to(root)) + if path.is_symlink(): + result[name] = {"link": os.readlink(path)} + elif path.is_file(): + result[name] = { + "sha256": hashlib.sha256(path.read_bytes()).hexdigest(), + "mode": path.stat().st_mode & 0o777, + } + return result + + +def restore(args, record): + # Keep the source/evidence between invocations; restored trees are disposable. + with tempfile.TemporaryDirectory(prefix="restore-", dir=args.workdir) as tmp: + target = Path(tmp) / "files" + client(args, "restore", record["snapshot"], "data.pxar", str(target)) + if contents(target) != record["contents"]: + raise RuntimeError("Restored hashes, symlinks or permissions differ") + print("Restore passed: hashes, symlinks and permissions match") + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--filesystem", type=Path, help="Probe a mounted datastore path locally") + parser.add_argument("--workdir", type=Path, help="New evidence directory for network backup/restore") + parser.add_argument("--restore-only", action="store_true", help="Restore an existing workdir after maintenance/reinstall") + parser.add_argument("--client", default="proxmox-backup-client") + parser.add_argument("--namespace", default="") + args = parser.parse_args() + if not args.filesystem and not args.workdir: + parser.error("provide --filesystem and/or --workdir") + if args.filesystem: + filesystem_probe(args.filesystem) + if not args.workdir: + return + if not os.environ.get("PBS_REPOSITORY"): + parser.error("set PBS_REPOSITORY and PBS credentials in the environment") + evidence = args.workdir / "validation.json" + if args.restore_only: + record = json.loads(evidence.read_text()) + if record["repository"] != os.environ["PBS_REPOSITORY"] or record["namespace"] != args.namespace: + parser.error("repository and namespace must match the saved evidence") + restore(args, record) + return + args.workdir.mkdir(mode=0o700, parents=True, exist_ok=False) + source = args.workdir / "source" + source.mkdir() + (source / "payload").write_bytes(os.urandom(2 * 1024 * 1024)) + (source / "note").write_text("first version\n") + (source / "note").chmod(0o640) + (source / "link").symlink_to("note") + group = "host/smoothnas-validation-" + uuid.uuid4().hex + snapshots = [] + for version in (1, 2): + stamp = int(time.time()) + (source / "note").write_text(f"version {version}\n") + client(args, "backup", f"data.pxar:{source.resolve()}", "--backup-id", group.split("/")[1], + "--backup-type", "host", "--backup-time", str(stamp), "--crypt-mode", "none") + iso = datetime.datetime.fromtimestamp(stamp, datetime.timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ") + snapshots.append(f"{group}/{iso}") + if version == 1: + time.sleep(1.1) + record = {"snapshot": snapshots[-1], "contents": contents(source), + "repository": os.environ["PBS_REPOSITORY"], "namespace": args.namespace} + evidence.write_text(json.dumps(record, indent=2) + "\n") + restore(args, record) + # Retention applies ONLY to this new UUID group, never existing backups. + client(args, "prune", group, "--keep-last", "1", "--dry-run", "false") + restore(args, record) + print(f"Backup/prune/restore passed for {group}") + print("Run PBS verification and garbage collection, then rerun with --restore-only.") + print("Repeat the restore after tier movement and uninstall/reinstall on the same tiers.") + + +if __name__ == "__main__": + main() diff --git a/tierd-ui/src/pages/Plugins/PluginDetail.tsx b/tierd-ui/src/pages/Plugins/PluginDetail.tsx index 44339511..f5dd6e85 100644 --- a/tierd-ui/src/pages/Plugins/PluginDetail.tsx +++ b/tierd-ui/src/pages/Plugins/PluginDetail.tsx @@ -5,6 +5,7 @@ import { api } from '../../api/api'; import { extractError } from '../../utils/errors'; import Spinner from '../../components/Spinner/Spinner'; import ConfirmDialog from '../../components/ConfirmDialog/ConfirmDialog'; +import { pluginWebURL } from '../../utils/pluginWebUI'; // Detail mirrors the JSON shape POST /api/plugins/ returns. // Loose typing — the backend's PluginRecord adds fields over time; @@ -150,6 +151,7 @@ export default function PluginDetail() { ); } + const webURL = detail.plugin.state === 'running' ? pluginWebURL(detail.plugin.webUI) : null; return (
@@ -166,6 +168,11 @@ export default function PluginDetail() {
+ {webURL && ( + + {t('plugins.action.open')} + + )} {t('plugins.detail.backToList')} diff --git a/tierd-ui/src/pages/Plugins/Plugins.tsx b/tierd-ui/src/pages/Plugins/Plugins.tsx index 72aa9c14..1d593c9d 100644 --- a/tierd-ui/src/pages/Plugins/Plugins.tsx +++ b/tierd-ui/src/pages/Plugins/Plugins.tsx @@ -6,11 +6,13 @@ import { extractError } from '../../utils/errors'; import Spinner from '../../components/Spinner/Spinner'; import ConfirmDialog from '../../components/ConfirmDialog/ConfirmDialog'; import { pluginCatalogRepositories } from '../../data/pluginCatalog'; +import { pluginWebURL, type PluginWebUI } from '../../utils/pluginWebUI'; // PluginRow mirrors the JSON shape the phase-06a backend returns // from GET /api/plugins under the "plugins" key. Kept loose because // the detail page reads more fields than this list view needs. type PluginRow = { + webUI?: PluginWebUI; name: string; version: string; state: string; @@ -249,6 +251,7 @@ function PluginCard({ }) { const { t } = useI18n(); const isRunning = plugin.state === 'running'; + const webURL = pluginWebURL(plugin.webUI); const isStopped = plugin.state === 'stopped' || plugin.state === 'installed' || plugin.state === 'failed'; const needsMaterialise = plugin.state === 'installed'; const containerRefs = plugin.containerRefs ?? []; @@ -407,14 +410,20 @@ function PluginCard({ > {t('plugins.action.configure')} - + {webURL && isRunning ? ( + + {t('plugins.action.open')} + + ) : ( + + )} + {showForm && (

{editingId != null ? t('backups.form.editTitle') : t('backups.form.newTitle')}

@@ -295,13 +354,14 @@ export default function Backups() { setField('name', e.target.value)} />
)} -
+ {form.method !== 'rclone' &&
@@ -366,7 +426,7 @@ export default function Backups() { onChange={e => setField('share', e.target.value)} /> -
+
} {form.method === 'rsync' && form.use_ssh && (
@@ -434,15 +494,45 @@ export default function Backups() { /> )} -
+ {form.method === 'rclone' && <> +
+ +