Separate PostgresQL runtime and schema ownership - #1752
Open
Jeremy Alvis (iplay88keys) wants to merge 1 commit into
Open
Jeremy Alvis (iplay88keys) wants to merge 1 commit into
Jeremy Alvis (iplay88keys) wants to merge 1 commit into
Conversation
Jeremy Alvis (iplay88keys)
marked this pull request as ready for review
September 18, 2026 21:38
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #997
Summary
Separate ateapi's normal database traffic from schema ownership and maintenance by supporting distinct runtime and DDL connection strings.
The existing PostgreSQL connection remains the runtime/DML connection. A new optional DDL connection defaults to the runtime connection, preserving simple single-role deployments.
What changed
The bundled PostgreSQL deployment now:
ateapi_runtimeandateapi_ddlrolesatepgdatabaseInstaller changes include:
Documentation now recommends a dedicated Substrate schema for split-role deployments because runtime grants cover every table and sequence in that schema.
Security considerations
This prevents normal request paths from performing migrations or outbox partition DDL and provides database-level separation and auditing.
Both credentials still exist inside the serving ateapi process, so this is not a security boundary against complete process compromise. Moving migrations and partition maintenance to a separate process remains a possible future hardening step.
Testing
go test ./cmd/ateapi/internal/store/atepg ./cmd/ateapi ./cmd/ate-setup/internal/config ./cmd/ate-setup/internal/stepsbash hack/verify/shellcheck.shbash -n hack/install-ate.shgit diff --checkTests cover split-role permissions, single-DSN operation, owner-pool routing, installer credential reuse, DSN validation, and configuration-hash rollouts.