Adnan Zahir d356c313ce
Some checks failed
ci / rust (push) Has been cancelled
ci / supply-chain (push) Has been cancelled
ci / web (push) Has been cancelled
feat: restore history, undo and redo in the Activity log for everyone who may refresh
- Activity lists restores from refresh runs, so the Refresh permission is enough to see them; an administrator's
  restore jobs add the database, the person and the snapshot
- an undo is listed under the restore it reverses, and a redo under that undo; opening a restore or an undo opens
  its undo or redo dialog
- the dialog has an explicit undo mode: it describes what is put back instead of the snapshot that was open, and
  an interrupted restore offers Roll back
- a restore whose safety backup retention has forgotten shows "Safety backup expired" instead of a link, and the
  dialog says how long a safety copy is kept

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-16 20:37:21 +07:00
2026-11-10 09:53:06 +07:00
2026-11-09 09:59:42 +00:00

Tessera

Self-hosted backup vault with a space-themed canvas: orbits, snapshots, decay, and wormhole outposts.

Quick start

For a native install, put Restic 0.19.1 or newer on the hub and CLI's PATH. The Docker image includes Restic.

# Build UI then hub
cd web && npm ci && npm run build && cd ..
cargo build --release -p tessera-hub

export TESSERA_DATA_DIR=./data
export TESSERA_VAULT_PASSPHRASE='choose a long private passphrase'
./target/release/tessera-hub

The hub listens on 127.0.0.1:8787 unless TESSERA_LISTEN is set. Open http://127.0.0.1:8787. The OpenAPI document is at /api-doc/openapi.json. There is no default passphrase, and new vaults refuse the old published value dev-vault-key. Leave TESSERA_SEED_DEMO unset; TESSERA_SEED_DEMO=1 writes demo backup history into the data directory.

Authentication is required by default, including on loopback. Configure at least one of: the emergency operator (TESSERA_OPERATOR_PASSWORD_HASH), a shared API token (TESSERA_ADMIN_TOKEN, optionally with TESSERA_ADMIN_TOKEN_EXPIRES), or OIDC single sign-on. The hub refuses to start with none of them. For synthetic local development only, TESSERA_LOCAL_DEVELOPMENT=true allows anonymous loopback access. See docs/DATABASE-CAPTURE.md for operator sign-in, OIDC, per-orbit access grants, downloads, production-to-staging relations and refresh runs.

Docker Compose

export TESSERA_VAULT_PASSPHRASE='choose a long private passphrase'
docker compose up --build

Compose publishes 127.0.0.1:8787 only. The process inside the container listens on 0.0.0.0:8787 so that published port can reach it. The image includes pg_dump via postgresql-client.

CLI

cargo build --release -p tessera-cli   # the binary is named `tessera`
export TESSERA_VAULT_PASSPHRASE='choose a long private passphrase'
./target/release/tessera init
./target/release/tessera orbit nightly --path ./docs
./target/release/tessera snap
./target/release/tessera list

Deduplicated backups

New captures use Restic. Orbits select Filesystem / Folder or Database, then Via Hub or Via Outpost. Filesystem orbits executed by the hub back up files directly and share encrypted chunks in vault/restic. Each successful run creates a complete restore point. The API reports size_bytes for the logical backup, stored_bytes for new packed data and metadata, and new_data_chunks for newly stored payload chunks. An identical backup can add metadata while reporting zero new data chunks.

Restore a new filesystem or Restic outpost snapshot to a file such as restore.tar. PostgreSQL and legacy upload restores still produce the original payload bytes. Existing snapshots use their original storage and restore format. Keep the entire vault directory and its passphrase together when moving a Tessera installation.

Decay removes expired snapshots from Tessera's list. Run tessera gc periodically from the host or container with the same data directory and vault passphrase to let Restic reclaim their unreferenced chunks. Run it during a quiet period so Restic can acquire its repository locks. Legacy packs and Restic snapshots created outside Tessera's catalog require separate maintenance.

Custom retention

Choose Custom (GFS) in an orbit's retention settings. Each count selects the newest snapshot in each of the most recent occupied UTC days, ISO weeks (Monday to Sunday), months, or years. Empty periods do not use up a count. A snapshot can satisfy more than one tier. Set a tier to zero to skip it and keep at least one tier above zero. Existing presets keep their original behavior.

To set 7 daily, 2 weekly, 6 monthly, and 3 yearly snapshots from the CLI:

tessera orbit archive --path /srv/archive --keep-daily 7 --keep-weekly 2 --keep-monthly 6 --keep-yearly 3
tessera retention <orbit-id> --keep-daily 7 --keep-weekly 2 --keep-monthly 6 --keep-yearly 3

The API accepts {"retention":{"keep_daily":7,"keep_weekly":2,"keep_monthly":6,"keep_yearly":3}} as part of POST /api/v1/orbits or as the body of PUT /api/v1/orbits/{id}/retention. Omitted tiers default to zero. To switch back to a preset, send {"decay_preset":"week-of-dailies"} to the same PUT endpoint or use tessera retention <orbit-id> --preset week-of-dailies. Saving applies the policy after the next successful capture. The separate tessera decay --preset command applies its selected preset to legacy snapshots. Managed captures use their profile policy.

Managed database backups

