-- ============================================================ -- init-patroni-users.sql -- Creates users required by Patroni on an existing standalone -- PostgreSQL instance before Patroni takeover. -- -- Run this on the current primary BEFORE starting Patroni: -- podman compose run --rm --no-deps postgres \ -- psql -U netbox -d netbox -f /init-patroni-users.sql -- ============================================================ -- Replication user (used by replicas for streaming replication) CREATE ROLE replicator WITH REPLICATION LOGIN PASSWORD 'replicator-pass'; -- Rewind user (used by pg_rewind when a former leader rejoins) CREATE ROLE rewind_user WITH LOGIN PASSWORD 'rewind-pass'; GRANT EXECUTE ON function pg_catalog.pg_ls_dir(text, boolean, boolean) TO rewind_user; GRANT EXECUTE ON function pg_catalog.pg_stat_file(text, boolean) TO rewind_user; GRANT EXECUTE ON function pg_catalog.pg_read_binary_file(text) TO rewind_user; GRANT EXECUTE ON function pg_catalog.pg_read_binary_file(text, bigint, bigint, boolean) TO rewind_user;