Persisting and backing up self-hosted promptfoo data

Self-hosted promptfoo keeps its data in a local SQLite database, so evals survive container restarts only when the config directory sits on a persistent volume. This page covers where that data lives, how to set PROMPTFOO_CONFIG_DIR, and how to plan backups of the database and blobs directory.

On this page

Why self-hosted promptfoo data persistence decides what survives a restart

Whether eval history survives a restart depends on one thing: a persistent volume must hold the configuration directory where the self-hosted promptfoo server writes promptfoo.db. Backups are a separate planning task, and a volume that survives a container restart is not a copy you can restore from after a bad upgrade, a deleted volume or a failed disk. Teams need this work as soon as any shared eval history matters to them, such as baseline runs used for regression decisions or red team results someone may need to show later. The server keeps that data in a local SQLite database. That database cannot be shared across replicas, and the self-hosted setup is not recommended for production use, so the persistence design should be settled before the team relies on the history.

The server's internal configuration directory holds configuration files and promptfoo.db. Setting PROMPTFOO_CONFIG_DIR overrides that location, so you can point the server at a path you choose. A custom path still needs a persistent volume mounted behind it. The variable changes where the files go, not whether they survive a container being replaced. Decide the path before the first run, and confirm in your own environment that the mount target matches the value of PROMPTFOO_CONFIG_DIR in your version. Check the promptfoo self-hosting documentation for the current default path before you write the volume configuration.

The work covers persistence design and backup planning: which paths hold state, which volumes and mount points keep them, how often a copy is taken, where it is stored and how a restore would be tested. It does not guarantee recovery. A backup that has never been restored into a clean container is an assumption, not evidence. Confirm which files your release writes besides promptfoo.db, including any media or blob storage, because the path list depends on the version you run. Ask any provider to state in writing which paths and volumes are in scope, who runs restore tests and how the single SQLite file is handled during an upgrade.

One writer owns the data, and backups must read it safely

The diagram starts at the promptfoo container, where the Express server serves the web UI and API. Writes go to the directory set by PROMPTFOO_CONFIG_DIR, and that path is mounted from a host or cluster volume, so promptfoo.db and the media or blobs directory persist outside the container. The boundary between the container and the volume marks where the data leaves the process. The container is a single replica and the only writer, which is why replicas cannot share the database. The backup job reads both the database and the blobs, either while the server is stopped or through a SQLite-safe copy method. Confirm the blobs path in your promptfoo version before you write backup scripts.

One container writes the database and blobs, and a backup job copies them.

Which storage layout fits your team's data and operations

This table compares four ways to store the self-hosted promptfoo SQLite database and blobs directory: a Docker named volume, a host bind mount, a custom PROMPTFOO_CONFIG_DIR on a mounted volume, and a Kubernetes persistent volume claim. Read each row for what the layout suits, who can reach the files and how the copy is taken. Every layout keeps data on one instance, so test a restore before your team relies on the server for evals.

LayoutGood forHost access and backupConfirm before relying on it
Docker named volumeOne Docker host running promptfoo with a simple run command or Compose file, with Docker managing the storage location.Host administrators with root access can reach the files on the Docker host. Back up by copying the volume through a temporary container.Confirm which container path holds promptfoo.db and the blobs directory in your image version, and that a copy restores on another host.
Host bind mountTeams that want the data in a known host directory covered by their existing host-level backup tooling.Anyone with access to that directory can open the SQLite file. Back up with a host-level file copy.Confirm directory ownership and permissions let the container user write, and whether copies must wait until the container is stopped to avoid a partial SQLite file.
Custom PROMPTFOO_CONFIG_DIR on a mounted volumeTeams that want configuration files and promptfoo.db in a path they choose, set through the PROMPTFOO_CONFIG_DIR variable.Access follows the underlying mount, whether a named volume or bind mount, so apply that mount's rules. Back up the mounted volume the same way.Confirm the variable points inside the container to a path on a persistent volume, because setting the variable alone does not persist data.
Kubernetes persistent volume claim via Helm chartClusters where the platform team already manages StorageClasses, snapshots and cluster-level backups.Access is controlled by Kubernetes RBAC and the pod spec, not host login. Back up with volume snapshots or a cluster backup tool, depending on the StorageClass.Confirm the chart's current status, since it is experimental, that your StorageClass supports the snapshots you plan to use, and that the release runs one replica.

Why PROMPTFOO_CONFIG_DIR still needs a persistent volume

