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 appapp 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 inDATA_DIR if you turned onapp storage. What does not: in-memory variables, other files on local disk, and any runtime cache.

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 avector column and search with the <->distance operator. The same database is also available asVECTOR_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? SeeConnect a databaseand Deploy a vector database.

Suggested guides
to move to openEsc to closeFrom the Dockhold docs