← All Dispatches

Backing up a self-hosted AI workspace

Self-hosting means the backup is yours. Four components hold state, and they do not need equal treatment: the database, the uploaded documents, the search index, and the secrets that make the system able to decrypt and connect to anything. The database and the documents are irreplaceable and must be backed up together. The index is derived and can be rebuilt. The secrets are small, catastrophic to lose, and belong somewhere other than the backup they would otherwise unlock.

What each component holds

The database. Users, roles, departments, positions, chat history, usage and spend records, document metadata and tags, and the audit trail. Losing it means losing the record of everything that has been asked and answered, and the structure that says who may see what.

The uploaded files. The documents themselves, on disk. Users may have originals elsewhere, or may not — anything uploaded from a laptop that has since been wiped exists only here.

The search index. Derived from the documents. It can be rebuilt by re-processing everything, which costs time and, if embeddings are involved, compute.

The secrets. Encryption keys, provider API keys, session signing keys. Small enough to fit in a paragraph and sufficient, if lost, to make an otherwise perfect backup useless.

The database and the files must be consistent with each other

This is the failure mode people discover during a restore. A database row points at a document on disk; if the two are captured at different times, you restore a database referencing files that are not there, or files nothing refers to.

The practical fix is to snapshot them as one operation, from the same moment, rather than running a database dump on one schedule and a file sync on another. Where the storage layer supports point-in-time snapshots, take them together. Where it does not, quiesce writes briefly. And on restore, reconcile: list rows whose files are missing and files no row mentions. The second is harmless clutter; the first is data loss you need to know about immediately rather than when a user reports a broken citation.

Do not back up the index; know how to rebuild it

Indexes are large, change constantly, and contain nothing that is not derivable from the documents. Backing them up doubles your storage and your backup window to protect data you already have in another form.

The thing to protect instead is the rebuild path. Confirm you can regenerate the index from the document store, and know roughly how long it takes for your corpus, because that duration is part of your recovery time. If a rebuild takes two days and nobody has ever run one, your stated recovery objective is fictional. Run it once, on a copy, and write down the number.

Secrets go somewhere else

If the encryption key is inside the backup, the backup is unencrypted in every way that matters. Anyone who obtains the archive obtains both halves.

Keep secrets in a separate store with separate access — a secret manager, or a sealed offline copy for the smallest deployments. Then verify that the restore procedure can actually retrieve them, because the common failure is not that secrets were lost but that the only person who knew where they were has left. Provider API keys are the easy case: they are stored write-only and cannot be read back anyway, so treat them as replaceable and plan to reissue them after a restore rather than trying to recover them.

Restore is the thing you are testing

A backup that has never been restored is an assumption. The test is not "did the job report success" — it is bringing the system up from the archive, on separate hardware, and using it.

A real test looks like this: restore database and files to a clean machine, rebuild the index, supply the secrets from their separate store, sign in, ask a question that requires retrieval, and check that the citation opens the right document. That exercises every component and every dependency between them. Do it at least annually, and after any change to how storage is arranged.

Retention interacts with deletion

Backups are where deletion promises go to die. If your policy says chat history is removed after ninety days, but archives are kept for five years, you retain that history for five years — and if someone exercises a right to erasure, the copies in the archive are still copies.

Decide in advance how deletion propagates. The common approaches are a backup retention window short enough that data ages out on its own, or a documented procedure for handling erasure requests against archives. Either is defensible. Having neither, and discovering the gap when the request arrives, is not.

Off the box, and encrypted

A backup on the same machine protects against deleting a file and nothing else — not disk failure, not the server being encrypted by ransomware, not the rack. Keep a copy elsewhere, encrypted, with credentials that the primary server does not hold, so an attacker who owns the application server cannot reach in and destroy the archives.

Because the document store, index, chat history and audit trail all sit on your own infrastructure in a self-hosted deployment like Nodus Veritatis, this is the same discipline you already apply to any internal system holding sensitive files. The only genuinely new element is the index, and the correct treatment of that is to leave it out and know the rebuild time.

The short list

Snapshot database and files together. Skip the index and time a rebuild. Store secrets separately and verify you can retrieve them. Keep a copy off the machine, encrypted, with independent credentials. Restore end to end once a year, all the way to a working citation. Align backup retention with your deletion policy before someone asks you to prove it.