Expand admin tools and harden storage operations

This commit is contained in:
admin committed 2026-11-07 10:09:32 +01:00
1 parent fbec6694df
commit 5304dfc047
86 files changed
+8111 -1102

No files matched your search

+28 -1
View File
@@ -67,7 +67,17 @@ Set `METRICS_BEARER_TOKEN` to a random value of at least 32 characters to enable
### Local admin console
The admin console is a read-only status, bucket, and performance view at `http://127.0.0.1:9001/_objectstore/admin/`. It lists buckets, navigates object prefixes, and shows object metadata and bucket access settings. The object-size chart and counts cover only the current page of a listing. The performance view samples every three seconds while visible and graphs S3 request rate, inbound and outbound body bytes, process CPU, and memory. It also shows GC collections. Admin requests and health checks are excluded from those S3 rates, and chart history lives only in the browser tab. RSS is read from Linux when available; otherwise the memory card shows JVM heap plus non-heap usage. This view does not require the separate Prometheus token. It is disabled by default and uses a separate password, not an S3 access key. Its Biscuit widgets are bundled with the image under the MIT license in `admin-ui/LICENSE.Biscuit`. To enable it for the local Compose stack:
The admin console is at `http://127.0.0.1:9001/_objectstore/admin/`. It lists buckets, navigates object prefixes and retained versions, and shows object metadata. An administrator can upload and download files, edit UTF-8 text objects up to 32 KiB in versioned buckets, create and rename buckets, delete empty buckets, edit versioning, Object Ownership, Block Public Access, bucket policies, ACL grants, and object tags, and delete objects or individual versions. Uploads create new objects by default; replacing an object requires bucket versioning so the old version remains available. Public grants and policies require typing the bucket name; version deletion requires the full key and version ID. The object-size chart and counts cover only the current page of a listing. The performance view receives one sample per second while visible and graphs S3 request rate, inbound and outbound body bytes, process CPU, memory, and GC collections. Admin requests and health checks are excluded from S3 rates; chart history lives only in the browser tab. RSS is read from Linux when available; otherwise the memory card shows JVM heap plus non-heap usage. This view does not require the separate Prometheus token. It is disabled by default and uses a separate password, not an S3 access key. Its Biscuit widgets are bundled with the image under the MIT license in `admin-ui/LICENSE.Biscuit`. To enable only the console for an existing local Compose stack:
The Health & recovery page shows readiness, disk quota use, object count, and available filesystem space in disk mode. It does not infer backup health: backup and restore status remain **Not reported** until a separate verified reporting integration exists. The Diagnostics page keeps five one-minute request windows in memory and shows bounded latency estimates and the most recent 64 errors. Error records contain status, operation, bucket name, and request ID, but no object key or credential. Its 1 MiB connection probe measures only the browser-to-admin-listener path. These in-memory diagnostics reset on restart and are per gateway in cluster mode.
Audit & access shows the last 100 admin events and S3 request counts by authenticated key. Admin events are appended and synced to `admin-audit.tsv` under `ADMIN_UI_STATE_DIR` (default `DATA_DIR`), with one 4 MiB rotated file. Include both audit files in backups; the event trail is bounded and is not a substitute for a central audit system. Key counters reset on gateway restart and do not retain secrets or object keys. The access checker uses the live key scope, identity policy, bucket policy, and ACL rules for a current object. It does not check a historical version or perform the requested S3 operation.
Bulk jobs can export a CSV inventory, copy between buckets, set one tag, or delete current objects under a prefix. One job runs at a time per gateway, with at most 10,000 objects per job. Copy uses create-only writes, so existing destination keys are reported as errors rather than overwritten. Delete follows the bucket's versioning rules; it may create delete markers. Cancellation takes effect between objects. Progress and a CSV result report are available in the console, but job history and reports are held in bounded memory and disappear on restart. Narrow the prefix before running a large or destructive job, and use the report to inspect partial failures.
The Cluster page appears in both modes; disk mode explains that no cluster is configured. In cluster mode it shows a diagram of the metadata primary and up to 64 storage nodes. Node probes run concurrently with a 2-second timeout and the result is cached for 15 seconds. Repair progress is written to the metadata database at most every 256 segments or five seconds. A running report older than five minutes is marked as possibly interrupted. Per-node verified replica counts are saved after a completed pass. Counts describe that pass, not a live replica inventory. The cluster maintenance service still performs repair separately; opening the page does not start it. Schema version 14 stores this status.
Renaming a populated bucket keeps its objects, versions, tags, ACLs, and active multipart uploads, but the old URL and presigned links stop working. In disk mode the stored data keeps a stable internal name; include `bucket-names.txt` with the data volume in backups. In cluster mode the metadata rename is one database transaction and can briefly pause requests. Move or remove console-managed scoped keys first. Update external key scopes, policies, clients, and `S3_BUCKET` if it names the renamed bucket before restarting.
```sh
mkdir -p secrets
@@ -80,10 +90,27 @@ docker compose -f compose.yaml -f compose.admin.yaml up -d --build
Read the generated password from `secrets/admin-password` on the host to sign in. The directory is private to your host account, while the file is readable by the container's unprivileged user through a read-only mount. The file is ignored by Git. The password must be at least 16 bytes. Sessions expire after 30 minutes, and five failed logins from one peer pause further attempts for five minutes. A restart clears all sessions. Do not reuse the S3 secret.
To manage additional scoped S3 keys in the console, provision a separate 256-bit master key and add the credentials overlay:
```sh
umask 077
openssl rand -hex 32 > secrets/managed-master
chmod 644 secrets/managed-master
docker compose -f compose.yaml -f compose.admin.yaml -f compose.credentials.yaml up -d --build
```
The master key is mounted read-only; the encrypted key database is stored in the `object-data` volume. Back up **both** the data volume and `secrets/managed-master`. Losing the master key makes managed S3 credentials unrecoverable. A key is scoped to one bucket and optional prefix, with separate read, write, and list permissions. Its secret appears once when created. The console can change its scope or permissions, disable it, or delete it; disabling or deleting rejects new signed requests. Existing keys configured in `.env` or credential files still need manual management. This local key manager currently supports disk mode only; the cluster requires externally managed identities, because gateways do not share this credential database.
The admin Compose overlay maps host port 9001 to a separate admin-only listener, bound to loopback by default. Admin paths return 404 on the S3 port; S3 paths return 404 on the admin port. The console accepts only loopback Host values by default, including if a port is accidentally published on a wider interface. For access through a reverse proxy, set `ADMIN_UI_ORIGIN` to the exact external HTTPS origin, preserve its Host header, and terminate TLS at the proxy.
For a private VPN interface, set `ADMIN_UI_BIND_IP` to that interface's private IPv4 address and `ADMIN_UI_PRIVATE_ORIGIN` to `http://<that-address>:9001`. The origin must use an RFC 1918 IPv4 address and an explicit port; the console then accepts only that Host value. The VPN must encrypt traffic and restrict who can reach the port. Do not publish this HTTP port on the public internet. The password is still required, and the admin listener does not accept S3 operations.
The admin display name, icon, and global default theme are shared across browsers and survive restarts in `/data/admin-branding.txt`; include that file in volume backups. Set `ADMIN_UI_BRANDING_FILE` to a persistent path when the admin process has no `/data` volume. The global default is Deep dark until changed in Settings. A personal Biscuit theme choice is stored in the browser and takes precedence; selecting "Use server default" clears that choice.
For cluster gateways with an admin console, mount a persistent directory at `ADMIN_UI_STATE_DIR` for branding, activity, and audit files. The local cluster Compose stack provides `/data`; its encrypted overlay maps that directory to the encrypted host volume. Keep this gateway state with the metadata backup.
Each bucket's Activity tab shows successful S3 reads and writes observed by this gateway over the last 365 UTC days. Counters are held in memory during requests and saved to `bucket-activity.tsv` in `ADMIN_UI_STATE_DIR` (default `DATA_DIR`) once per minute and at clean shutdown. Include that file in backups if you want to keep the chart after a restore. A sudden power loss can lose up to a minute of chart counts; object data is unaffected. Cluster gateways keep separate per-node activity files, so this is not a cluster-wide total.
For a bounded local write baseline, run `python3 scripts/benchmark-writes.py --requests 100 --concurrency 8 --size 4096` with `S3_ACCESS_KEY` and `S3_SECRET_KEY` in the environment. It writes under a unique `benchmark/` prefix and deletes successful objects afterward. Results depend on CPU, disks, network, connection reuse, and durability settings; a laptop number does not predict another server. Run a mixed upload/download workload before changing concurrency or public limits.
## Cold snapshots