Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix: explain database selection before first-time setup

Adam Eivyf66904e5451c
diff --git a/README.md b/README.md
index 4db22a64b8..7838be6d18 100644
--- a/README.md
+++ b/README.md
@@ -303,11 +303,12 @@ Track your biological self alongside your digital one.
- Node.js `^22.22.2 || ^24.15.0 || >=26.0.0` (24 is the preferred LTS used by CI and `.nvmrc`; the supported Node 22 line starts at 22.22.2). `npm run setup`, `npm start` and `npm run dev` check this first and stop immediately on an unsupported release line or patch — a bare `npm install` only warns, so use the commands below.
- npm 11.11.0 or later for dependency authoring (`npm install -g [email protected]` provides the verified minimum and supports the PortOS Node floor). Its Arborist 9.4.0 lockfile writer preserves `libc` metadata; npm 11.10.1 and earlier omit it. See the [npm 11.11.0 writer](https://github.com/npm/cli/blob/v11.11.0/workspaces/arborist/lib/shrinkwrap.js). npm 12 is not required. PortOS-managed setup, update, and dependency-repair installs preserve committed lockfiles with `--no-save`; do not commit metadata-only churn from older npm. Every workspace declares `engines.npm`, and setup/start/dev print an advisory below that floor. These are warnings, never runtime failures. Check `node -v`, `npm -v`, and executable resolution in the environment running PortOS as well as your shell: a Node version manager can select a different toolchain for agent shells. Avoid blindly upgrading to `npm@latest`, whose own Node requirement may exceed PortOS's.
- Git
-- PostgreSQL, either installed locally or available through Docker. PortOS requires a healthy database; the setup command provisions the supported local or Docker-backed instance.
+- PostgreSQL, either installed locally or available through Docker. Setup defaults to Docker and requires a running Docker daemon and Docker Compose; it does not automatically select an existing native database. For a **fresh native install**, set `PGMODE=native` in the repository-root `.env` before setup, preserving any other settings. See [database selection](./docs/SETUP.md#choose-the-database-before-setup).
```bash
git clone --recurse-submodules https://github.com/atomantic/PortOS.git
cd PortOS
+# For native PostgreSQL, first set PGMODE=native in .env (see above).
npm run setup
npm start
```
diff --git a/docs/SETUP.md b/docs/SETUP.md
index 7b0dbb0fbd..ea65648a69 100644
--- a/docs/SETUP.md
+++ b/docs/SETUP.md
@@ -7,12 +7,44 @@ PortOS can automate local installation, certificate provisioning, and launch URL
```bash
git clone --recurse-submodules https://github.com/atomantic/PortOS.git
cd PortOS
+```
+
+### Choose the database before setup
+
+Setup provisions only the selected backend; it does not detect and choose between
+Docker and native PostgreSQL.
+
+- **Docker (default):** install and start Docker with Compose available before
+ running setup. With no `PGMODE` configured, PortOS uses Docker on port `5561`.
+- **Fresh native install:** create or edit `.env` in the repository root and set
+ `PGMODE=native`, preserving other settings. The default endpoint is
+ `localhost:5432`; set `PGHOST` and `PGPORT` there if needed. Setup checks that
+ endpoint and, if it is not ready, invokes the native bootstrap in
+ `scripts/db.sh setup-native` (Homebrew provisioning).
+
+An exported `PGMODE` overrides `.env`; unset a conflicting shell value before
+setup. If Docker is selected but unavailable, setup fails even if native
+PostgreSQL is healthy. It leaves the selection unchanged so a missing Docker
+daemon cannot silently redirect an existing install to another database.
+
+**Existing installs:** retain the backend holding your records. Editing `PGMODE`
+or rerunning setup does not migrate them. Use the coordinated cutover in
+**Settings → Database** to move between backends; see
+[Database backend migration](./BACKUP.md#database-backend-migration).
+For endpoint overrides and readiness checks, see
+[Storage setup](./STORAGE.md#setup-path-npm-run-setupdb).
+
+### Run the installer
+
+```bash
./setup.sh # macOS / Linux guided installer
# or: .\setup.ps1 # Windows PowerShell
```
`npm run setup` is the non-wrapper equivalent. All three paths install dependencies, provision PostgreSQL, prepare runtime data and the managed browser, ask about a local LLM when an interactive terminal is available, safely attempt Tailscale certificate provisioning, and print the remaining setup walkthrough.
+## Network setup
+
The network sequence is:
1. Install [Tailscale](https://tailscale.com/download) on the PortOS host.