Setting PROMPTFOO_CONFIG_DIR changes where the self-hosted promptfoo server looks for its configuration files and promptfoo.db inside the container. It does not make that path persistent. The variable only moves the location, so the server keeps writing to the container's writable layer unless you attach a volume at that same path. Treat the variable and the volume as one setting that you change together. The variable alone does not keep data. Teams often miss this on a first deployment because the server starts normally and the web UI works, so the gap only shows up when the container is replaced.

The common mistake looks like this (illustrative): a team sets PROMPTFOO_CONFIG_DIR to a custom path such as /opt/promptfoo-data to match an internal standard, then reuses an older run command or compose file that has no mount for that path. Evals run, results appear in the UI, and everything looks correct. The next image upgrade, host rebuild or container recreation then starts a new container with an empty path, and promptfoo.db and any stored media are gone. The failure surfaces only when someone looks for an eval from last week. After the first start, check the mount list with docker inspect and confirm that the config path appears as a volume or bind mount, not as container-only storage.

Pick one directory, mount it explicitly, and write it into the runbook. The same path should appear in the environment variable, the volume mapping, the backup job and the restore procedure, so an upgrade or restore points at the same place without anyone reconstructing it from memory. Before you write the mapping, confirm the exact default path and the location of the media or blobs directory for the version you pin, using the promptfoo self-hosting documentation. Do not copy these locations from older notes or from another version. Record the pinned version, the variable value and the mount target together in the runbook entry, and re-check them whenever you change the version.

How to set up a persistent promptfoo data directory

Follow this sequence to run self-hosted promptfoo with its data kept on a volume you control, so evals survive container restarts. Each step closes with a check that shows it worked. Confirm every command and path against the self-hosting documentation for the version you pin, and repeat the sequence in a staging environment before production use.

  1. Choose the host path or named volume

    The platform or DevOps engineer decides where promptfoo data will live on the Docker host: a bind-mounted host directory that your backup tooling can read directly, or a Docker named volume managed by the container engine. Pick the option your backup plan already covers, and confirm that the directory or volume is owned and writable by the user the container runs as. Record the choice in your runbook. This step is done when docker volume inspect shows the named volume, or ls -ld shows the host directory with the expected owner and write permissions.

  2. Set PROMPTFOO_CONFIG_DIR and match the mount

    Choose the directory inside the container where promptfoo will keep its configuration files and promptfoo.db, then set PROMPTFOO_CONFIG_DIR to that exact path. Mount the host path or named volume at the same path. The override changes where promptfoo writes, so a volume mounted at any other path leaves the data outside it. The engineer should write both values together in the compose file or run command. This step is done when docker inspect shows the environment variable and the mount destination are identical.

  3. Pin the image to an explicit version

    The engineer sets the promptfoo image to one explicit version tag, so a restart or a fresh pull cannot change the release that reads the data. Look up the matching self-hosting instructions for that tag in the promptfoo documentation and confirm the image is the one your team intends to run. Keep the same tag in staging and production. This step is done when docker inspect --format '{{.Config.Image}}' returns the pinned reference and the tag is written in your change record.

  4. Start the server with the data mount

    The platform engineer starts the container with docker run or docker compose up -d, passing the environment variable, the volume and the port mapping in one definition so the settings cannot drift apart. Keep the mapped port reachable only from a network or reverse proxy you control, because the self-hosted server has no built-in login. This step is done when the container reports running, the logs show the server started without errors, and the web UI answers on the mapped port from an allowed network.

  5. Create one small test record

    An engineer or evaluator creates a throwaway test record, such as a one-test eval whose results are shared to this server. Use a provider the team has already approved so the test stays small and predictable. Confirm the sharing steps for your pinned version in the self-hosting documentation first. Note the record name or ID and its creation time in the runbook. This step is done when the record appears in the server's results view and the same name or ID is visible in the web UI.

  6. Confirm promptfoo.db exists in the mount

    The platform engineer checks the mounted path on the host, or uses docker exec against the container, to confirm that promptfoo.db was created where PROMPTFOO_CONFIG_DIR points. Run the check after the test record exists. Note the file size and modification time so you can compare them after the restart. This step is done when promptfoo.db is listed in the mounted directory with a non-zero size, and the path matches the one in the compose file or run command.

  7. Restart the container and confirm the record

    Restart the container with docker restart or docker compose restart without changing the volume, environment variable or image tag. Once the server is back, confirm the test record still appears in the web UI or results view with the same name or ID. Then check that promptfoo.db still exists at the mounted path with the size and timestamp you recorded earlier. This step is done when the record and the database file both survive the restart. If either is missing, stop and compare the mount and environment values with the settings from the second step.

  8. Repeat the sequence in staging first

    Run the same sequence in a staging environment that uses the same pinned image, mount layout and environment variable, and confirm each command and path against the self-hosting documentation for that version. Include the restart test there before any production change. Take a backup of the data path before the production change, following your backup plan. This step is done when staging passes every check and the production runbook records each check result.