Pair an agent and register a capture profile for PostgreSQL or MySQL. Profiles support direct connections and pinned SSH, scheduled capture, job history, downloads, and optional S3 copies. The managed path stores dumps in the hub's existing Restic repository.

Incremental Wormhole transfers for filesystem archives

The same repository setup is used by new Outpost backup profiles.

Rest Server's .htpasswd must use bcrypt entries (htpasswd -B); Apache apr1 hashes from openssl passwd -apr1 are rejected with "Invalid htpasswd entry". Restart Rest Server after changing the file (a reload signal was not enough in testing).

Run Rest Server with TLS, authentication, --append-only, and --private-repos. Point its storage at the hub's vault/outposts directory. Both processes need filesystem access to that directory. Give Rest Server access only to outposts, with a separate location for its TLS and authentication files.

  1. Pair the agent as usual. Save the outpost UUID and upload token from the pairing response. Create an orbit with tessera orbit <name> --provider wormhole. The agent's run command handles scheduling.
  2. Initialize a Restic repository at vault/outposts/<orbit-id> with a unique repository password. Create a Rest Server login named <orbit-id> with a separate HTTP password. Put a mode 0600 file named vault/keys/outpost-<orbit-id>.json on the hub with the fields outpost_id (the paired UUID) and password (that repository's password). Back up this configuration with the vault.
  3. On the agent, set TESSERA_HUB_URL, TESSERA_UPLOAD_TOKEN, TESSERA_ORBIT_ID, and TESSERA_RESTIC_REPOSITORY (for example, rest:https://backup.example.org/<orbit-id>/). Supply the repository password via RESTIC_PASSWORD_FILE or RESTIC_PASSWORD, and Rest Server credentials via RESTIC_REST_USERNAME and RESTIC_REST_PASSWORD. Run tessera-agent beam from the directory to back up. For a private Rest Server CA, set RESTIC_CACERT on the agent.

The agent reads files to detect changes, sends missing chunks and metadata through Restic, and then registers the successful snapshot with Tessera. Agents using the original Wormhole upload mode still send their full archive. The hub deduplicates that archive on disk.

If the Restic backup succeeds and registration fails, retry POST /api/v1/wormhole/restic/commit with the paired X-Tessera-Upload-Token and a JSON body containing orbit_id and the Restic snapshot_id from the error. Repeating registration for the same snapshot returns the same Tessera snapshot ID.

Access model

Browser users sign in with OIDC (or the emergency operator) and receive only the permissions an administrator granted: orbit.read, snapshot.read, capture.run, snapshot.download, globally or per orbit. Everything else is administrator-only. A person may also be allowed to refresh one staging database from its production source through a relation grant; they see no other data. Outposts authenticate with their own digest-stored tokens. Production and staging are separated by explicit, versioned relations, and an overwrite is re-authorised right before it is applied.

Architecture

See docs/SPEC.md. Rust workspace crates: tessera-core, tessera-store, tessera-providers, tessera-hub, tessera-agent, tessera-cli.

Limitations (v1)

  • New vaults derive the key with Argon2id (19 MiB, 2 iterations, parallelism 1) and record keys/kdf.json. A vault that already has a salt and no kdf.json still opens with PBKDF2-HMAC-SHA256, 100,000 iterations. New snapshot metadata is written as {id}.json.enc. Existing {id}.json files still list and restore.
  • Wormhole pairing codes and upload tokens are stored in SQLite and survive a hub restart. Chunks are written at the given offset. When the bytes cover total_bytes, the hub seals them into the vault and deletes the .part file. total_bytes is required.
  • Set TESSERA_WORMHOLE_MTLS to 1 or true to open a client-certificate listener. It also needs TESSERA_WORMHOLE_CERT, TESSERA_WORMHOLE_KEY, and TESSERA_WORMHOLE_CLIENT_CA. TESSERA_WORMHOLE_LISTEN defaults to 127.0.0.1:8788. While that listener is up, plain HTTP upload routes answer 403. An agent needs TESSERA_WORMHOLE_CLIENT_CERT and TESSERA_WORMHOLE_CLIENT_KEY for that listener. Configure TESSERA_WORMHOLE_CA when the hub certificate uses a private CA.
  • PostgreSQL captures still run a full pg_dump into a private temporary file. Restic can deduplicate matching bytes in the resulting dump. Allow temporary disk space for one full dump per concurrent capture. The Docker image contains only the hub (plus Restic and the database clients): build tessera-agent and the tessera CLI separately and install them on the hosts that need them. On non-x86 hosts build x86_64 binaries natively or in CI, not under QEMU emulation (aws-lc-sys crashes the compiler there).

The release image includes pg_dump; a native hub needs it on PATH.

  • The command provider is outside this release. Creating a command orbit and running it returns command provider is outside this release; use filesystem or postgres.
  • OIDC supports a single issuer (authorization code with PKCE). Administrators come only from configuration (TESSERA_OIDC_ADMIN_SUBJECTS / TESSERA_OIDC_ADMIN_GROUPS); there is no first-user-becomes-admin and no self-registration. Group grants are not re-checked against the IdP during a session.

License

AGPL-3.0-or-later — see LICENSE.

Description
No description provided
Readme AGPL-3.0 1.8 MiB
Languages
Rust 64.9%
TypeScript 25.9%
CSS 4.7%
JavaScript 4.1%
Shell 0.2%
Other 0.2%