From 2bbcce73e4fd901364af30d5a5f4f3c0ce0a6e97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Bombeck?= Date: Sun, 4 Oct 2026 21:25:28 +0200 Subject: [PATCH] docs: name the memory cap on small hosts and the shared connection pool Getting started names the APP_MEMORY_LIMIT default and how to lower it on a 2 GB host; the scaling guide says that web and worker share one pool in the bundled single-container setup. The rollup comment names migration 0372, which carries the hourly-mean statistic. --- docs/self-hosting/getting-started.md | 7 ++++++- docs/self-hosting/scaling.md | 6 +++++- src/lib/rollups/measurement-rollups.ts | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/docs/self-hosting/getting-started.md b/docs/self-hosting/getting-started.md index 88b88f0eb..c55033afd 100644 --- a/docs/self-hosting/getting-started.md +++ b/docs/self-hosting/getting-started.md @@ -13,7 +13,12 @@ already installed, longer if a TLS-fronted public hostname is in scope unchanged. - **2 GB RAM, 10 GB free disk.** The Postgres data volume grows with measurement history; the Apple Health import worker can briefly - hold a 1.5 GB upload in `/tmp` while it parses. + hold a 1.5 GB upload in `/tmp` while it parses. The app container is + capped at `APP_MEMORY_LIMIT`, `1536m` by default (Node then sizes its + heap at about 792 MB). On a 2 GB host that leaves too little for + Postgres and the system, so set `APP_MEMORY_LIMIT=1g` in `.env` + (a heap of about 524 MB); a long-used account then runs closer to + that heap, and the weekly backup with it. - **Outbound HTTPS** to `ghcr.io` (image pulls) plus whichever integration endpoints you plan to enable (Withings, OpenAI, etc.). The opt-in environmental-context module additionally reaches diff --git a/docs/self-hosting/scaling.md b/docs/self-hosting/scaling.md index 8bde98d1b..6776d44a3 100644 --- a/docs/self-hosting/scaling.md +++ b/docs/self-hosting/scaling.md @@ -163,7 +163,11 @@ the knob as `DB_CONNECTION_LIMIT`, baked into `DATABASE_URL` as `connection_limit`; `DATABASE_POOL_MAX` remains a working explicit override. Resolution order: `DB_CONNECTION_LIMIT`, then `DATABASE_POOL_MAX`, then the `connection_limit` URL parameter, then -the default of 20. +the default of 20. In the bundled single-container setup +(`HEALTHLOG_PROCESS_TYPE=all`) the web requests and the background +worker run in one process and share that one Prisma pool, so a budget +sized for the web traffic alone leaves the worker's jobs queueing for +the same connections. Plan total Postgres slots as **container_count × budget**. A stock Postgres 16 container ships with `max_connections = 100`, so diff --git a/src/lib/rollups/measurement-rollups.ts b/src/lib/rollups/measurement-rollups.ts index df8e52bb2..8f6643007 100644 --- a/src/lib/rollups/measurement-rollups.ts +++ b/src/lib/rollups/measurement-rollups.ts @@ -597,7 +597,7 @@ async function runRollupAggregate( * every reading, so the band and the windowed slope are untouched. * * Hours and days are UTC, matching the UTC day this tier buckets by; migration - * 0373 applies the same statistic to rows stored before it. + * 0372 applies the same statistic to rows stored before it. */ async function applyHourlyMeanDay( db: Pick,