Adnan Zahir 749c4cc828 feat: use Restic for encrypted incremental backups
Keep legacy restores readable while using Restic for new captures, scoped Wormhole repositories, and chunk garbage collection.
2026-11-10 10:48:05 +07:00
2026-11-10 09:53:06 +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.

TESSERA_ADMIN_TOKEN is optional. When it is unset, the hub logs that snapshot, orbit, reconstitute, and pairing routes are open to loopback clients only. When it is set, every client, including loopback, must send Authorization: Bearer <token> or X-Tessera-Admin-Token. /health, the OpenAPI document, wormhole claim, and wormhole upload stay outside that check: claim uses the pairing code, and upload uses the upload token. The canvas does not send an admin token. A Docker-published connection is not loopback inside the container, so those backup routes answer 401 there until you set a token and call them with it.

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
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. Filesystem orbits 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.

Incremental Wormhole transfers

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.

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 that uses https:// needs TESSERA_WORMHOLE_CA, TESSERA_WORMHOLE_CLIENT_CERT, and TESSERA_WORMHOLE_CLIENT_KEY.
  • 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 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 is not implemented. The canvas does not attach TESSERA_ADMIN_TOKEN.

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%