mirror of
https://github.com/tiennm99/DocsGPT.git
synced 2026-10-13 22:15:10 +00:00
feat: docsgpt backup and docsgpt restore
`docsgpt backup` writes one archive holding a pg_dump of the database, a tar of each data volume and a manifest of what it came from; `docsgpt restore` puts it back over an install. The settings file is left out unless --with-settings asks for it, since it holds the install's secrets, and a backup taken with a newer DocsGPT is refused without --force. The volume tars go through the image the install already runs, so a backup pulls nothing extra, and compose calls can now redirect stdout and stdin so the dump never passes through this process.
This commit is contained in:
1 parent
4abd2c0c9f
commit
fe68fec69e
9 files changed
+489
-7
No files matched your search
@@ -79,6 +79,36 @@ the questions again.
|
||||
| `docsgpt down` | Stop the stack; data and settings stay |
|
||||
| `docsgpt uninstall [--purge]` | Remove the containers; `--purge` also deletes the settings and all data |
|
||||
|
||||
### Backups
|
||||
|
||||
`docsgpt backup` writes one archive holding a dump of the database and a tar of
|
||||
each data volume (`indexes`, `inputs`, `vectors`):
|
||||
|
||||
```bash
|
||||
docsgpt backup # into <stack>/backups
|
||||
docsgpt backup --out /mnt/backups # somewhere else, e.g. a mounted disk
|
||||
```
|
||||
|
||||
The archive does **not** include `.env`, because that file holds the install's
|
||||
secrets. `docsgpt backup --with-settings` puts it in, for when the archive
|
||||
itself is stored somewhere private. Keep `.env` safe separately otherwise: the
|
||||
database password in it is what an existing Postgres volume expects.
|
||||
|
||||
Restoring replaces the data in an install:
|
||||
|
||||
```bash
|
||||
docsgpt restore ~/.docsgpt/server/backups/docsgpt-20260916-120000.tar.gz
|
||||
```
|
||||
|
||||
It asks first, then stops the stack, puts the volumes and the database back, and
|
||||
starts DocsGPT again. `--yes` skips the question for scripts. A backup taken
|
||||
with a newer DocsGPT is refused, since its data may not fit this version's
|
||||
schema; upgrade first, or pass `--force` if you know the two match.
|
||||
|
||||
The Postgres data directory itself is not archived: the dump is the database
|
||||
backup, and copying a directory Postgres is writing to would capture a torn
|
||||
copy. Caddy's certificates are not archived either, as it obtains them again.
|
||||
|
||||
More `docsgpt up` options: `--port`, `--docling` (the image with the docling
|
||||
parser engine and OCR), `--image-tag develop` (follow the `main` branch) and
|
||||
`--adopt` (manage a stack you started from the standalone Compose file in
|
||||
|
||||
@@ -11,6 +11,16 @@ The notable changes in each release. Every release on GitHub also carries
|
||||
[auto-generated notes](https://github.com/arc53/DocsGPT/releases) listing every merged pull
|
||||
request, and [Upgrading](/upgrading) covers the steps an existing deployment has to take.
|
||||
|
||||
## Unreleased
|
||||
|
||||
### Back up and restore an install
|
||||
|
||||
`docsgpt backup` writes a dump of the database and a tar of each data volume into one archive, and
|
||||
`docsgpt restore <archive>` puts them back. The settings file is left out unless
|
||||
`--with-settings` asks for it, since it holds the install's secrets, and a backup from a newer
|
||||
DocsGPT is refused unless you pass `--force`. See
|
||||
[Backups](/Deploying/Docker-Deploying#backups).
|
||||
|
||||
## 0.21.0
|
||||
|
||||
### Install with one command
|
||||
|
||||
Reference in new issue
Block a user