You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] Upgrade from 2.x: compose pins postgres:15, but existing .nostr/data may be PG 16/17/18 (old unpinned postgres image) #928
Describe the bug #393 (for #387) pinned nostream-db to postgres:15. Before that the compose file used the unpinned postgres image, so existing installs created .nostr/data with whatever major version was latest at the time — 16, 17 or 18. After upgrading such an install to 3.x, postgres:15 cannot open the data directory and the relay never starts. The bind mount ${PWD}/.nostr/data is still used, so the old data is picked up — just by the wrong major version.
To Reproduce
Run nostream 2.x with the old compose (image: postgres) — e.g. our .nostr/data has PG_VERSION = 17 (image was 17.5).
git checkout v3.4.1 && docker compose up -d.
nostream-db cannot start, because PostgreSQL refuses a data directory initialized by a newer major ("database files are incompatible with server"), and nostream-migrate/nostream wait on its healthcheck. (We caught this before starting: .nostr/data/PG_VERSION said 17 while the compose file says 15, so we did not run 15 against the data.)
Expected behavior
Upgrading from 2.x either keeps working or stops with a clear message telling the operator which image to use.
System
OS: Ubuntu 22.04
Platform: docker compose v5.4
Version: 2.1.0 → 3.4.1, data dir PG 17
Workaround we use docker-compose.override.yml next to the upstream file:
Note the -bookworm suffix: the old postgres image was Debian 12 based, current postgres:17 is Debian 13 with a newer glibc. Our database uses the libc collation en_US.utf8, and switching glibc versions under an existing cluster can silently invalidate text indexes — so the variant should match the one that created the data.
Suggestion
an upgrade note in the release notes / docs: check cat .nostr/data/PG_VERSION and override the image to that major (same Debian variant) before docker compose up;
optionally, the CLI start command could read PG_VERSION and refuse to start with a clear message when it does not match the configured image major.
I'd like to take this one, could you assign it to me?
My plan is a docs-only fix: a short note at the top of "Updating the Relay" in docs/SETUP.md that says to run cat .nostr/data/PG_VERSION before upgrading. If it isn't 15, keep that major with a docker-compose.override.yml (your workaround, including the -bookworm suffix), and for 18 also set PGDATA, since the 18 image moved its data dir. Plus an empty changeset, as CONTRIBUTING asks for docs.
I checked it against the prod compose with real PG binaries: 15 on 17 data gives the "database files are incompatible with server" FATAL from the issue, the 16/17 overrides start fine, and 18 starts only with PGDATA set. I left the postgres:15 pin alone because moving it is your call.
The branch is ready, so I can open the PR as soon as it's assigned.
@cameri the fix is ready in my fork: atokim4#1 (branch docs/928-pg-version-check). It's a docs note at the top of "Updating the Relay" in docs/SETUP.md (check PG_VERSION, keep that major with a docker-compose.override.yml, -bookworm for 16/17, PGDATA for 18) plus an empty changeset, in two commits: ac5eb86 and c463a35. Could you cherry-pick it?
Activity
atokim4 commentedon Nov 13, 2026
I'd like to take this one, could you assign it to me?
My plan is a docs-only fix: a short note at the top of "Updating the Relay" in
docs/SETUP.mdthat says to runcat .nostr/data/PG_VERSIONbefore upgrading. If it isn't 15, keep that major with adocker-compose.override.yml(your workaround, including the-bookwormsuffix), and for 18 also setPGDATA, since the 18 image moved its data dir. Plus an empty changeset, as CONTRIBUTING asks for docs.I checked it against the prod compose with real PG binaries: 15 on 17 data gives the "database files are incompatible with server" FATAL from the issue, the 16/17 overrides start fine, and 18 starts only with
PGDATAset. I left thepostgres:15pin alone because moving it is your call.The branch is ready, so I can open the PR as soon as it's assigned.
cameri commentedon Nov 29, 2026
@atokim4 assigned to you. Thanks!
chore(changeset): empty changeset for the cameri#928 docs note
atokim4 commentedon Dec 2, 2026
@cameri the fix is ready in my fork: atokim4#1 (branch
docs/928-pg-version-check). It's a docs note at the top of "Updating the Relay" indocs/SETUP.md(checkPG_VERSION, keep that major with adocker-compose.override.yml,-bookwormfor 16/17,PGDATAfor 18) plus an empty changeset, in two commits: ac5eb86 and c463a35. Could you cherry-pick it?docs(setup): find the 2.x data directory, not only /opt/nostream
docs(setup): start the database under the override, and match its C l…
docs(setup): move the 2.x cluster, and never restore a dump into 15
docs(setup): a move that lands cleanly, a cache, and the cluster's ow…
docs(setup): an in-place cluster, a copy that must succeed, and the o…