Backing up a self-hosted AI platform.
Containers are disposable. The data underneath them is not. Here is what to protect and how to know your backups work.
Start with what is actually irreplaceable
When an AI platform runs in containers, it is tempting to treat the whole thing as rebuildable. The images can be pulled again and the configuration is usually in a compose file. What cannot be pulled again is state: the database with user accounts, conversation history and permissions, any uploaded files, and the secrets that tie it together.
Before choosing tools, write the list down. For a typical deployment it is the application database, the upload or file storage directory, the configuration and environment files (including the keys used to sign sessions or encrypt stored values), and any search or vector index. The index is the one item you can often rebuild from the source documents, but rebuilding a large index can take hours, so many teams back it up anyway.
Consistent copies of a live database
Copying a database file while the application is writing to it can produce a backup that looks fine and fails to open. Use the database's own mechanism instead: a dump command for server databases, or the online backup facility for embedded databases such as SQLite. If the database runs in write-ahead-log mode, the main file and its log files must be captured together or through the official backup call.
For file storage, a snapshot of the volume or a tool that copies incrementally is usually enough, as long as the application is not halfway through writing a large upload when the copy runs.
Keep copies in more than one place
A backup on the same disk as the data protects against a deleted record, not against a failed disk, a ransomware infection or a mistake in the hypervisor. The long-standing rule of thumb is three copies, on two kinds of storage, with one copy off-site. For a small deployment that can be as simple as a nightly copy to a second machine plus an encrypted upload to remote object storage.
Encrypt anything that leaves your network. Conversation history is exactly the sort of data people did not want leaving their infrastructure when they chose to self-host, so an unencrypted off-site copy would undo that decision. Store the encryption key somewhere separate from the backups themselves.
Test the restore, not just the backup
The common failure is not a missing backup but one that cannot be restored: a dump that is truncated, a key that was never saved, or a procedure nobody has ever followed. Schedule a restore into a scratch environment, log in, open an old conversation and confirm uploaded files open. Do it after any major upgrade, because schema changes can make older dumps behave differently.
Also write down the order of operations. Restoring the database before the application starts, and the secrets before either, saves time when something is already broken.
Retention and the cost of keeping everything
Decide how long copies are kept and apply the same rule everywhere. A common pattern is daily copies for a couple of weeks, weekly copies for a couple of months and a monthly copy for a year, adjusted to your legal and business needs. If you handle personal data, remember that deletion requests also apply to backups, so your retention window and your privacy policy should agree with each other.