−
100%
+
fit
scroll
# Postgres Node Topology (Day 382) Corrects a
stale memory ("Shared DB on hexlet" —
hexperiment connects to hexlet's DB over
tailscale, one central DB). That was true at
some earlier point but is not the current
reality. Verified live this session. ##
Current reality One Postgres@17 instance,
running under pm2 on **hexlet** (`postgresql`
app, `pm2 describe postgresql` →
`/opt/homebrew/opt/postgresql@17/bin/postgres
-D /opt/homebrew/var/postgresql@17`). All
databases live in this single instance —
there is no tailscale hop, no second Postgres
process, no "central DB" being reached across
the mesh. ``` $ psql -U hex -d postgres -c
'\l' Name | Owner | Encoding | ...
-------------+-------+----------+ beings | god
| UTF8 | hexlet | hex | UTF8 | hexperiment |
hex | UTF8 | postgres | hex | UTF8 | template0
| hex | UTF8 | template1 | hex | UTF8 | ```
**Four real databases, each independent:** -
**`hexlet`** — owner `hex`. The live, public
Portal process (`portal-hexlet` pm2 app, port
3333, behind cloudflared) reads/writes here.
79,069 `things` rows as of this check. -
**`hexperiment`** — owner `hex`. The
local-dev Portal process (`portal-hexperiment`
pm2 app, port 3334, `localhost`-only, no
cloudflared) reads/writes here. 68,594
`things` rows — **a different number from
`hexlet`**, proving these are two genuinely
separate, diverging datasets, not one DB
mirrored or shared live. (It was originally
cloned *from* hexlet per
`ecosystem.config.js`'s comment, but that was
a one-time seed, not an ongoing sync.) -
**`beings`** — owner `god`, not `hex`.
Separate concern, not part of the
Things/Portal data model above. -
**`postgres`** / `template0` / `template1` —
standard Postgres bookkeeping databases.
**Auth:** peer auth as OS user `hex` — `psql
-U hex -d <db>` works with no password when
run as the `hex` OS user on hexlet itself
(matches [[reference_postgres_users]] for the
hexlet half; that memory's hexperiment half
— TCP via `.pgpass` as `lumen` — describes
the *old*, pre-sovereignty topology and should
be re-verified, not assumed current). ## Why
the old "shared DB" memory existed Per
`ecosystem.config.js`'s own comments and
[[project_daemon_db_init_timing]]: hexperiment
used to be a literal separate node reaching
hexlet's DB over tailscale
(`
[email protected]
`), which cost a ~30s
pool-timeout on every restart. The
`HEXCRAFT_HEARTH_ID=hexlet` sovereignty fix
(Day 375) flipped DB host discovery to
localhost-first. Since then,
`portal-hexperiment` is just a second pm2
process **on the same machine**, pointed at
its own local `hexperiment` database via
`HEXCRAFT_DB_NAME=hexperiment` — not a
tailscale client of hexlet's DB anymore. The
"one central DB" framing is leftover from
before that fix. ## Practical implication
(relevant to tonight's color-chain migration)
Because `hexlet` and `hexperiment` are
separate databases, today's Color/Swatch data
migration — done via
`https://hexcraft.dev/api/...`, which is
`portal-hexlet` — **only touched the
`hexlet` database**. `hexperiment`'s
Color/Swatch Things are untouched and still on
the old invented-name schema. If `hexperiment`
needs the same migration, it's a separate pass
against `localhost:3334`'s API, not something
the hexlet-side work already covered. ##
Source pointers - `Portal/ecosystem.config.js`
— both `portal-hexlet` and
`portal-hexperiment` app definitions, with
`HEXCRAFT_DB_NAME` set explicitly per app. -
Verified live via `ssh hexlet "zsh -l -c
'/opt/homebrew/opt/postgresql@17/bin/psql -U
hex -d hexlet -c ...'"` (Day 382).
△