From 130da3d958cd3de13e93ceee007bced78cb5777a Mon Sep 17 00:00:00 2001 From: silentoplayz Date: Tue, 29 Sep 2026 04:08:06 -0400 Subject: [PATCH] docs: write pending changes into webui.db before exporting it Open WebUI runs SQLite in WAL mode by default since v0.9.0, and a clean `docker stop` leaves recent committed changes in webui.db-wal. The export steps copied webui.db alone, so the copy could miss them. Add a step that runs PRAGMA wal_checkpoint(TRUNCATE) from the container's own image while it is stopped, using the same --volumes-from pattern the import step already uses, and add the line to the quick-commands summary. The import steps are unchanged. --- docs/tutorials/maintenance/database.mdx | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/docs/tutorials/maintenance/database.mdx b/docs/tutorials/maintenance/database.mdx index ec2dfaec09..cc63405bb2 100644 --- a/docs/tutorials/maintenance/database.mdx +++ b/docs/tutorials/maintenance/database.mdx @@ -14,23 +14,29 @@ Follow the steps below to export and import the `webui.db` file, which contains To export the database from your current Open WebUI instance: 1. **Stop Open WebUI before copying the database**: - SQLite can use write-ahead logging (WAL), which may keep recent committed changes in sidecar files while the application is running. Stop the container first so the database is in a consistent state before export: + Open WebUI runs SQLite in write-ahead logging (WAL) mode by default, so recent committed changes are kept in `webui.db-wal` next to `webui.db`. Stop the container first so nothing writes to the database during the export: ```bash docker stop open-webui ``` -2. **Use `docker cp` to copy the database file**: +2. **Write the pending changes into `webui.db`**: + Stopping the container leaves those changes in `webui.db-wal`, so a copy of `webui.db` alone can be missing them. Run a checkpoint from the same image while the container is stopped: + ```bash + docker run --rm --volumes-from open-webui --entrypoint python3 "$(docker inspect -f '{{.Config.Image}}' open-webui)" -c "import sqlite3; db = sqlite3.connect('/app/backend/data/webui.db'); db.execute('PRAGMA wal_checkpoint(TRUNCATE)'); db.close()" + ``` + +3. **Use `docker cp` to copy the database file**: The `webui.db` file is located in the container inside the directory `/app/backend/data`. Run the following command to copy it into your local machine: ```bash docker cp open-webui:/app/backend/data/webui.db ./webui.db ``` -3. **Start Open WebUI again on the source server**: +4. **Start Open WebUI again on the source server**: ```bash docker start open-webui ``` -4. **Transfer the exported file to the new server**: +5. **Transfer the exported file to the new server**: You can use **FileZilla** or any other file transfer tool of your choice to move the `webui.db` file to the new server. :::info @@ -93,6 +99,7 @@ This approach is particularly useful when: # Export: docker stop open-webui +docker run --rm --volumes-from open-webui --entrypoint python3 "$(docker inspect -f '{{.Config.Image}}' open-webui)" -c "import sqlite3; db = sqlite3.connect('/app/backend/data/webui.db'); db.execute('PRAGMA wal_checkpoint(TRUNCATE)'); db.close()" docker cp open-webui:/app/backend/data/webui.db ./webui.db docker start open-webui