Where the volume attaches in Docker, Compose and Helm

In a single container, promptfoo writes its configuration directory, including promptfoo.db and the blobs directory, to the path set in PROMPTFOO_CONFIG_DIR. That path is where the persistent volume must attach. If you set the variable to a custom location, the volume has to follow it, because a volume mounted only at the default location will not hold data written to the custom path. Decide before the first run whether the volume is a named Docker volume or a host directory, since that choice decides where the files live and who backs them up.

  • Container path: Set PROMPTFOO_CONFIG_DIR to an absolute path inside the container, then mount storage at that exact path with -v.
  • Volume source: A named volume (-v promptfoo-data:/path) is managed by Docker. A bind mount (-v /srv/promptfoo:/path) stores files in a host directory you own.
  • Write permissions: For a host directory, confirm that the user the container runs as can write to it before the first start.
  • Image version: Record the image tag that created the data. Change the tag only as a planned upgrade, so the same volume is reused with a known version.

After a restart or redeploy, confirm that promptfoo.db and the blobs directory exist on the mounted path and that earlier evals still appear in the web UI.

Backing up self-hosted promptfoo data around container restarts

Self-hosted promptfoo keeps evals in a local SQLite file, promptfoo.db, and keeps media in a blobs directory. Both must sit on persistent storage, and both must be copied so that the pair stays consistent. The five approaches below differ in downtime, consistency risk and restore effort, so choose one only after you confirm how the server behaves during a copy.

Stop the server before copying

Stop the container, copy promptfoo.db and the blobs directory from the host, then start the container again. Nothing writes during the copy, so this gives the most consistent pair of files. The cost is downtime for every user while the copy runs, which grows with the size of your eval history. Restore is simple: place both files back on the persistent volume before starting. Confirm with the vendor that a clean stop flushes all pending writes, and confirm in your environment that no eval run is active when you stop the server.

Use a SQLite-aware online backup

Use SQLite's own backup mechanism, such as the .backup command in the sqlite3 shell or VACUUM INTO, to write a consistent copy while the server keeps running. Copying the raw file with cp during writes can capture a half-written state, so avoid it. The trade-off is that the sqlite3 client must exist where you run the command, on the host or in a sidecar, and the image may not include it. Restore by stopping the server, replacing the file and starting it again. Confirm with the vendor that the server tolerates a concurrent reader on the database.

Snapshot the host or cluster volume

Take a storage-level snapshot of the volume that holds promptfoo.db and the blobs directory, through your hypervisor, cloud disk or Kubernetes CSI snapshot class. This needs no downtime and captures both files as one point-in-time capture. The risk is crash consistency: the snapshot reflects what was on disk at that moment, so a write in progress may be incomplete. Restore by creating a volume from the snapshot and mounting it at the persistent path, then test that promptfoo starts. Confirm that your storage driver supports snapshots and what it guarantees about write ordering.

Copy blobs and database together

The database and the blobs directory refer to each other, so copies taken at different times can pair an eval record with missing media or leave orphaned files. Run both copies in the same backup job, ideally in the same window, and record the start time with the archive. This matters most when the server accepts writes during the copy. Restore both files from the same job. Confirm with the vendor how promptfoo.db references blobs, and confirm in your environment where the blobs directory sits relative to PROMPTFOO_CONFIG_DIR and its volume mount.

Self-hosting docs

Store copies off the host

Send each backup to storage outside the host running promptfoo, such as object storage in another account or a separate backup system, with encryption at rest and access limited to the people who restore it. Without this, a host failure or deleted volume takes the backups with it. Retention follows your own policy and any records obligations your organization has, so define how many copies to keep and for how long before you pick a tool. Restore into a separate container on a schedule to confirm the copies work. Confirm with your data owners how long eval data, which may include prompts and model outputs, must be kept.

Who can read the database copies and how to control them

Anyone who can read the data volume or a backup copy can read the eval data in promptfoo.db and the blobs directory, because the self-hosted server has no built-in authentication, SSO or RBAC to stop them. The database holds prompts, model responses and grading results, so treat it as sensitive from the first eval run. Start on the host. The directory that PROMPTFOO_CONFIG_DIR points to should be owned by the account the container runs as, with permissions that keep other local users out. Confirm this with ls -l on the host and from inside the container, and check who can mount or copy the volume. Membership in the Docker group on a host is administrative access in practice, so list those members as carefully as you would list root users. The promptfoo self-hosting documentation describes the data layout you need to map before you set these permissions.

