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
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
43 lines
1.5 KiB
SQL
43 lines
1.5 KiB
SQL
-- moments role and database bootstrap.
|
|
-- Run as a postgres superuser against the cluster's `postgres` database.
|
|
-- Idempotent — safe to re-run on every deploy.
|
|
--
|
|
-- Two run modes — pick whichever fits your operator path:
|
|
--
|
|
-- (a) mTLS as the network superuser `grenade` (already mapped via pg_ident
|
|
-- on magrathea + frankie). The host cert is picked up from the standard
|
|
-- /etc/pki/tls paths via the PG* env vars:
|
|
--
|
|
-- 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 postgres \
|
|
-- -f asset/sql/bootstrap.sql
|
|
--
|
|
-- (b) ssh to the db host and run as the local `postgres` peer:
|
|
--
|
|
-- ssh magrathea.hanzalova.internal \
|
|
-- sudo --user postgres psql -d postgres -f - \
|
|
-- < asset/sql/bootstrap.sql
|
|
--
|
|
-- After this completes, run asset/sql/bootstrap-moments.sql against the
|
|
-- newly created `moments` database to apply the in-database grants.
|
|
|
|
DO $$
|
|
BEGIN
|
|
IF NOT EXISTS (SELECT FROM pg_roles WHERE rolname = 'moments_rw') THEN
|
|
CREATE ROLE moments_rw LOGIN;
|
|
END IF;
|
|
IF NOT EXISTS (SELECT FROM pg_roles WHERE rolname = 'moments_ro') THEN
|
|
CREATE ROLE moments_ro LOGIN;
|
|
END IF;
|
|
END
|
|
$$;
|
|
|
|
SELECT 'CREATE DATABASE moments OWNER moments_rw'
|
|
WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = 'moments')
|
|
\gexec
|
|
|
|
GRANT CONNECT ON DATABASE moments TO moments_ro, moments_rw;
|