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.

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). What does not: in-memory variables, 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 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.