Encryption at rest comes from the storage platform, not from promptfoo. Ask your cloud, hypervisor or storage team whether the disk or volume that holds the Docker volume is encrypted, who holds the keys, and whether key rotation is handled by the platform or by your team. Encryption at rest protects data when a disk, snapshot or backup medium is read outside the running system. It does not stop someone who can log into the live host or attach the volume while the service is running, and it does not stop the people who administer the key service. Ask for a written record of which key management service or hardware module is used and which named roles can administer it, because those roles can read the data. Confirm the same encryption applies to every location that receives a copy of the volume, including test hosts and any restore environment.

Backups should sit in the same access tier as the source. The common failure is copying promptfoo.db to a general file share or an object bucket with broader read rights than the production volume. Place backup copies in a location whose access list matches the production host, log who reads them, and name the people who may restore them. Set a retention period in writing, chosen by your organization, and apply it to every copy: snapshots, replicas in other locations and any copies on removable media. Deleting an eval in the interface does not remove it from older backups, so a deletion request must also reach the backup schedule. Before you rely on a copy, run a restore test to confirm it is consistent and readable, and record who approved the retention period.

Limits of self-hosted promptfoo data persistence to confirm

The cards below are limits that shape how safely this setup can hold evals and media. Each one names a question for the vendor, a check in your environment, or a test to run before anyone relies on the stored data. Read them together, because the single-instance design, the missing access controls and the untested restore path all affect how much weight the data can carry.

SQLite cannot be shared across replicas

Self-hosted promptfoo keeps evals in a local SQLite database, so each running instance owns its own copy of the data. Running a second replica against the same volume breaks that assumption and risks corrupting or diverging data. Ask the vendor whether any supported mode shares promptfoo.db across instances. In your environment, keep the replica count at one, and confirm that no autoscaler or rolling update starts a second copy against the same storage before go-live.

Self-hosting docs

Not recommended for production

The vendor's self-hosting documentation says the app is not recommended for production use. Treat this as a statement about the current release that sets how far your team can depend on the setup. Ask the vendor what it expects for the version you pin and whether a supported production path exists. Before go-live, decide whether this deployment is a pilot, an internal evaluation tool or a service other teams depend on, and record that decision in your risk register.

Self-hosting docs

No built-in access control

The server has no role-based access control, built-in authentication or SSO, so anyone who can reach the URL can read and change evals. Ask the vendor which of these are planned for your version and which sit only in the Enterprise edition, which lists teams-based access control and SSO. In your environment, confirm that the ingress, VPN or reverse proxy in front of the service enforces your identity checks, then test that an unauthenticated request is refused.

Pricing page

Default database and blobs paths

Confirm where the pinned image writes promptfoo.db and the blobs directory before you mount any volume. Setting PROMPTFOO_CONFIG_DIR overrides the internal configuration directory that holds the database, but the custom path still needs a persistent volume behind it. Ask the vendor for the default paths for your version, then verify them by inspecting the running container and listing the mounted volume. Confirm that both the database and the media survive a container recreate.

Self-hosting docs

Restore procedure must be tested

No restore procedure for the SQLite file and blobs directory is confirmed yet, so a backup only counts once it has restored working data. Ask the vendor for a documented restore sequence, including whether the service must be stopped while the database is copied. Restore a backup into a separate instance, open a known eval and its media, and record each step. Repeat the test after every version upgrade before go-live.

Confirm Helm chart status

The maturity of the Helm chart determines how much of this setup you can rely on. Ask the vendor whether the chart is experimental or supported for your target version, and what it guarantees about persistent volume claims during upgrades. Check the chart values for the single replica setting, PVC size and StorageClass. Before go-live, install the chart in a test cluster, upgrade it, and confirm the claim and its data persist. If the chart does not meet these checks, plan a deployment of the same image that your team manages directly.

Questions teams ask before setting up promptfoo data persistence

What drives the cost of setting up promptfoo data persistence?

Cost depends on four components: the internal platform skills available, the storage platform you choose for the volume, the backup tooling you already run, and the testing time needed to prove a restore works. If your own team does the work, the cost is staff time plus any storage and tooling you add. If a partner does it, the cost is the fixed scope agreed in writing before work starts. Setup is one-time work, while storage capacity, backup retention and ongoing restore testing recur. Costs rise when the storage platform is new to your team, when backups must meet an existing retention policy, or when restore tests cover several environments. Ask any quote to itemize setup, backup tooling, restore testing and handover so you can compare it with your own estimate.

