Databases & storage

Your app's disk is temporary. Keep anything that needs to last in the managed database.

Your filesystem resets

Apps on Dockhold are stateless. The filesystem your app writes to is temporary and is wiped whenever the app restarts or redeploys. That is what lets your app restart itself, scale up, and update with no downtime.

So don't save anything you want to keep on local disk. Uploaded files, a SQLite file, session data written to /tmp: all of it disappears on the next restart. Use the managed database instead.

One exception, and it is opt-in: you can give an app app storage, a single folder that survives restarts and deploys. It's the answer for a SQLite file or a tool that insists on its own data directory. For everything else the managed database below is the better tool.

The managed database

Turn on the managed database add-on for your app and Dockhold provisions a private database in your app's isolated environment, then injects a connection string as DATABASE_URL. Read it, don't define it, and don't run your own database.

import os
import psycopg2

# Injected by Dockhold. Never hardcode it.
conn = psycopg2.connect(os.getenv("DATABASE_URL"))

What survives a restart: anything in the database (user data, chat history, embeddings, app state), plus the one folder in DATA_DIR if you turned on app storage. What does not: in-memory variables, other files on local disk, and any runtime cache.

Backups

On paid accounts (any account that has bought at least one unit of compute), the managed database is backed up every night, and we keep the newest 7 copies. Each copy is encrypted with a key that belongs to your app and is stored in a separate location in Germany, away from the servers that run it. A copy is locked for 7 days after it is made, so nobody can delete or change it in that time, us included. Backups are included in the paid price.

To get a copy back, write to [email protected] with the app and the date. We restore it into a second database next to your live one, on the same server, reachable with the same user and password. Your live database is not touched. Copy what you need, or ask us to swap it in.

Free accounts have no backups. Upgrading to any paid size turns them on from the next night. Deleting an app, or removing its database, deletes its backups too, and they are gone within 10 days. App storage is not backed up yet, see app storage.

Vector search is built in

The managed database ships with vector search enabled, which is handy for semantic search, recommendations, and AI memory. Store embeddings in a vector column and search with the <-> distance operator. The same database is also available as VECTOR_STORE_URL if you prefer that name in your code.

CREATE TABLE items (
  id        bigserial PRIMARY KEY,
  content   text,
  embedding vector(1536)
);

-- Nearest matches to a query embedding
SELECT content FROM items ORDER BY embedding <-> $1 LIMIT 5;

Want a worked example? See Connect a database and Deploy a vector database.

Suggested guides
↑↓ to move ↵ to open Esc to close From the Dockhold docs