feat: docsgpt up --native

Run DocsGPT without Docker: the API and the worker each become a service
on the machine itself, a launchd agent on macOS and a systemd user unit
on Linux, pointed at a PostgreSQL and a Redis that already run.

`docsgpt up --native --postgres-uri ... --redis-url ...` writes the same
.env a Docker install uses, applies the migrations and starts both
services. status, logs, down and uninstall work on a native install the
same way they do on a Docker one, and never touch the database or Redis:
they were the user's to begin with.

One Redis URL covers the broker, the result backend and the cache on
three consecutive databases, starting at the one the URL names, so a
Redis that already holds something else can be shared.

Windows has neither service manager, so native mode refuses it and says
what to do instead.
This commit is contained in:
Alex committed 2026-09-16 21:51:43 +01:00
1 parent fe68fec69e
commit f23a32d9c5
7 files changed
+722 -7

No files matched your search

+29
View File
@@ -99,6 +99,35 @@ Other commands:
- `docsgpt verify-offline`: check that a prepared install starts with networking off.
- `docsgpt reembed`: re-embed every index after changing `EMBEDDINGS_NAME` (see [Upgrading](/upgrading)).
## Run it as services, without Docker
`docsgpt up --native` runs the API and the worker as services on the machine itself: launchd agents on macOS, systemd user units on Linux. It does not start PostgreSQL or Redis; point it at ones you already run.
```bash
docsgpt up --native \
--postgres-uri postgresql://docsgpt:<password>@localhost:5432/docsgpt \
--redis-url redis://localhost:6379
```
Without a terminal both flags are required; with one, it asks for them and for the model provider. It writes the same `.env` a Docker install uses (minus the image settings), generates `INTERNAL_KEY` and `JWT_SECRET_KEY` on the first run, applies the migrations, then starts `docsgpt-api` and `docsgpt-worker` and waits for the API to answer.
One Redis URL covers all three uses: the Celery broker, its result backend and the cache go on databases 0, 1 and 2 of it. Name a database in the URL and the three start there instead, so `redis://localhost:6379/5` puts them on 5, 6 and 7 — that is how you share a Redis that already holds something else.
The same commands manage it:
| Command | In native mode |
| --- | --- |
| `docsgpt status` | Which services run, the address, and whether the API answers |
| `docsgpt logs [api\|worker]` | The service log files under `<stack>/logs` |
| `docsgpt down` | Stops both services; settings stay |
| `docsgpt uninstall [--purge]` | Removes the services; `--purge` also deletes the stack directory |
`uninstall` never touches the database or Redis: they were yours to begin with.
<Callout type="info">
Windows has neither launchd nor systemd, so native mode is macOS and Linux only. On Windows, run DocsGPT on Docker with `docsgpt up`, or start `docsgpt api` and `docsgpt worker` yourself.
</Callout>
## Upgrade
```bash
+8
View File
@@ -13,6 +13,14 @@ request, and [Upgrading](/upgrading) covers the steps an existing deployment has
## Unreleased
### Run DocsGPT without Docker
`docsgpt up --native` runs the API and the worker as services on the machine itself, launchd on
macOS and systemd user units on Linux, against a PostgreSQL and Redis you already have
(`--postgres-uri`, `--redis-url`). `status`, `logs`, `down` and `uninstall` work on such an install
the same way they do on a Docker one, and never touch the database or Redis. See
[Run it as services, without Docker](/Deploying/Pip-Install#run-it-as-services-without-docker).
### 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