What determines how long promptfoo data persistence setup takes?

The length is driven mainly by readiness, and no fixed duration applies until scope is agreed in writing. Work moves faster when the volume is already provisioned, backup tooling is in place, and a named person can approve container restarts. It slows when storage access needs procurement or approval, when restart windows are spaced far apart, or when restore tests must run against copies of your existing eval data. Teams also add time when the custom PROMPTFOO_CONFIG_DIR path needs a volume layout review first. Ask for each step to list its dependency on your side, so the schedule reflects your approvals as well as build work.

What does our team need to provide for this setup?

Plan for four inputs from your side before work starts.

  • Access to the storage platform, the container host or cluster, and the secrets used for provider keys, with least privilege granted to the people doing the work.
  • Change windows for stopping and restarting the promptfoo container, since the database is written to the volume during use.
  • A named owner who approves the volume layout, the retention period and the restore acceptance criteria.
  • Representative test data, such as a copy of a recent eval run, so restore tests prove that the promptfoo.db file and blobs directory open correctly.

Missing any of these typically moves the work into waiting time, so confirm each one in the written scope.

Can our own team set up promptfoo persistence without outside help?

Yes, an engineer who already runs containers and backups can set this up without outside help, provided the team understands the SQLite file and blobs directory well enough to back them up consistently. The core steps are mounting a persistent volume, pointing PROMPTFOO_CONFIG_DIR at a matching path when a custom location is used, scheduling backups, and testing a restore. Outside help usually adds value in three places: reviewing the volume layout against your backup tooling, designing a restore test that proves the data opens after an upgrade, and documenting a runbook for the team that will operate it. DeployOpen implements, backs up, documents and supports self-hosted platforms in your infrastructure, so a fixed-scope engagement can cover those pieces.

Is self-hosted promptfoo with SQLite safe for production use?

Persistence keeps evals and media across container restarts, but it does not make self-hosted promptfoo suitable for production on its own. The self-hosting documentation states that the app stores data in a local SQLite database that cannot be shared across replicas, that it has no RBAC, no horizontal scaling and no built-in authentication or SSO, and that it is not recommended for production use. In practice, that means one running instance, one writer to the database file, and access control handled by a layer you place in front of it. Teams that need several replicas, per-user roles or SSO should confirm whether the Enterprise or On-Premise editions fit their requirement before building around the Community server. Treat the persistent volume as protection for data only, and assess the rest of the deployment separately.

How do promptfoo upgrades affect the data stored in the volume?

Upgrades replace the container image while the data stays in the volume, so the data path matters most at the point of replacement. Keep PROMPTFOO_CONFIG_DIR and the volume mount identical between versions, because a path change without a matching volume leaves promptfoo.db and the blobs directory behind. Take a consistent backup of the SQLite file and blobs directory before pulling a new image, stop the container first where your tooling requires it, and then start the new version against the same volume. Check the release notes of the target version for any schema or data changes, and pin the version so an unplanned pull does not change the data path. Keep the previous backup until a restore test on the new version succeeds.

How DeployOpen scopes, delivers and supports promptfoo data persistence work

DeployOpen plans data persistence for self-hosted promptfoo as part of the deployment, inside infrastructure you control. Each engagement starts with a written scope, then covers the volume layout, the PROMPTFOO_CONFIG_DIR setting, and a backup plan for the SQLite database and blobs directory. Because the self-hosted server stores its data locally, the plan must match how your containers restart and recover.

How we scope

  • The written scope names the container runtime, volume layout and host paths before any work starts.
  • Engagements are fixed-scope, so deliverables and timelines are agreed in writing before work begins.
  • Scope should record which data is kept: promptfoo.db, evaluation media in the blobs directory, and configuration files.

How we build

  • Set PROMPTFOO_CONFIG_DIR to a path on a persistent volume so promptfoo.db survives container replacement.
  • Map the SQLite database and blobs directory to host or storage volumes that your backup tooling can reach.
  • Test a restart and a restore on a copy before the team relies on the instance.

How we hand over

  • Documentation covers the volume layout, environment variables, and the paths to back up and restore.
  • A restore runbook lists the steps to stop the container, copy data back and confirm the server starts.
  • Handover names the single-instance limit, so operators do not scale replicas against the shared SQLite file.

How we support

  • Ongoing support, upgrades and continuous testing for this setup are available as retainers.
  • Upgrade steps for the promptfoo image are planned against your backups, with the restore path confirmed first.
  • Confirm with promptfoo's documentation how the server handles data across image upgrades before changing versions.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.