Files
moments/asset/sql/bootstrap-moments.sql
T
grenadeandClaude Opus 5.5 25d306fed7
deploy / Build api + worker (static musl) (push) Successful in 6m55s
deploy / Deploy moments-worker to frootmig (push) Successful in 20s
deploy / Deploy moments-api to nikola (push) Successful in 21s
deploy / Build prerendered web (push) Successful in 3m24s
deploy / Deploy web to oolon (push) Successful in 33s
chore(infra): Follow the DC to office host moves
magrathea, caveman, nikola and frootmig moved from kosherinata (DC) to
hanzalova (office) on 2026-11-01 and were renamed accordingly:

  magrathea.hanzalova.internal  10.6.0.194  (postgres primary)
  caveman.hanzalova.internal    10.6.0.186  (minio, gitea)
  nikola.hanzalova.internal     10.6.0.173
  frootmig.hanzalova.internal   10.6.0.131

The old *.kosherinata.internal names remain as transitional DNS aliases
and will be removed once deploys use the new names.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TzeoVkZAgsEiJaTpxRZ42Q
2026-11-02 11:22:40 +02:00

30 lines
1.2 KiB
SQL

-- In-database grants for the moments database.
-- Run after asset/sql/bootstrap.sql, against the moments database.
-- Idempotent — safe to re-run on every deploy.
--
-- (a) mTLS as `grenade`:
--
-- PGSSLMODE=verify-full \
-- PGSSLCERT=/etc/pki/tls/misc/$(hostname -f).pem \
-- PGSSLKEY=/etc/pki/tls/private/$(hostname -f).pem \
-- PGSSLROOTCERT=/etc/pki/ca-trust/source/anchors/root-internal.pem \
-- psql -h magrathea.hanzalova.internal -U grenade -d moments \
-- -f asset/sql/bootstrap-moments.sql
--
-- (b) ssh + sudo to the local postgres peer:
--
-- ssh magrathea.hanzalova.internal \
-- sudo --user postgres psql -d moments -f - \
-- < asset/sql/bootstrap-moments.sql
--
-- The schema itself is created by sqlx migrations executed by moments-api
-- on startup (which runs as moments_rw, the database owner). This file
-- only manages the read-only role's access to whatever moments_rw creates.
GRANT USAGE ON SCHEMA public TO moments_ro;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO moments_ro;
-- Tables created later by moments_rw (running migrations) inherit SELECT for moments_ro.
ALTER DEFAULT PRIVILEGES FOR ROLE moments_rw IN SCHEMA public
GRANT SELECT ON TABLES TO moments_ro;