From 4b28f254ba3b6b645d796dc8d2f395de88e01f3d Mon Sep 17 00:00:00 2001 From: Simone Cavalli Date: Tue, 23 Jun 2026 10:39:45 +0200 Subject: [PATCH] docs: correct DB-access procedure (direct SSH+docker exec, remote is gitea) Co-Authored-By: Claude Opus 4.8 --- CLAUDE.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 8babc03..58dbae6 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -21,10 +21,10 @@ Planning in `.planning/`. Use `/gsd-plan-phase N` → `/gsd-execute-phase N`. St - Confirm explicitly before any schema change that removes a column or table used by these entities ## Deploy & DB Access (procedure) -- Environments: local → Gitea (`origin`) → Coolify (prod, auto-deploys on push to `main`) -- Prod Postgres is NOT publicly exposed. Fixed access point: user opens an SSH tunnel - `ssh -o ServerAliveInterval=30 -L 54321:localhost:54321 root@178.104.27.55` and leaves it running. - Claude then connects to `127.0.0.1:54321` using prod creds in `.env.prod.local` (gitignored) — no per-step commands needed from the user. +- Environments: local → Gitea (remote is named `gitea`, NOT `origin`) → Coolify (prod, auto-deploys on push to `main`) +- Prod Postgres is NOT publicly exposed. Claude has working key-based SSH to `root@178.104.27.55` and applies migrations directly via docker exec — no SSH tunnel needed from the user: + `cat src/db/migrations/NNNN.sql | ssh root@178.104.27.55 "docker exec -i xwkk0040w0kk0gsgcgog8owk psql -U clienthub -d clienthub -v ON_ERROR_STOP=1 --single-transaction"` + (container = `xwkk0040w0kk0gsgcgog8owk`, db/user = `clienthub`; if the container hash changes, find it by scanning `docker ps` for the one whose db has the `payments` table). A tunnel `-L 54321:localhost:54321` is only needed to point local tooling at prod. - Migrations are hand-written SQL in `src/db/migrations/` (drizzle-kit generate is broken). - Ordering: apply an additive migration to prod BEFORE pushing the schema-dependent code, so the live portal never queries a missing column.