Skip to content

Linger is An Open-Source Personal Agent That Runs Fully on Your PC. We aim to break Big Tech’s grip on AI by bringing powerful local AI to everyday computers through efficient model–harness co-design, so everyone can run their own.

docs: add a local PostgreSQL 17 setup guide

Lumea-art9ea3492f512e
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index bec72e43..4495c2f1 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -14,6 +14,9 @@ changes are reviewed. Repository-wide conventions live in
- Docker with Docker Compose, only for the Compose setup and for TeamHub
integration tests
+For a no-Docker PostgreSQL setup, see
+[Local PostgreSQL 17 for development](docs/local-postgresql.md).
+
## Run it locally
From the repository root:
diff --git a/docs/local-postgresql.md b/docs/local-postgresql.md
new file mode 100644
index 00000000..7865966f
--- /dev/null
+++ b/docs/local-postgresql.md
@@ -0,0 +1,101 @@
+# Local PostgreSQL 17 for development
+
+`pnpm dev` runs the services on your machine against a PostgreSQL 17 database
+with the `vector` extension. This page covers only that database and the
+problems that come up while running the services from source. See
+[CONTRIBUTING.md](../CONTRIBUTING.md) for the toolchain versions, the `.env`
+template, `pnpm dev`, and the optional LiveKit server.
+
+The default database is
+`postgres://simplexai:simplexai@localhost:5432/simplexai_dev`. If you use
+another one, set `TEAMHUB_DATABASE_URL` in `.env`; the role, database, and
+extension below match the default.
+
+## Option A: only the Compose database
+
+If Docker is available, the Compose `postgres` service already has the
+extension:
+
+```bash
+docker compose up --detach --wait postgres
+```
+
+## Option B: macOS
+
+```bash
+brew install postgresql@17 pgvector
+brew services start postgresql@17
+```
+
+Homebrew's superuser is your own OS user, so no `sudo -u postgres` is needed:
+
+```bash
+psql -d postgres -c "CREATE ROLE simplexai LOGIN PASSWORD 'simplexai'"
+createdb -O simplexai simplexai_dev
+psql -d simplexai_dev -c "CREATE EXTENSION IF NOT EXISTS vector"
+```
+
+## Option C: Ubuntu or Debian
+
+The packages from [apt.postgresql.org](https://apt.postgresql.org/) ship the
+extension:
+
+```bash
+sudo install -d /usr/share/postgresql-common/pgdg
+sudo curl -fsSL -o /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc \
+ https://www.postgresql.org/media/keys/ACCC4CF8.asc
+echo "deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" |
+ sudo tee /etc/apt/sources.list.d/pgdg.list
+sudo apt update
+sudo apt install postgresql-17 postgresql-17-pgvector
+```
+
+The `postgres` role uses peer authentication, so run the setup as that OS user:
+
+```bash
+sudo -u postgres psql -d postgres -c "CREATE ROLE simplexai LOGIN PASSWORD 'simplexai'"
+sudo -u postgres createdb -O simplexai simplexai_dev
+sudo -u postgres psql -d simplexai_dev -c "CREATE EXTENSION IF NOT EXISTS vector"
+```
+
+## Option D: build from source without root
+
+PostgreSQL and pgvector build without root:
+
+```bash
+# PostgreSQL, from its source directory
+./configure --prefix="$HOME/.local/pgsql" --without-icu --without-readline --without-zlib
+make -j"$(nproc)"
+make install
+
+# pgvector, from its source directory
+make PG_CONFIG="$HOME/.local/pgsql/bin/pg_config"
+make PG_CONFIG="$HOME/.local/pgsql/bin/pg_config" install
+```
+
+A source build has no cluster until you create one, and its superuser is the OS
+user that ran `initdb`:
+
+```bash
+export PATH="$HOME/.local/pgsql/bin:$PATH"
+initdb -D "$HOME/.local/pgsql/data"
+pg_ctl -D "$HOME/.local/pgsql/data" -l "$HOME/.local/pgsql/server.log" start
+
+psql -d postgres -c "CREATE ROLE simplexai LOGIN PASSWORD 'simplexai'"
+createdb -O simplexai simplexai_dev
+psql -d simplexai_dev -c "CREATE EXTENSION IF NOT EXISTS vector"
+```
+
+`pg_ctl` starts the server on port 5432, which is what the default
+`TEAMHUB_DATABASE_URL` expects. Stop it with
+`pg_ctl -D "$HOME/.local/pgsql/data" stop`.
+
+## Troubleshooting
+
+| Symptom | Fix |
+| --------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- |
+| `make -C apps/teamhub fmt-check` lists files you did not change | The local `gofmt` is not the version in `apps/teamhub/go.mod`; install that toolchain. |
+| Shell scripts fail with `\r` or `git status` lists every file | The checkout was created on Windows with CRLF endings; set `core.autocrlf=false` and re-checkout. |
+| `livekit-server` warning during `pnpm dev` | Voice is off; the app still runs. |
+| `database "simplexai_dev" does not exist` | Create the database; see above. |
+| `pnpm dev:check` fails on <http://localhost:3000> | Web waits for TeamHub's `/healthz`; wait a few seconds and run it again. |
diff --git a/docs/self-hosting.md b/docs/self-hosting.md
index 56b4645c..b9a1389d 100644
--- a/docs/self-hosting.md
+++ b/docs/self-hosting.md
@@ -46,6 +46,7 @@ LINGER_SECRET_SEED=<output of: openssl rand -base64 32>
Voice needs a Soniox key; [Voice](voice.md) shows how to turn it on. To
develop on the code with hot reload instead, `pnpm dev` runs every service on
your machine against a PostgreSQL you provide; see
+[Local PostgreSQL 17 for development](local-postgresql.md) and
[CONTRIBUTING.md](../CONTRIBUTING.md).
To collect the desktop app's diagnostics from your people, run a receiver