From cd0dcbad15d172b7cdd727d41bb44d0a22bcc1a7 Mon Sep 17 00:00:00 2001 From: Siva Date: Wed, 25 Nov 2026 18:39:18 +0530 Subject: [PATCH 1/5] build(release): bump version to v1.0.0 --- CHANGELOG.md | 40 +++++++++++++++++++ api/apiv1/gen/control_plane/service.go | 2 +- api/apiv1/gen/http/openapi.json | 2 +- api/apiv1/gen/http/openapi.yaml | 2 +- api/apiv1/gen/http/openapi3.json | 2 +- api/apiv1/gen/http/openapi3.yaml | 2 +- api/version.txt | 2 +- changes/unreleased/Added-20261009-000000.yaml | 3 -- changes/unreleased/Added-20261019-143344.yaml | 3 -- changes/unreleased/Added-20261027-000000.yaml | 3 -- changes/unreleased/Added-20261104-000000.yaml | 3 -- changes/unreleased/Added-20261111-000000.yaml | 3 -- changes/unreleased/Added-20261112-000000.yaml | 3 -- changes/unreleased/Added-20261117-000000.yaml | 3 -- changes/unreleased/Added-20261118-000000.yaml | 3 -- changes/unreleased/Added-20261120-000000.yaml | 3 -- .../unreleased/Changed-20261022-095713.yaml | 3 -- .../unreleased/Changed-20261029-000000.yaml | 3 -- .../unreleased/Changed-20261104-035716.yaml | 3 -- .../unreleased/Changed-20261124-000000.yaml | 3 -- .../unreleased/Changed-20261125-000000.yaml | 3 -- changes/unreleased/Fixed-20261022-105838.yaml | 3 -- changes/unreleased/Fixed-20261026-123220.yaml | 3 -- changes/unreleased/Fixed-20261026-155850.yaml | 3 -- changes/unreleased/Fixed-20261102-000000.yaml | 3 -- changes/unreleased/Fixed-20261111-043159.yaml | 3 -- changes/unreleased/Fixed-20261117-000000.yaml | 3 -- changes/unreleased/Fixed-20261119-000000.yaml | 3 -- changes/unreleased/Fixed-20261119-120000.yaml | 3 -- changes/unreleased/Fixed-20261120-000000.yaml | 3 -- changes/unreleased/Fixed-20261124-000000.yaml | 3 -- .../unreleased/Security-20261029-202521.yaml | 3 -- .../unreleased/Security-20261117-000000.yaml | 3 -- changes/v1.0.0.md | 39 ++++++++++++++++++ docs/api/openapi.md | 8 ++-- docs/api/reference.md | 2 +- docs/changelog.md | 40 +++++++++++++++++++ docs/development/e2e-tests.md | 2 +- docs/installation/mtls.md | 8 ++-- docs/installation/swarm-installation.md | 12 +++--- docs/installation/swarm-upgrading.md | 4 +- 41 files changed, 143 insertions(+), 102 deletions(-) delete mode 100644 changes/unreleased/Added-20261009-000000.yaml delete mode 100644 changes/unreleased/Added-20261019-143344.yaml delete mode 100644 changes/unreleased/Added-20261027-000000.yaml delete mode 100644 changes/unreleased/Added-20261104-000000.yaml delete mode 100644 changes/unreleased/Added-20261111-000000.yaml delete mode 100644 changes/unreleased/Added-20261112-000000.yaml delete mode 100644 changes/unreleased/Added-20261117-000000.yaml delete mode 100644 changes/unreleased/Added-20261118-000000.yaml delete mode 100644 changes/unreleased/Added-20261120-000000.yaml delete mode 100644 changes/unreleased/Changed-20261022-095713.yaml delete mode 100644 changes/unreleased/Changed-20261029-000000.yaml delete mode 100644 changes/unreleased/Changed-20261104-035716.yaml delete mode 100644 changes/unreleased/Changed-20261124-000000.yaml delete mode 100644 changes/unreleased/Changed-20261125-000000.yaml delete mode 100644 changes/unreleased/Fixed-20261022-105838.yaml delete mode 100644 changes/unreleased/Fixed-20261026-123220.yaml delete mode 100644 changes/unreleased/Fixed-20261026-155850.yaml delete mode 100644 changes/unreleased/Fixed-20261102-000000.yaml delete mode 100644 changes/unreleased/Fixed-20261111-043159.yaml delete mode 100644 changes/unreleased/Fixed-20261117-000000.yaml delete mode 100644 changes/unreleased/Fixed-20261119-000000.yaml delete mode 100644 changes/unreleased/Fixed-20261119-120000.yaml delete mode 100644 changes/unreleased/Fixed-20261120-000000.yaml delete mode 100644 changes/unreleased/Fixed-20261124-000000.yaml delete mode 100644 changes/unreleased/Security-20261029-202521.yaml delete mode 100644 changes/unreleased/Security-20261117-000000.yaml create mode 100644 changes/v1.0.0.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 555fe801..584a6733 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,45 @@ # Changelog +## v1.0.0 - 2026-11-25 + +### Added + +- Added support for Spock 5.0.13 on Postgres 16.15, 17.11, and 18.6. +- Database updates can now repair a node that has no primary instance, and database deletes can now remove one. Previously, both operations failed with a `node has no primary instance` error. +- Added a `locale` field to the database spec for setting the locale provider, locale, collation, and encoding used when the database is created. +- Added support for PostgREST services on hosts that use the systemd orchestrator. Install the PostgREST package on each host that runs a PostgREST service. +- Added support for single-node databases without Spock to the systemd orchestrator. Postgres installations without Spock are now reported as supported versions, and databases created with those versions do not use Spock. +- Added support for MCP services on hosts that use the systemd orchestrator. Install the pgedge-postgres-mcp package on each host that runs an MCP service. A knowledgebase file must be readable by the pgedge user. +- Added support for Spock 5.0.14 on Postgres 16.16, 17.12, and 18.7. Postgres 18.7 with Spock 5.0.14 is now the default. +- Added support for RAG services on hosts that use the systemd orchestrator. Install the pgedge-rag-server2 package on each host that runs a RAG service. The new systemd.rag_path setting selects the RAG server binary. +- Added validation of `shared_preload_libraries` for hosts that use the systemd orchestrator. Each library must be installed in the library directory of the database's Postgres version on every host that runs it. Libraries are only validated on hosts that have reported their installed libraries, and path-style entries are not validated. + +### Changed + +- Changed systemd orchestrator to find Postgres and Spock installations using `pg_config` rather than by matching specific package names. +- Renamed the `cluster_already_initialized` error returned by the init and join cluster endpoints to `host_already_in_cluster` with a clearer message. +- Database updates that remove the host running a node's current primary instance, while keeping the node, are now rejected with an error that asks you to perform a switchover first. Previously, the node could not accept writes until Patroni promoted a new primary. Hosts listed in `remove_host` are not affected. +- The Spock 6 preview now uses Spock 6.0.0-beta2 images on Postgres 16.16, 17.12, and 18.7. Databases created on 6.0.0-beta1 images can still be updated, and moving one to beta2 now updates its Spock catalog automatically. +- PostgREST 14.18 and RAG 2.0.1 are now available and are the default versions for new PostgREST and RAG services. Existing services keep their current version. The Spock 5.0.14 images for Postgres 16.16, 17.12, and 18.7 now use a newer build. + +### Fixed + +- Fixed Patroni REST API requests failing with `403 Access is denied` on dual-stack hosts. The generated Patroni allowlist now includes the IPv4-mapped loopback address `::ffff:127.0.0.1`. +- Fixed etcd `log_level` overrides being saved to `generated.config.json` and staying in effect after the override was removed. Only the etcd server ports and client endpoints are now saved to the generated config. +- Fixed node backups failing the primary instance check for a node with multiple instances when the first instance checked was not the primary. The check now looks at all of the node's instances, and the error message now says when a node has no available primary instance. +- Removing a host now updates the Patroni configuration of every modifiable database so that it no longer refers to the removed Etcd server. Databases that can't be modified at that time are updated on their next database update. +- Fixed database tasks failing with a misleading `pending futures` error when a resource change could not be queued, such as while a host was being removed. The task now waits for in-progress changes to finish and reports the underlying error. +- Fixed an issue where starting, restoring, or updating a database instance could fail because of an old failed task in the Docker Swarm task history. +- Getting a host that doesn't exist now returns a 404 not_found error instead of a 500 server_error, and the error message no longer includes internal storage details. +- Creating or updating a database with a node name that isn't "n" followed by a number, such as "n1-east", now returns a 400 error that names the node and the expected format, instead of a 500 server error. The same node name format is now enforced for the node names in backup, switchover, failover, and restore requests. +- A scheduled switchover's task now stays running until the switchover happens, and canceling the task before the scheduled time cancels the switchover. Previously, the task completed as soon as the switchover was scheduled and could no longer be canceled. A scheduled switchover is now skipped if the primary changes before the scheduled time, it fails rather than running more than 5 minutes late, and it uses the node's current hosts at the scheduled time. Requesting a switchover or failover for a node that already has one in progress now returns a 409 operation_already_in_progress error instead of a 500 server error. +- Replicas of Spock 6 databases on Postgres 17 or later now drop stale copies of Spock replication slots, including after a switchover or failover, so that native slot synchronization keeps their copies current. Creating or updating a replica no longer fails when its slot copies stay temporary, and an update doesn't switch over to a replica that lacks them. + +### Security + +- Built the Control Plane with Go 1.26.10, which no longer trusts eight compromised eMudhra intermediate certificate authorities (CVE-2026-111943). +- Sensitive pgBackRest options, such as `cipher-pass`, in backup and restore repository `custom_options` are now excluded from API responses. Omitting these options from a database update preserves their stored values. + ## v0.11.0 - 2026-09-30 ### Added diff --git a/api/apiv1/gen/control_plane/service.go b/api/apiv1/gen/control_plane/service.go index d77b5005..e2a38ae3 100644 --- a/api/apiv1/gen/control_plane/service.go +++ b/api/apiv1/gen/control_plane/service.go @@ -87,7 +87,7 @@ type Service interface { const APIName = "control-plane" // APIVersion is the version of the API as defined in the design. -const APIVersion = "v0.11.0" +const APIVersion = "v1.0.0" // ServiceName is the name of the service as defined in the design. This is the // same value that is set in the endpoint request contexts under the ServiceKey diff --git a/api/apiv1/gen/http/openapi.json b/api/apiv1/gen/http/openapi.json index 849397a7..822d493b 100644 --- a/api/apiv1/gen/http/openapi.json +++ b/api/apiv1/gen/http/openapi.json @@ -3,7 +3,7 @@ "info": { "title": "pgEdge Control Plane v1 API", "description": "A distributed application that provides a declarative API to deploy and manage Postgres databases.", - "version": "v0.11.0" + "version": "v1.0.0" }, "host": "localhost:3000", "consumes": [ diff --git a/api/apiv1/gen/http/openapi.yaml b/api/apiv1/gen/http/openapi.yaml index 3f5f26cf..a233c87d 100644 --- a/api/apiv1/gen/http/openapi.yaml +++ b/api/apiv1/gen/http/openapi.yaml @@ -2,7 +2,7 @@ swagger: "2.0" info: title: pgEdge Control Plane v1 API description: A distributed application that provides a declarative API to deploy and manage Postgres databases. - version: v0.11.0 + version: v1.0.0 host: localhost:3000 consumes: - application/json diff --git a/api/apiv1/gen/http/openapi3.json b/api/apiv1/gen/http/openapi3.json index 55854f2b..917826ab 100644 --- a/api/apiv1/gen/http/openapi3.json +++ b/api/apiv1/gen/http/openapi3.json @@ -3,7 +3,7 @@ "info": { "title": "pgEdge Control Plane v1 API", "description": "A distributed application that provides a declarative API to deploy and manage Postgres databases.", - "version": "v0.11.0" + "version": "v1.0.0" }, "servers": [ { diff --git a/api/apiv1/gen/http/openapi3.yaml b/api/apiv1/gen/http/openapi3.yaml index e5fd5df6..b6bcae01 100644 --- a/api/apiv1/gen/http/openapi3.yaml +++ b/api/apiv1/gen/http/openapi3.yaml @@ -2,7 +2,7 @@ openapi: 3.0.3 info: title: pgEdge Control Plane v1 API description: A distributed application that provides a declarative API to deploy and manage Postgres databases. - version: v0.11.0 + version: v1.0.0 servers: - url: http://localhost:3000 paths: diff --git a/api/version.txt b/api/version.txt index e88c34ff..60453e69 100644 --- a/api/version.txt +++ b/api/version.txt @@ -1 +1 @@ -v0.11.0 \ No newline at end of file +v1.0.0 \ No newline at end of file diff --git a/changes/unreleased/Added-20261009-000000.yaml b/changes/unreleased/Added-20261009-000000.yaml deleted file mode 100644 index 2126feb4..00000000 --- a/changes/unreleased/Added-20261009-000000.yaml +++ /dev/null @@ -1,3 +0,0 @@ -kind: Added -body: Added support for Spock 5.0.13 on Postgres 16.15, 17.11, and 18.6. -time: 2026-10-09T00:00:00.000000+00:00 diff --git a/changes/unreleased/Added-20261019-143344.yaml b/changes/unreleased/Added-20261019-143344.yaml deleted file mode 100644 index 3e852be7..00000000 --- a/changes/unreleased/Added-20261019-143344.yaml +++ /dev/null @@ -1,3 +0,0 @@ -kind: Added -body: Database updates can now repair a node that has no primary instance, and database deletes can now remove one. Previously, both operations failed with a `node has no primary instance` error. -time: 2026-10-19T14:33:44.000000+00:00 diff --git a/changes/unreleased/Added-20261027-000000.yaml b/changes/unreleased/Added-20261027-000000.yaml deleted file mode 100644 index 4d3c0767..00000000 --- a/changes/unreleased/Added-20261027-000000.yaml +++ /dev/null @@ -1,3 +0,0 @@ -kind: Added -body: Added a `locale` field to the database spec for setting the locale provider, locale, collation, and encoding used when the database is created. -time: 2026-10-27T00:00:00.000000+00:00 diff --git a/changes/unreleased/Added-20261104-000000.yaml b/changes/unreleased/Added-20261104-000000.yaml deleted file mode 100644 index 915d421c..00000000 --- a/changes/unreleased/Added-20261104-000000.yaml +++ /dev/null @@ -1,3 +0,0 @@ -kind: Added -body: Added support for PostgREST services on hosts that use the systemd orchestrator. Install the PostgREST package on each host that runs a PostgREST service. -time: 2026-11-04T00:00:00.000000+00:00 diff --git a/changes/unreleased/Added-20261111-000000.yaml b/changes/unreleased/Added-20261111-000000.yaml deleted file mode 100644 index 75e954aa..00000000 --- a/changes/unreleased/Added-20261111-000000.yaml +++ /dev/null @@ -1,3 +0,0 @@ -kind: Added -body: Added support for MCP services on hosts that use the systemd orchestrator. Install the pgedge-postgres-mcp package on each host that runs an MCP service. A knowledgebase file must be readable by the pgedge user. -time: 2026-11-11T00:00:00.000000+00:00 diff --git a/changes/unreleased/Added-20261112-000000.yaml b/changes/unreleased/Added-20261112-000000.yaml deleted file mode 100644 index 3a942f94..00000000 --- a/changes/unreleased/Added-20261112-000000.yaml +++ /dev/null @@ -1,3 +0,0 @@ -kind: Added -body: Added support for Spock 5.0.14 on Postgres 16.16, 17.12, and 18.7. Postgres 18.7 with Spock 5.0.14 is now the default. -time: 2026-11-12T00:00:00.000000+00:00 diff --git a/changes/unreleased/Added-20261117-000000.yaml b/changes/unreleased/Added-20261117-000000.yaml deleted file mode 100644 index 871db2f2..00000000 --- a/changes/unreleased/Added-20261117-000000.yaml +++ /dev/null @@ -1,3 +0,0 @@ -kind: Added -body: Added support for single-node databases without Spock to the systemd orchestrator. Postgres installations without Spock are now reported as supported versions, and databases created with those versions do not use Spock. -time: 2026-11-04T00:00:00.000000+00:00 diff --git a/changes/unreleased/Added-20261118-000000.yaml b/changes/unreleased/Added-20261118-000000.yaml deleted file mode 100644 index c59cc6d7..00000000 --- a/changes/unreleased/Added-20261118-000000.yaml +++ /dev/null @@ -1,3 +0,0 @@ -kind: Added -body: Added support for RAG services on hosts that use the systemd orchestrator. Install the pgedge-rag-server2 package on each host that runs a RAG service. The new systemd.rag_path setting selects the RAG server binary. -time: 2026-11-18T00:00:00.000000+00:00 diff --git a/changes/unreleased/Added-20261120-000000.yaml b/changes/unreleased/Added-20261120-000000.yaml deleted file mode 100644 index 829703cc..00000000 --- a/changes/unreleased/Added-20261120-000000.yaml +++ /dev/null @@ -1,3 +0,0 @@ -kind: Added -body: Added validation of `shared_preload_libraries` for hosts that use the systemd orchestrator. Each library must be installed in the library directory of the database's Postgres version on every host that runs it. Libraries are only validated on hosts that have reported their installed libraries, and path-style entries are not validated. -time: 2026-11-18T00:00:00.000000+00:00 diff --git a/changes/unreleased/Changed-20261022-095713.yaml b/changes/unreleased/Changed-20261022-095713.yaml deleted file mode 100644 index cf409932..00000000 --- a/changes/unreleased/Changed-20261022-095713.yaml +++ /dev/null @@ -1,3 +0,0 @@ -kind: Changed -body: Changed systemd orchestrator to find Postgres and Spock installations using `pg_config` rather than by matching specific package names. -time: 2026-10-22T09:57:13.951356-04:00 diff --git a/changes/unreleased/Changed-20261029-000000.yaml b/changes/unreleased/Changed-20261029-000000.yaml deleted file mode 100644 index 2c63f276..00000000 --- a/changes/unreleased/Changed-20261029-000000.yaml +++ /dev/null @@ -1,3 +0,0 @@ -kind: Changed -body: Renamed the `cluster_already_initialized` error returned by the init and join cluster endpoints to `host_already_in_cluster` with a clearer message. -time: 2026-10-29T00:00:00.000000+00:00 diff --git a/changes/unreleased/Changed-20261104-035716.yaml b/changes/unreleased/Changed-20261104-035716.yaml deleted file mode 100644 index cd058393..00000000 --- a/changes/unreleased/Changed-20261104-035716.yaml +++ /dev/null @@ -1,3 +0,0 @@ -kind: Changed -body: Database updates that remove the host running a node's current primary instance, while keeping the node, are now rejected with an error that asks you to perform a switchover first. Previously, the node could not accept writes until Patroni promoted a new primary. Hosts listed in `remove_host` are not affected. -time: 2026-11-04T03:57:16.000000+00:00 diff --git a/changes/unreleased/Changed-20261124-000000.yaml b/changes/unreleased/Changed-20261124-000000.yaml deleted file mode 100644 index f1c64e9f..00000000 --- a/changes/unreleased/Changed-20261124-000000.yaml +++ /dev/null @@ -1,3 +0,0 @@ -kind: Changed -body: The Spock 6 preview now uses Spock 6.0.0-beta2 images on Postgres 16.16, 17.12, and 18.7. Databases created on 6.0.0-beta1 images can still be updated, and moving one to beta2 now updates its Spock catalog automatically. -time: 2026-11-24T00:00:00.000000+00:00 diff --git a/changes/unreleased/Changed-20261125-000000.yaml b/changes/unreleased/Changed-20261125-000000.yaml deleted file mode 100644 index ac6d5436..00000000 --- a/changes/unreleased/Changed-20261125-000000.yaml +++ /dev/null @@ -1,3 +0,0 @@ -kind: Changed -body: PostgREST 14.18 and RAG 2.0.1 are now available and are the default versions for new PostgREST and RAG services. Existing services keep their current version. The Spock 5.0.14 images for Postgres 16.16, 17.12, and 18.7 now use a newer build. -time: 2026-11-25T00:00:00.000000+00:00 diff --git a/changes/unreleased/Fixed-20261022-105838.yaml b/changes/unreleased/Fixed-20261022-105838.yaml deleted file mode 100644 index 27bcf2d9..00000000 --- a/changes/unreleased/Fixed-20261022-105838.yaml +++ /dev/null @@ -1,3 +0,0 @@ -kind: Fixed -body: Fixed Patroni REST API requests failing with `403 Access is denied` on dual-stack hosts. The generated Patroni allowlist now includes the IPv4-mapped loopback address `::ffff:127.0.0.1`. -time: 2026-10-22T10:58:38.000000+00:00 diff --git a/changes/unreleased/Fixed-20261026-123220.yaml b/changes/unreleased/Fixed-20261026-123220.yaml deleted file mode 100644 index 746c41ac..00000000 --- a/changes/unreleased/Fixed-20261026-123220.yaml +++ /dev/null @@ -1,3 +0,0 @@ -kind: Fixed -body: Fixed etcd `log_level` overrides being saved to `generated.config.json` and staying in effect after the override was removed. Only the etcd server ports and client endpoints are now saved to the generated config. -time: 2026-10-26T12:32:20.000000+00:00 diff --git a/changes/unreleased/Fixed-20261026-155850.yaml b/changes/unreleased/Fixed-20261026-155850.yaml deleted file mode 100644 index 69dbe79a..00000000 --- a/changes/unreleased/Fixed-20261026-155850.yaml +++ /dev/null @@ -1,3 +0,0 @@ -kind: Fixed -body: Fixed node backups failing the primary instance check for a node with multiple instances when the first instance checked was not the primary. The check now looks at all of the node's instances, and the error message now says when a node has no available primary instance. -time: 2026-10-26T15:58:50.000000+00:00 diff --git a/changes/unreleased/Fixed-20261102-000000.yaml b/changes/unreleased/Fixed-20261102-000000.yaml deleted file mode 100644 index afc84129..00000000 --- a/changes/unreleased/Fixed-20261102-000000.yaml +++ /dev/null @@ -1,3 +0,0 @@ -kind: Fixed -body: Removing a host now updates the Patroni configuration of every modifiable database so that it no longer refers to the removed Etcd server. Databases that can't be modified at that time are updated on their next database update. -time: 2026-11-02T00:00:00.000000+00:00 diff --git a/changes/unreleased/Fixed-20261111-043159.yaml b/changes/unreleased/Fixed-20261111-043159.yaml deleted file mode 100644 index 85f984f5..00000000 --- a/changes/unreleased/Fixed-20261111-043159.yaml +++ /dev/null @@ -1,3 +0,0 @@ -kind: Fixed -body: Fixed database tasks failing with a misleading `pending futures` error when a resource change could not be queued, such as while a host was being removed. The task now waits for in-progress changes to finish and reports the underlying error. -time: 2026-11-11T04:31:59.000000+00:00 diff --git a/changes/unreleased/Fixed-20261117-000000.yaml b/changes/unreleased/Fixed-20261117-000000.yaml deleted file mode 100644 index 80677058..00000000 --- a/changes/unreleased/Fixed-20261117-000000.yaml +++ /dev/null @@ -1,3 +0,0 @@ -kind: Fixed -body: Fixed an issue where starting, restoring, or updating a database instance could fail because of an old failed task in the Docker Swarm task history. -time: 2026-11-17T00:00:00.000000+00:00 diff --git a/changes/unreleased/Fixed-20261119-000000.yaml b/changes/unreleased/Fixed-20261119-000000.yaml deleted file mode 100644 index 64f37843..00000000 --- a/changes/unreleased/Fixed-20261119-000000.yaml +++ /dev/null @@ -1,3 +0,0 @@ -kind: Fixed -body: Getting a host that doesn't exist now returns a 404 not_found error instead of a 500 server_error, and the error message no longer includes internal storage details. -time: 2026-11-19T00:00:00.000000+00:00 diff --git a/changes/unreleased/Fixed-20261119-120000.yaml b/changes/unreleased/Fixed-20261119-120000.yaml deleted file mode 100644 index ee551eab..00000000 --- a/changes/unreleased/Fixed-20261119-120000.yaml +++ /dev/null @@ -1,3 +0,0 @@ -kind: Fixed -body: Creating or updating a database with a node name that isn't "n" followed by a number, such as "n1-east", now returns a 400 error that names the node and the expected format, instead of a 500 server error. The same node name format is now enforced for the node names in backup, switchover, failover, and restore requests. -time: 2026-11-19T12:00:00.000000+00:00 diff --git a/changes/unreleased/Fixed-20261120-000000.yaml b/changes/unreleased/Fixed-20261120-000000.yaml deleted file mode 100644 index 3a5dd3d0..00000000 --- a/changes/unreleased/Fixed-20261120-000000.yaml +++ /dev/null @@ -1,3 +0,0 @@ -kind: Fixed -body: A scheduled switchover's task now stays running until the switchover happens, and canceling the task before the scheduled time cancels the switchover. Previously, the task completed as soon as the switchover was scheduled and could no longer be canceled. A scheduled switchover is now skipped if the primary changes before the scheduled time, it fails rather than running more than 5 minutes late, and it uses the node's current hosts at the scheduled time. Requesting a switchover or failover for a node that already has one in progress now returns a 409 operation_already_in_progress error instead of a 500 server error. -time: 2026-11-20T00:00:00.000000+00:00 diff --git a/changes/unreleased/Fixed-20261124-000000.yaml b/changes/unreleased/Fixed-20261124-000000.yaml deleted file mode 100644 index 70c62c9e..00000000 --- a/changes/unreleased/Fixed-20261124-000000.yaml +++ /dev/null @@ -1,3 +0,0 @@ -kind: Fixed -body: Replicas of Spock 6 databases on Postgres 17 or later now drop stale copies of Spock replication slots, including after a switchover or failover, so that native slot synchronization keeps their copies current. Creating or updating a replica no longer fails when its slot copies stay temporary, and an update doesn't switch over to a replica that lacks them. -time: 2026-11-24T00:00:01.000000+00:00 diff --git a/changes/unreleased/Security-20261029-202521.yaml b/changes/unreleased/Security-20261029-202521.yaml deleted file mode 100644 index 9e19bef3..00000000 --- a/changes/unreleased/Security-20261029-202521.yaml +++ /dev/null @@ -1,3 +0,0 @@ -kind: Security -body: Built the Control Plane with Go 1.26.10, which no longer trusts eight compromised eMudhra intermediate certificate authorities (CVE-2026-111943). -time: 2026-10-29T20:25:21.000000+00:00 diff --git a/changes/unreleased/Security-20261117-000000.yaml b/changes/unreleased/Security-20261117-000000.yaml deleted file mode 100644 index 4547ea89..00000000 --- a/changes/unreleased/Security-20261117-000000.yaml +++ /dev/null @@ -1,3 +0,0 @@ -kind: Security -body: Sensitive pgBackRest options, such as `cipher-pass`, in backup and restore repository `custom_options` are now excluded from API responses. Omitting these options from a database update preserves their stored values. -time: 2026-11-17T00:00:00.000000+00:00 diff --git a/changes/v1.0.0.md b/changes/v1.0.0.md new file mode 100644 index 00000000..89fff3c4 --- /dev/null +++ b/changes/v1.0.0.md @@ -0,0 +1,39 @@ +## v1.0.0 - 2026-11-25 + +### Added + +- Added support for Spock 5.0.13 on Postgres 16.15, 17.11, and 18.6. +- Database updates can now repair a node that has no primary instance, and database deletes can now remove one. Previously, both operations failed with a `node has no primary instance` error. +- Added a `locale` field to the database spec for setting the locale provider, locale, collation, and encoding used when the database is created. +- Added support for PostgREST services on hosts that use the systemd orchestrator. Install the PostgREST package on each host that runs a PostgREST service. +- Added support for single-node databases without Spock to the systemd orchestrator. Postgres installations without Spock are now reported as supported versions, and databases created with those versions do not use Spock. +- Added support for MCP services on hosts that use the systemd orchestrator. Install the pgedge-postgres-mcp package on each host that runs an MCP service. A knowledgebase file must be readable by the pgedge user. +- Added support for Spock 5.0.14 on Postgres 16.16, 17.12, and 18.7. Postgres 18.7 with Spock 5.0.14 is now the default. +- Added support for RAG services on hosts that use the systemd orchestrator. Install the pgedge-rag-server2 package on each host that runs a RAG service. The new systemd.rag_path setting selects the RAG server binary. +- Added validation of `shared_preload_libraries` for hosts that use the systemd orchestrator. Each library must be installed in the library directory of the database's Postgres version on every host that runs it. Libraries are only validated on hosts that have reported their installed libraries, and path-style entries are not validated. + +### Changed + +- Changed systemd orchestrator to find Postgres and Spock installations using `pg_config` rather than by matching specific package names. +- Renamed the `cluster_already_initialized` error returned by the init and join cluster endpoints to `host_already_in_cluster` with a clearer message. +- Database updates that remove the host running a node's current primary instance, while keeping the node, are now rejected with an error that asks you to perform a switchover first. Previously, the node could not accept writes until Patroni promoted a new primary. Hosts listed in `remove_host` are not affected. +- The Spock 6 preview now uses Spock 6.0.0-beta2 images on Postgres 16.16, 17.12, and 18.7. Databases created on 6.0.0-beta1 images can still be updated, and moving one to beta2 now updates its Spock catalog automatically. +- PostgREST 14.18 and RAG 2.0.1 are now available and are the default versions for new PostgREST and RAG services. Existing services keep their current version. The Spock 5.0.14 images for Postgres 16.16, 17.12, and 18.7 now use a newer build. + +### Fixed + +- Fixed Patroni REST API requests failing with `403 Access is denied` on dual-stack hosts. The generated Patroni allowlist now includes the IPv4-mapped loopback address `::ffff:127.0.0.1`. +- Fixed etcd `log_level` overrides being saved to `generated.config.json` and staying in effect after the override was removed. Only the etcd server ports and client endpoints are now saved to the generated config. +- Fixed node backups failing the primary instance check for a node with multiple instances when the first instance checked was not the primary. The check now looks at all of the node's instances, and the error message now says when a node has no available primary instance. +- Removing a host now updates the Patroni configuration of every modifiable database so that it no longer refers to the removed Etcd server. Databases that can't be modified at that time are updated on their next database update. +- Fixed database tasks failing with a misleading `pending futures` error when a resource change could not be queued, such as while a host was being removed. The task now waits for in-progress changes to finish and reports the underlying error. +- Fixed an issue where starting, restoring, or updating a database instance could fail because of an old failed task in the Docker Swarm task history. +- Getting a host that doesn't exist now returns a 404 not_found error instead of a 500 server_error, and the error message no longer includes internal storage details. +- Creating or updating a database with a node name that isn't "n" followed by a number, such as "n1-east", now returns a 400 error that names the node and the expected format, instead of a 500 server error. The same node name format is now enforced for the node names in backup, switchover, failover, and restore requests. +- A scheduled switchover's task now stays running until the switchover happens, and canceling the task before the scheduled time cancels the switchover. Previously, the task completed as soon as the switchover was scheduled and could no longer be canceled. A scheduled switchover is now skipped if the primary changes before the scheduled time, it fails rather than running more than 5 minutes late, and it uses the node's current hosts at the scheduled time. Requesting a switchover or failover for a node that already has one in progress now returns a 409 operation_already_in_progress error instead of a 500 server error. +- Replicas of Spock 6 databases on Postgres 17 or later now drop stale copies of Spock replication slots, including after a switchover or failover, so that native slot synchronization keeps their copies current. Creating or updating a replica no longer fails when its slot copies stay temporary, and an update doesn't switch over to a replica that lacks them. + +### Security + +- Built the Control Plane with Go 1.26.10, which no longer trusts eight compromised eMudhra intermediate certificate authorities (CVE-2026-111943). +- Sensitive pgBackRest options, such as `cipher-pass`, in backup and restore repository `custom_options` are now excluded from API responses. Omitting these options from a database update preserves their stored values. diff --git a/docs/api/openapi.md b/docs/api/openapi.md index d6bbee00..dbdc347f 100644 --- a/docs/api/openapi.md +++ b/docs/api/openapi.md @@ -7,7 +7,7 @@ The Control Plane server serves a JSON OpenAPI v3 specification from the You can also access offline copies of the OpenAPI specification in the pgEdge Control Plane repository. We generate a few versions of the specification to accommodate different tools and use cases: -- [OpenAPI v3 YAML](https://github.com/pgEdge/control-plane/blob/v0.11.0/api/apiv1/gen/http/openapi3.yaml) -- [OpenAPI v3 JSON](https://github.com/pgEdge/control-plane/blob/v0.11.0/api/apiv1/gen/http/openapi3.json) -- [OpenAPI v2 YAML](https://github.com/pgEdge/control-plane/blob/v0.11.0/api/apiv1/gen/http/openapi.yaml) -- [OpenAPI v2 JSON](https://github.com/pgEdge/control-plane/blob/v0.11.0/api/apiv1/gen/http/openapi.json) \ No newline at end of file +- [OpenAPI v3 YAML](https://github.com/pgEdge/control-plane/blob/v1.0.0/api/apiv1/gen/http/openapi3.yaml) +- [OpenAPI v3 JSON](https://github.com/pgEdge/control-plane/blob/v1.0.0/api/apiv1/gen/http/openapi3.json) +- [OpenAPI v2 YAML](https://github.com/pgEdge/control-plane/blob/v1.0.0/api/apiv1/gen/http/openapi.yaml) +- [OpenAPI v2 JSON](https://github.com/pgEdge/control-plane/blob/v1.0.0/api/apiv1/gen/http/openapi.json) \ No newline at end of file diff --git a/docs/api/reference.md b/docs/api/reference.md index 2cc18d5a..04069683 100644 --- a/docs/api/reference.md +++ b/docs/api/reference.md @@ -34,4 +34,4 @@ hide: - \ No newline at end of file + \ No newline at end of file diff --git a/docs/changelog.md b/docs/changelog.md index 555fe801..584a6733 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -1,5 +1,45 @@ # Changelog +## v1.0.0 - 2026-11-25 + +### Added + +- Added support for Spock 5.0.13 on Postgres 16.15, 17.11, and 18.6. +- Database updates can now repair a node that has no primary instance, and database deletes can now remove one. Previously, both operations failed with a `node has no primary instance` error. +- Added a `locale` field to the database spec for setting the locale provider, locale, collation, and encoding used when the database is created. +- Added support for PostgREST services on hosts that use the systemd orchestrator. Install the PostgREST package on each host that runs a PostgREST service. +- Added support for single-node databases without Spock to the systemd orchestrator. Postgres installations without Spock are now reported as supported versions, and databases created with those versions do not use Spock. +- Added support for MCP services on hosts that use the systemd orchestrator. Install the pgedge-postgres-mcp package on each host that runs an MCP service. A knowledgebase file must be readable by the pgedge user. +- Added support for Spock 5.0.14 on Postgres 16.16, 17.12, and 18.7. Postgres 18.7 with Spock 5.0.14 is now the default. +- Added support for RAG services on hosts that use the systemd orchestrator. Install the pgedge-rag-server2 package on each host that runs a RAG service. The new systemd.rag_path setting selects the RAG server binary. +- Added validation of `shared_preload_libraries` for hosts that use the systemd orchestrator. Each library must be installed in the library directory of the database's Postgres version on every host that runs it. Libraries are only validated on hosts that have reported their installed libraries, and path-style entries are not validated. + +### Changed + +- Changed systemd orchestrator to find Postgres and Spock installations using `pg_config` rather than by matching specific package names. +- Renamed the `cluster_already_initialized` error returned by the init and join cluster endpoints to `host_already_in_cluster` with a clearer message. +- Database updates that remove the host running a node's current primary instance, while keeping the node, are now rejected with an error that asks you to perform a switchover first. Previously, the node could not accept writes until Patroni promoted a new primary. Hosts listed in `remove_host` are not affected. +- The Spock 6 preview now uses Spock 6.0.0-beta2 images on Postgres 16.16, 17.12, and 18.7. Databases created on 6.0.0-beta1 images can still be updated, and moving one to beta2 now updates its Spock catalog automatically. +- PostgREST 14.18 and RAG 2.0.1 are now available and are the default versions for new PostgREST and RAG services. Existing services keep their current version. The Spock 5.0.14 images for Postgres 16.16, 17.12, and 18.7 now use a newer build. + +### Fixed + +- Fixed Patroni REST API requests failing with `403 Access is denied` on dual-stack hosts. The generated Patroni allowlist now includes the IPv4-mapped loopback address `::ffff:127.0.0.1`. +- Fixed etcd `log_level` overrides being saved to `generated.config.json` and staying in effect after the override was removed. Only the etcd server ports and client endpoints are now saved to the generated config. +- Fixed node backups failing the primary instance check for a node with multiple instances when the first instance checked was not the primary. The check now looks at all of the node's instances, and the error message now says when a node has no available primary instance. +- Removing a host now updates the Patroni configuration of every modifiable database so that it no longer refers to the removed Etcd server. Databases that can't be modified at that time are updated on their next database update. +- Fixed database tasks failing with a misleading `pending futures` error when a resource change could not be queued, such as while a host was being removed. The task now waits for in-progress changes to finish and reports the underlying error. +- Fixed an issue where starting, restoring, or updating a database instance could fail because of an old failed task in the Docker Swarm task history. +- Getting a host that doesn't exist now returns a 404 not_found error instead of a 500 server_error, and the error message no longer includes internal storage details. +- Creating or updating a database with a node name that isn't "n" followed by a number, such as "n1-east", now returns a 400 error that names the node and the expected format, instead of a 500 server error. The same node name format is now enforced for the node names in backup, switchover, failover, and restore requests. +- A scheduled switchover's task now stays running until the switchover happens, and canceling the task before the scheduled time cancels the switchover. Previously, the task completed as soon as the switchover was scheduled and could no longer be canceled. A scheduled switchover is now skipped if the primary changes before the scheduled time, it fails rather than running more than 5 minutes late, and it uses the node's current hosts at the scheduled time. Requesting a switchover or failover for a node that already has one in progress now returns a 409 operation_already_in_progress error instead of a 500 server error. +- Replicas of Spock 6 databases on Postgres 17 or later now drop stale copies of Spock replication slots, including after a switchover or failover, so that native slot synchronization keeps their copies current. Creating or updating a replica no longer fails when its slot copies stay temporary, and an update doesn't switch over to a replica that lacks them. + +### Security + +- Built the Control Plane with Go 1.26.10, which no longer trusts eight compromised eMudhra intermediate certificate authorities (CVE-2026-111943). +- Sensitive pgBackRest options, such as `cipher-pass`, in backup and restore repository `custom_options` are now excluded from API responses. Omitting these options from a database update preserves their stored values. + ## v0.11.0 - 2026-09-30 ### Added diff --git a/docs/development/e2e-tests.md b/docs/development/e2e-tests.md index 38407910..ce0a02df 100644 --- a/docs/development/e2e-tests.md +++ b/docs/development/e2e-tests.md @@ -525,7 +525,7 @@ specifying `FIXTURE_CONTROL_PLANE_IMAGE` with the `{deploy,update,reset}-{lima,ec2}-fixture` targets. For example: ```sh -make update-lima-fixture FIXTURE_CONTROL_PLANE_IMAGE='ghcr.io/pgedge/control-plane:v0.11.0-rc.1' +make update-lima-fixture FIXTURE_CONTROL_PLANE_IMAGE='ghcr.io/pgedge/control-plane:v1.0.0-rc.1' ``` ### Fixture variants diff --git a/docs/installation/mtls.md b/docs/installation/mtls.md index 1926563e..94bca090 100644 --- a/docs/installation/mtls.md +++ b/docs/installation/mtls.md @@ -65,7 +65,7 @@ For example, if you've placed the certificates in a `/opt/pgedge/control-plane` ```yaml services: host-1: - image: ghcr.io/pgedge/control-plane:v0.11.0 + image: ghcr.io/pgedge/control-plane:v1.0.0 command: run environment: - PGEDGE_HOST_ID=host-1 @@ -225,7 +225,7 @@ Now that our certificates are available on each machine, we can update our stack ```yaml services: host-1: - image: ghcr.io/pgedge/control-plane:v0.11.0 + image: ghcr.io/pgedge/control-plane:v1.0.0 command: run environment: - PGEDGE_HOST_ID=host-1 @@ -249,7 +249,7 @@ services: constraints: - node.id==81kw1zwmh9y8hk4rd7igylry0 host-2: - image: ghcr.io/pgedge/control-plane:v0.11.0 + image: ghcr.io/pgedge/control-plane:v1.0.0 command: run environment: - PGEDGE_HOST_ID=host-2 @@ -270,7 +270,7 @@ services: constraints: - node.id==xz7069ytbdq7uzd2tvrj2wlf2 host-3: - image: ghcr.io/pgedge/control-plane:v0.11.0 + image: ghcr.io/pgedge/control-plane:v1.0.0 command: run environment: - PGEDGE_HOST_ID=host-3 diff --git a/docs/installation/swarm-installation.md b/docs/installation/swarm-installation.md index 438d27db..b7d7fcbf 100644 --- a/docs/installation/swarm-installation.md +++ b/docs/installation/swarm-installation.md @@ -103,7 +103,7 @@ Given that output, the following stack definition file will deploy a single Cont ```yaml services: host-1: - image: ghcr.io/pgedge/control-plane:v0.11.0 + image: ghcr.io/pgedge/control-plane:v1.0.0 command: run environment: - PGEDGE_HOST_ID=host-1 @@ -118,7 +118,7 @@ services: constraints: - node.id==vzou89zyd4n3xz6p6jvoohqxx host-2: - image: ghcr.io/pgedge/control-plane:v0.11.0 + image: ghcr.io/pgedge/control-plane:v1.0.0 command: run environment: - PGEDGE_HOST_ID=host-2 @@ -133,7 +133,7 @@ services: constraints: - node.id==5sa7m11ub62t1n22feuhg0mbp host-3: - image: ghcr.io/pgedge/control-plane:v0.11.0 + image: ghcr.io/pgedge/control-plane:v1.0.0 command: run environment: - PGEDGE_HOST_ID=host-3 @@ -196,7 +196,7 @@ For example: ```yaml host-4: - image: ghcr.io/pgedge/control-plane:v0.11.0 + image: ghcr.io/pgedge/control-plane:v1.0.0 command: run environment: - PGEDGE_HOST_ID=host-4 @@ -232,7 +232,7 @@ Paste the output below and click "Generate Stack." This generator is fully local - + ``` yaml {#global-output} # Once submitted, the generated stack will appear here. @@ -261,7 +261,7 @@ mounted file: ```yaml services: control-plane-host-1: - image: ghcr.io/pgedge/control-plane:v0.11.0 + image: ghcr.io/pgedge/control-plane:v1.0.0 environment: - PGEDGE_DOCKER_SWARM__MANIFEST_PATH=/etc/pgedge/version-manifest.json volumes: diff --git a/docs/installation/swarm-upgrading.md b/docs/installation/swarm-upgrading.md index e6ac65ec..bfcda76c 100644 --- a/docs/installation/swarm-upgrading.md +++ b/docs/installation/swarm-upgrading.md @@ -5,11 +5,11 @@ Plane. The Control Plane version is specified in the image property of the [stac ```yaml services: host-1: - image: ghcr.io/pgedge/control-plane:v0.11.0 + image: ghcr.io/pgedge/control-plane:v1.0.0 ``` You can *pin* to a specific version by including a version in the `image` -fields in your service specification, such as `ghcr.io/pgedge/control-plane:v0.11.0`. +fields in your service specification, such as `ghcr.io/pgedge/control-plane:v1.0.0`. If you do not include a version, Docker will pull the `ghcr.io/pgedge/control-plane:latest` tag by default. From 387b82030e7c1dddde5626f531cbf4ea81a8546b Mon Sep 17 00:00:00 2001 From: Siva Date: Mon, 30 Nov 2026 18:50:49 +0530 Subject: [PATCH 2/5] docs: fix PostgREST schema cache reload steps (#522) --- docs/services/postgrest.md | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/docs/services/postgrest.md b/docs/services/postgrest.md index 65e2ca7a..8463294a 100644 --- a/docs/services/postgrest.md +++ b/docs/services/postgrest.md @@ -251,16 +251,32 @@ configuration change or restart needed. ## Schema Cache -PostgREST caches your database schema at startup. To expose a newly -added table or view without restarting the container, send a POST -request to the admin server: +PostgREST caches your database schema at startup. To expose a newly added +table or view without restarting the service, run the following `NOTIFY` +command to reload the schema cache: -```sh -curl -X POST http://host-1:3101/notify-reload +```sql +NOTIFY pgrst, 'reload schema'; +``` + +The `NOTIFY` command works with both the Docker Swarm and systemd +orchestrators. Run the command while connected to the database that +PostgREST serves; Postgres delivers notifications only within a single +database. Each PostgREST instance listens on the Postgres primary that the +instance connects to; this is usually the primary of the node on the same +host. Spock does not replicate notifications between nodes. In a multi-node +database, run the command on every primary that a PostgREST instance uses, +after the schema change has replicated to that node. To find those +primaries, run the following query on each node's primary: + +```sql +SELECT datname, client_addr, application_name +FROM pg_stat_activity +WHERE application_name ILIKE '%postgrest%' + AND datname = current_database(); ``` -The admin port is always one higher than your main PostgREST port -(`{port} + 1`). +The Control Plane does not expose the PostgREST admin server on the host. To trigger a full redeploy with a fresh schema cache, update the service spec (for example, change `db_schemas`) and submit an update From db6e9ba6b78b75966549f88f56737dc2a8e54af1 Mon Sep 17 00:00:00 2001 From: Moiz Ibrar Date: Tue, 1 Dec 2026 01:53:24 +0500 Subject: [PATCH 3/5] fix: report every uninstalled service clearly (#524) --- CHANGELOG.md | 1 + changes/v1.0.0.md | 1 + docs/changelog.md | 1 + e2e/rag_service_test.go | 2 +- e2e/service_provisioning_test.go | 4 +- server/internal/database/service.go | 31 ++++++++++++--- .../internal/database/spec_internal_test.go | 38 ++++++++++++++++++- 7 files changed, 68 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 584a6733..e1dc71e1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,6 +34,7 @@ - Creating or updating a database with a node name that isn't "n" followed by a number, such as "n1-east", now returns a 400 error that names the node and the expected format, instead of a 500 server error. The same node name format is now enforced for the node names in backup, switchover, failover, and restore requests. - A scheduled switchover's task now stays running until the switchover happens, and canceling the task before the scheduled time cancels the switchover. Previously, the task completed as soon as the switchover was scheduled and could no longer be canceled. A scheduled switchover is now skipped if the primary changes before the scheduled time, it fails rather than running more than 5 minutes late, and it uses the node's current hosts at the scheduled time. Requesting a switchover or failover for a node that already has one in progress now returns a 409 operation_already_in_progress error instead of a 500 server error. - Replicas of Spock 6 databases on Postgres 17 or later now drop stale copies of Spock replication slots, including after a switchover or failover, so that native slot synchronization keeps their copies current. Creating or updating a replica no longer fails when its slot copies stay temporary, and an update doesn't switch over to a replica that lacks them. +- Creating or updating a database now reports every invalid service in one error instead of only the first one. On hosts that use the systemd orchestrator, the error now says when a service isn't installed, for example `service 'postgrest' is not installed on host 'host-1'`. ### Security diff --git a/changes/v1.0.0.md b/changes/v1.0.0.md index 89fff3c4..08959cee 100644 --- a/changes/v1.0.0.md +++ b/changes/v1.0.0.md @@ -32,6 +32,7 @@ - Creating or updating a database with a node name that isn't "n" followed by a number, such as "n1-east", now returns a 400 error that names the node and the expected format, instead of a 500 server error. The same node name format is now enforced for the node names in backup, switchover, failover, and restore requests. - A scheduled switchover's task now stays running until the switchover happens, and canceling the task before the scheduled time cancels the switchover. Previously, the task completed as soon as the switchover was scheduled and could no longer be canceled. A scheduled switchover is now skipped if the primary changes before the scheduled time, it fails rather than running more than 5 minutes late, and it uses the node's current hosts at the scheduled time. Requesting a switchover or failover for a node that already has one in progress now returns a 409 operation_already_in_progress error instead of a 500 server error. - Replicas of Spock 6 databases on Postgres 17 or later now drop stale copies of Spock replication slots, including after a switchover or failover, so that native slot synchronization keeps their copies current. Creating or updating a replica no longer fails when its slot copies stay temporary, and an update doesn't switch over to a replica that lacks them. +- Creating or updating a database now reports every invalid service in one error instead of only the first one. On hosts that use the systemd orchestrator, the error now says when a service isn't installed, for example `service 'postgrest' is not installed on host 'host-1'`. ### Security diff --git a/docs/changelog.md b/docs/changelog.md index 584a6733..e1dc71e1 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -34,6 +34,7 @@ - Creating or updating a database with a node name that isn't "n" followed by a number, such as "n1-east", now returns a 400 error that names the node and the expected format, instead of a 500 server error. The same node name format is now enforced for the node names in backup, switchover, failover, and restore requests. - A scheduled switchover's task now stays running until the switchover happens, and canceling the task before the scheduled time cancels the switchover. Previously, the task completed as soon as the switchover was scheduled and could no longer be canceled. A scheduled switchover is now skipped if the primary changes before the scheduled time, it fails rather than running more than 5 minutes late, and it uses the node's current hosts at the scheduled time. Requesting a switchover or failover for a node that already has one in progress now returns a 409 operation_already_in_progress error instead of a 500 server error. - Replicas of Spock 6 databases on Postgres 17 or later now drop stale copies of Spock replication slots, including after a switchover or failover, so that native slot synchronization keeps their copies current. Creating or updating a replica no longer fails when its slot copies stay temporary, and an update doesn't switch over to a replica that lacks them. +- Creating or updating a database now reports every invalid service in one error instead of only the first one. On hosts that use the systemd orchestrator, the error now says when a service isn't installed, for example `service 'postgrest' is not installed on host 'host-1'`. ### Security diff --git a/e2e/rag_service_test.go b/e2e/rag_service_test.go index c0c684d5..dbfa4154 100644 --- a/e2e/rag_service_test.go +++ b/e2e/rag_service_test.go @@ -664,7 +664,7 @@ func TestProvisionRAGServiceUnsupportedVersion(t *testing.T) { require.Error(t, err, "CreateDatabase should reject an unsupported service version") assert.ErrorIs(t, err, client.ErrInvalidInput, "Error should be invalid input") assert.Nil(t, createResp, "CreateDatabase should not return a response") - assert.Contains(t, err.Error(), "does not support rag version 99.99.99", "Error should name the unsupported version") + assert.Contains(t, err.Error(), "99.99.99", "Error should name the unsupported version") t.Logf("CreateDatabase rejected as expected: %s", err) t.Log("RAG unsupported version test completed successfully") diff --git a/e2e/service_provisioning_test.go b/e2e/service_provisioning_test.go index a293c4e9..e9bc7b92 100644 --- a/e2e/service_provisioning_test.go +++ b/e2e/service_provisioning_test.go @@ -440,7 +440,7 @@ func TestProvisionMCPServiceUnsupportedVersion(t *testing.T) { require.Error(t, err, "CreateDatabase should reject an unsupported service version") assert.ErrorIs(t, err, client.ErrInvalidInput, "Error should be invalid input") assert.Nil(t, createResp, "CreateDatabase should not return a response") - assert.Contains(t, err.Error(), "does not support mcp version 99.99.99", "Error should name the unsupported version") + assert.Contains(t, err.Error(), "99.99.99", "Error should name the unsupported version") t.Logf("CreateDatabase rejected as expected: %s", err) @@ -556,7 +556,7 @@ func TestProvisionMCPServiceRecovery(t *testing.T) { }) require.Error(t, err, "UpdateDatabase should reject an unsupported service version") assert.ErrorIs(t, err, client.ErrInvalidInput, "Error should be invalid input") - assert.Contains(t, err.Error(), "does not support mcp version 99.99.99", "Error should name the unsupported version") + assert.Contains(t, err.Error(), "99.99.99", "Error should name the unsupported version") t.Logf("UpdateDatabase rejected as expected: %s", err) // The rejected update must not have been applied diff --git a/server/internal/database/service.go b/server/internal/database/service.go index a7d24176..39f805c2 100644 --- a/server/internal/database/service.go +++ b/server/internal/database/service.go @@ -665,19 +665,23 @@ func (s *Service) PopulateSpecDefaults(ctx context.Context, spec, current *Spec) } // validateServiceHosts validates that every service's host IDs refer to -// registered hosts that can run the requested service version. +// registered hosts that can run the requested service version. It returns +// every problem it finds, rather than only the first one. func validateServiceHosts(services []*ServiceSpec, hostsByID map[string]*host.Host) error { + var errs []error for _, svc := range services { var knownHosts []*host.Host for _, hostID := range svc.HostIDs { h, ok := hostsByID[hostID] if !ok { - return fmt.Errorf("service %q: host %s not found", svc.ServiceID, hostID) + errs = append(errs, fmt.Errorf("service %q: host %s not found", svc.ServiceID, hostID)) + continue } if h.Orchestrator == config.OrchestratorSystemD && svc.Port == nil { // systemd service instances listen on the host directly, so // they're unreachable without a port. - return fmt.Errorf("service %q: port is required for host %s, which uses the systemd orchestrator. set it to 0 to assign a random port", svc.ServiceID, h.ID) + errs = append(errs, fmt.Errorf("service %q: port is required for host %s, which uses the systemd orchestrator. set it to 0 to assign a random port", svc.ServiceID, h.ID)) + continue } if h.SupportedServices == nil { // This host's record was written by a Control Plane version @@ -690,7 +694,8 @@ func validateServiceHosts(services []*ServiceSpec, hostsByID map[string]*host.Ho continue } if !h.SupportsService(svc.ServiceType, svc.Version) { - return fmt.Errorf("service %q: host %s does not support %s version %s", svc.ServiceID, h.ID, svc.ServiceType, svc.Version) + errs = append(errs, unsupportedServiceError(svc, h)) + continue } knownHosts = append(knownHosts, h) } @@ -699,12 +704,26 @@ func validateServiceHosts(services []*ServiceSpec, hostsByID map[string]*host.Ho // hosts' defaults, but each host resolves it to its own default, // so they must agree for every instance to run the same version. if _, err := host.CommonDefaultServiceVersion(svc.ServiceType, knownHosts...); err != nil { - return fmt.Errorf("service %q: unable to resolve version %s: %w", svc.ServiceID, svc.Version, err) + errs = append(errs, fmt.Errorf("service %q: unable to resolve version %s: %w", svc.ServiceID, svc.Version, err)) } } } - return nil + return errors.Join(errs...) +} + +// unsupportedServiceError returns the error for a host that can't run the +// given service version. A systemd host only supports the version of each +// service that's installed on it, while a swarm host supports the versions in +// the version manifest. +func unsupportedServiceError(svc *ServiceSpec, h *host.Host) error { + if h.Orchestrator != config.OrchestratorSystemD { + return fmt.Errorf("service %q: host %s does not support %s version %s", svc.ServiceID, h.ID, svc.ServiceType, svc.Version) + } + if svc.Version == host.ServiceVersionLatest { + return fmt.Errorf("service '%s' is not installed on host '%s'", svc.ServiceType, h.ID) + } + return fmt.Errorf("service '%s' version '%s' is not installed on host '%s'", svc.ServiceType, svc.Version, h.ID) } func (s *Service) ReconcileInstanceSpec(ctx context.Context, spec *InstanceSpec) (*InstanceSpec, error) { diff --git a/server/internal/database/spec_internal_test.go b/server/internal/database/spec_internal_test.go index e63e6a8b..318c73f8 100644 --- a/server/internal/database/spec_internal_test.go +++ b/server/internal/database/spec_internal_test.go @@ -2,6 +2,7 @@ package database import ( "maps" + "strings" "testing" "github.com/stretchr/testify/assert" @@ -165,6 +166,12 @@ func TestValidateServiceHosts(t *testing.T) { SupportedServices: map[string][]string{"postgrest": {"14.5"}}, DefaultServiceVersions: map[string]string{"postgrest": "14.5"}, }, + "host-systemd-2": { + ID: "host-systemd-2", + Orchestrator: config.OrchestratorSystemD, + SupportedServices: map[string][]string{}, + DefaultServiceVersions: map[string]string{}, + }, } postgrest := func(version string, hostIDs ...string) *ServiceSpec { return &ServiceSpec{ @@ -219,7 +226,16 @@ func TestValidateServiceHosts(t *testing.T) { svc.OrchestratorOpts = &OrchestratorOpts{Swarm: &SwarmOpts{Image: "registry.example.com/postgrest:dev"}} return svc }(), - expectedErr: `service "api": host host-systemd does not support postgrest version 99.0`, + expectedErr: `service 'postgrest' version '99.0' is not installed on host 'host-systemd'`, + }, + { + name: "service not installed on a systemd host", + service: func() *ServiceSpec { + svc := postgrest("latest", "host-systemd-2") + svc.Port = utils.PointerTo(0) + return svc + }(), + expectedErr: `service 'postgrest' is not installed on host 'host-systemd-2'`, }, { name: "host without supported services is not validated", @@ -253,6 +269,26 @@ func TestValidateServiceHosts(t *testing.T) { } }) } + + t.Run("returns every error", func(t *testing.T) { + mcp := &ServiceSpec{ + ServiceID: "mcp-server", + ServiceType: "mcp", + Version: "latest", + HostIDs: []string{"host-systemd", "host-systemd-2"}, + Port: utils.PointerTo(0), + } + api := postgrest("latest", "host-systemd", "host-systemd-2", "host-5") + api.Port = utils.PointerTo(0) + + err := validateServiceHosts([]*ServiceSpec{api, mcp}, hostsByID) + assert.EqualError(t, err, strings.Join([]string{ + `service 'postgrest' is not installed on host 'host-systemd-2'`, + `service "api": host host-5 not found`, + `service 'mcp' is not installed on host 'host-systemd'`, + `service 'mcp' is not installed on host 'host-systemd-2'`, + }, "\n")) + }) } func TestValidateSpockRequirements(t *testing.T) { From 64a34ad9c11d322e4a7fdf6aa63511ca20258add Mon Sep 17 00:00:00 2001 From: Siva Date: Tue, 1 Dec 2026 12:29:11 +0530 Subject: [PATCH 4/5] feat: update spock 5.0.14 images to 5.0.15 (#526) --- CHANGELOG.md | 4 ++-- changes/v1.0.0.md | 4 ++-- docs/changelog.md | 4 ++-- server/internal/orchestrator/swarm/version-manifest.json | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e1dc71e1..e35a846e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,7 @@ - Added support for PostgREST services on hosts that use the systemd orchestrator. Install the PostgREST package on each host that runs a PostgREST service. - Added support for single-node databases without Spock to the systemd orchestrator. Postgres installations without Spock are now reported as supported versions, and databases created with those versions do not use Spock. - Added support for MCP services on hosts that use the systemd orchestrator. Install the pgedge-postgres-mcp package on each host that runs an MCP service. A knowledgebase file must be readable by the pgedge user. -- Added support for Spock 5.0.14 on Postgres 16.16, 17.12, and 18.7. Postgres 18.7 with Spock 5.0.14 is now the default. +- Added support for Spock 5.0.15 on Postgres 16.16, 17.12, and 18.7. Postgres 18.7 with Spock 5.0.15 is now the default. - Added support for RAG services on hosts that use the systemd orchestrator. Install the pgedge-rag-server2 package on each host that runs a RAG service. The new systemd.rag_path setting selects the RAG server binary. - Added validation of `shared_preload_libraries` for hosts that use the systemd orchestrator. Each library must be installed in the library directory of the database's Postgres version on every host that runs it. Libraries are only validated on hosts that have reported their installed libraries, and path-style entries are not validated. @@ -20,7 +20,7 @@ - Renamed the `cluster_already_initialized` error returned by the init and join cluster endpoints to `host_already_in_cluster` with a clearer message. - Database updates that remove the host running a node's current primary instance, while keeping the node, are now rejected with an error that asks you to perform a switchover first. Previously, the node could not accept writes until Patroni promoted a new primary. Hosts listed in `remove_host` are not affected. - The Spock 6 preview now uses Spock 6.0.0-beta2 images on Postgres 16.16, 17.12, and 18.7. Databases created on 6.0.0-beta1 images can still be updated, and moving one to beta2 now updates its Spock catalog automatically. -- PostgREST 14.18 and RAG 2.0.1 are now available and are the default versions for new PostgREST and RAG services. Existing services keep their current version. The Spock 5.0.14 images for Postgres 16.16, 17.12, and 18.7 now use a newer build. +- PostgREST 14.18 and RAG 2.0.1 are now available and are the default versions for new PostgREST and RAG services. Existing services keep their current version. ### Fixed diff --git a/changes/v1.0.0.md b/changes/v1.0.0.md index 08959cee..9bcc3ec0 100644 --- a/changes/v1.0.0.md +++ b/changes/v1.0.0.md @@ -8,7 +8,7 @@ - Added support for PostgREST services on hosts that use the systemd orchestrator. Install the PostgREST package on each host that runs a PostgREST service. - Added support for single-node databases without Spock to the systemd orchestrator. Postgres installations without Spock are now reported as supported versions, and databases created with those versions do not use Spock. - Added support for MCP services on hosts that use the systemd orchestrator. Install the pgedge-postgres-mcp package on each host that runs an MCP service. A knowledgebase file must be readable by the pgedge user. -- Added support for Spock 5.0.14 on Postgres 16.16, 17.12, and 18.7. Postgres 18.7 with Spock 5.0.14 is now the default. +- Added support for Spock 5.0.15 on Postgres 16.16, 17.12, and 18.7. Postgres 18.7 with Spock 5.0.15 is now the default. - Added support for RAG services on hosts that use the systemd orchestrator. Install the pgedge-rag-server2 package on each host that runs a RAG service. The new systemd.rag_path setting selects the RAG server binary. - Added validation of `shared_preload_libraries` for hosts that use the systemd orchestrator. Each library must be installed in the library directory of the database's Postgres version on every host that runs it. Libraries are only validated on hosts that have reported their installed libraries, and path-style entries are not validated. @@ -18,7 +18,7 @@ - Renamed the `cluster_already_initialized` error returned by the init and join cluster endpoints to `host_already_in_cluster` with a clearer message. - Database updates that remove the host running a node's current primary instance, while keeping the node, are now rejected with an error that asks you to perform a switchover first. Previously, the node could not accept writes until Patroni promoted a new primary. Hosts listed in `remove_host` are not affected. - The Spock 6 preview now uses Spock 6.0.0-beta2 images on Postgres 16.16, 17.12, and 18.7. Databases created on 6.0.0-beta1 images can still be updated, and moving one to beta2 now updates its Spock catalog automatically. -- PostgREST 14.18 and RAG 2.0.1 are now available and are the default versions for new PostgREST and RAG services. Existing services keep their current version. The Spock 5.0.14 images for Postgres 16.16, 17.12, and 18.7 now use a newer build. +- PostgREST 14.18 and RAG 2.0.1 are now available and are the default versions for new PostgREST and RAG services. Existing services keep their current version. ### Fixed diff --git a/docs/changelog.md b/docs/changelog.md index e1dc71e1..e35a846e 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -10,7 +10,7 @@ - Added support for PostgREST services on hosts that use the systemd orchestrator. Install the PostgREST package on each host that runs a PostgREST service. - Added support for single-node databases without Spock to the systemd orchestrator. Postgres installations without Spock are now reported as supported versions, and databases created with those versions do not use Spock. - Added support for MCP services on hosts that use the systemd orchestrator. Install the pgedge-postgres-mcp package on each host that runs an MCP service. A knowledgebase file must be readable by the pgedge user. -- Added support for Spock 5.0.14 on Postgres 16.16, 17.12, and 18.7. Postgres 18.7 with Spock 5.0.14 is now the default. +- Added support for Spock 5.0.15 on Postgres 16.16, 17.12, and 18.7. Postgres 18.7 with Spock 5.0.15 is now the default. - Added support for RAG services on hosts that use the systemd orchestrator. Install the pgedge-rag-server2 package on each host that runs a RAG service. The new systemd.rag_path setting selects the RAG server binary. - Added validation of `shared_preload_libraries` for hosts that use the systemd orchestrator. Each library must be installed in the library directory of the database's Postgres version on every host that runs it. Libraries are only validated on hosts that have reported their installed libraries, and path-style entries are not validated. @@ -20,7 +20,7 @@ - Renamed the `cluster_already_initialized` error returned by the init and join cluster endpoints to `host_already_in_cluster` with a clearer message. - Database updates that remove the host running a node's current primary instance, while keeping the node, are now rejected with an error that asks you to perform a switchover first. Previously, the node could not accept writes until Patroni promoted a new primary. Hosts listed in `remove_host` are not affected. - The Spock 6 preview now uses Spock 6.0.0-beta2 images on Postgres 16.16, 17.12, and 18.7. Databases created on 6.0.0-beta1 images can still be updated, and moving one to beta2 now updates its Spock catalog automatically. -- PostgREST 14.18 and RAG 2.0.1 are now available and are the default versions for new PostgREST and RAG services. Existing services keep their current version. The Spock 5.0.14 images for Postgres 16.16, 17.12, and 18.7 now use a newer build. +- PostgREST 14.18 and RAG 2.0.1 are now available and are the default versions for new PostgREST and RAG services. Existing services keep their current version. ### Fixed diff --git a/server/internal/orchestrator/swarm/version-manifest.json b/server/internal/orchestrator/swarm/version-manifest.json index 5feae6c9..dc996c88 100644 --- a/server/internal/orchestrator/swarm/version-manifest.json +++ b/server/internal/orchestrator/swarm/version-manifest.json @@ -41,7 +41,7 @@ { "postgres_version": "16.16", "spock_version": "5", - "image": "pgedge-postgres:16.16-spock5.0.14-standard-2", + "image": "pgedge-postgres:16.16-spock5.0.15-standard-1", "stability": "stable" }, { @@ -83,7 +83,7 @@ { "postgres_version": "17.12", "spock_version": "5", - "image": "pgedge-postgres:17.12-spock5.0.14-standard-2", + "image": "pgedge-postgres:17.12-spock5.0.15-standard-1", "stability": "stable" }, { @@ -125,7 +125,7 @@ { "postgres_version": "18.7", "spock_version": "5", - "image": "pgedge-postgres:18.7-spock5.0.14-standard-2", + "image": "pgedge-postgres:18.7-spock5.0.15-standard-1", "stability": "stable", "default": true }, From d08c3604e8e279f6b39c37f0c207af2d7cfc1d3f Mon Sep 17 00:00:00 2001 From: Muhammad Aqeel Date: Wed, 2 Dec 2026 01:37:29 +0500 Subject: [PATCH 5/5] chore: use certificates for the pgEdge repositories (#496) Updates the systemd dev environment and E2E fixtures to use a client certificate to authenticate with the pgEdge Enterprise Postgres package repositories. --------- Co-authored-by: Jason Lynch --- .circleci/config.yml | 15 ++- .devcontainer/walkthrough/post-create.sh | 23 ++++- Makefile | 27 +++++- .../debian-13-community/docker-compose.yaml | 8 +- .../debian-13/Dockerfile | 50 +++++++--- .../debian-13/docker-compose.yaml | 50 +++------- .../debian-13/host-1.config.json | 7 -- .../debian-13/host-2.config.json | 7 -- .../debian-13/host-3.config.json | 7 -- .../rocky-9-community/docker-compose.yaml | 8 +- .../rocky-9/Dockerfile | 46 +++++++--- .../rocky-9/docker-compose.yaml | 52 +++-------- .../rocky-9/host-1.config.json | 7 -- .../rocky-9/host-2.config.json | 7 -- .../rocky-9/host-3.config.json | 7 -- docs/development/running-locally.md | 26 ++++++ docs/walkthrough.md | 15 +++ ...temd-debian-13-community.test_config.yaml} | 6 +- ...docker-systemd-debian-13.test_config.yaml} | 6 +- ...ystemd-rocky-9-community.test_config.yaml} | 6 +- ...> docker-systemd-rocky-9.test_config.yaml} | 6 +- .../defaults/main.yaml | 7 ++ .../tasks/main.yaml | 92 ++++++++++++++++--- .../vars/main.yaml | 3 + lima/roles/deb_prerequisites/tasks/main.yaml | 50 +++++++++- lima/roles/rhel_prerequisites/tasks/main.yaml | 58 +++++++++++- lima/vars.yaml | 8 ++ 27 files changed, 416 insertions(+), 188 deletions(-) delete mode 100644 docker/control-plane-systemd-ci/debian-13/host-1.config.json delete mode 100644 docker/control-plane-systemd-ci/debian-13/host-2.config.json delete mode 100644 docker/control-plane-systemd-ci/debian-13/host-3.config.json delete mode 100644 docker/control-plane-systemd-ci/rocky-9/host-1.config.json delete mode 100644 docker/control-plane-systemd-ci/rocky-9/host-2.config.json delete mode 100644 docker/control-plane-systemd-ci/rocky-9/host-3.config.json rename e2e/fixtures/outputs/{docker-systemd-debian13-community.test_config.yaml => docker-systemd-debian-13-community.test_config.yaml} (51%) rename e2e/fixtures/outputs/{docker-systemd-debian13.test_config.yaml => docker-systemd-debian-13.test_config.yaml} (50%) rename e2e/fixtures/outputs/{docker-systemd-rocky9-community.test_config.yaml => docker-systemd-rocky-9-community.test_config.yaml} (51%) rename e2e/fixtures/outputs/{docker-systemd-rocky9.test_config.yaml => docker-systemd-rocky-9.test_config.yaml} (51%) diff --git a/.circleci/config.yml b/.circleci/config.yml index e07b615a..111d7545 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -170,16 +170,23 @@ jobs: type: string steps: - common_setup + - run: + name: Write pgEdge repository client credentials + command: | + mkdir -p ~/.pgedge + chmod 700 ~/.pgedge + ( + umask 077 + printf '%s' "${PGEDGE_CLIENT_KEY:?PGEDGE_CLIENT_KEY must be set}" | base64 -d > ~/.pgedge/client.key + printf '%s' "${PGEDGE_CLIENT_CRT:?PGEDGE_CLIENT_CRT must be set}" | base64 -d > ~/.pgedge/client.crt + ) - run: name: Start << parameters.systemd_os >> systemd cluster command: make ci-systemd-up SYSTEMD_OS=<< parameters.systemd_os >> - run: name: Run << parameters.systemd_os >> systemd E2E tests command: | - # The fixture names drop the hyphen before the OS version, e.g. - # rocky-9-community -> docker-systemd-rocky9-community. - fixture="docker-systemd-$(echo '<< parameters.systemd_os >>' | sed -E 's/^([a-z]+)-([0-9]+)/\1\2/')" - make test-e2e E2E_FIXTURE="${fixture}" E2E_DEBUG=1 TEST_RERUN_FAILS=2 + make test-e2e E2E_FIXTURE='docker-systemd-<< parameters.systemd_os >>' E2E_DEBUG=1 TEST_RERUN_FAILS=2 - run: name: Archive debug output command: | diff --git a/.devcontainer/walkthrough/post-create.sh b/.devcontainer/walkthrough/post-create.sh index ec887000..ae9e7390 100755 --- a/.devcontainer/walkthrough/post-create.sh +++ b/.devcontainer/walkthrough/post-create.sh @@ -3,11 +3,30 @@ set -euo pipefail echo "=== pgEdge Control Plane Walkthrough — Codespaces Setup ===" -# Add the pgEdge repository +# Add the pgEdge repository. downloads.pgedge.com, not apt.pgedge.com: the +# gated repository cannot serve the package that configures access to it. echo "Adding pgEdge apt repository..." -sudo curl -sSL https://apt.pgedge.com/repodeb/pgedge-release_latest_all.deb -o /tmp/pgedge-release.deb +sudo curl -sSL https://downloads.pgedge.com/repodeb/pgedge-release_latest_all.deb -o /tmp/pgedge-release.deb sudo dpkg -i /tmp/pgedge-release.deb +# The repository ships disabled and authenticates clients with mutual TLS. +# Supply PGEDGE_CLIENT_CERT and PGEDGE_CLIENT_KEY (PEM contents) to use it. +if [ -n "${PGEDGE_CLIENT_CERT:-}" ] && [ -n "${PGEDGE_CLIENT_KEY:-}" ]; then + echo "Installing the pgEdge client certificate..." + sudo install -d -m 0755 /etc/pgedge + # Create the key empty at 0600 first: writing it and then chmod'ing would + # leave it world-readable for the interval in between. + sudo install -m 0600 /dev/null /etc/pgedge/client.key + sudo install -m 0644 /dev/null /etc/pgedge/client.crt + printf '%s\n' "$PGEDGE_CLIENT_CERT" | sudo tee /etc/pgedge/client.crt >/dev/null + printf '%s\n' "$PGEDGE_CLIENT_KEY" | sudo tee /etc/pgedge/client.key >/dev/null + sudo pgedge-subscription-manager install \ + /etc/pgedge/client.crt /etc/pgedge/client.key --force +else + echo "WARNING: PGEDGE_CLIENT_CERT / PGEDGE_CLIENT_KEY are not set." + echo " The pgEdge repository stays disabled and the install below will fail." +fi + # Install jq and the Postgres client echo "Installing jq and pgEdge Postgres client..." sudo apt-get update -qq diff --git a/Makefile b/Makefile index a62476df..466f6cf6 100644 --- a/Makefile +++ b/Makefile @@ -138,9 +138,9 @@ e2e-help: @echo "" @echo " E2E variables:" @echo " E2E_FIXTURE Fixture name (lima, ec2, ec2-systemd, lima-systemd," - @echo " docker-systemd-rocky9, docker-systemd-debian13," - @echo " docker-systemd-rocky9-community," - @echo " docker-systemd-debian13-community)" + @echo " docker-systemd-rocky-9, docker-systemd-debian-13," + @echo " docker-systemd-rocky-9-community," + @echo " docker-systemd-debian-13-community)" @echo " E2E_RUN Test name regex filter" @echo " E2E_PARALLEL Parallelism (default: 4)" @echo " E2E_DEBUG=1 Print debug output for failing tests" @@ -663,3 +663,24 @@ ci-systemd-down: docs: docker build -t control-plane-docs ./docs docker run --rm -it -p 8000:8000 -v ${PWD}:/docs control-plane-docs + +################################### +# pgEdge repo key # +################################### + +repo_key_dir=$(HOME)/.pgedge +repo_key=$(repo_key_dir)/client.key +repo_csr=$(repo_key_dir)/client.csr +repo_crt=$(repo_key_dir)/client.crt + +$(repo_key_dir): + mkdir $(repo_key_dir) + +$(repo_key): $(repo_key_dir) + openssl genrsa -out $(repo_key) 2048 + +$(repo_csr): $(repo_key) + openssl req -new -key $(repo_key) -out $(repo_csr) -subj "/CN=$(shell hostname)" + +.PHONY: pgedge-repo-csr +pgedge-repo-csr: $(repo_csr) diff --git a/docker/control-plane-systemd-ci/debian-13-community/docker-compose.yaml b/docker/control-plane-systemd-ci/debian-13-community/docker-compose.yaml index f91478d7..80b4de04 100644 --- a/docker/control-plane-systemd-ci/debian-13-community/docker-compose.yaml +++ b/docker/control-plane-systemd-ci/debian-13-community/docker-compose.yaml @@ -8,7 +8,7 @@ # IP on the compose network. # # make ci-systemd-up SYSTEMD_OS=debian-13-community -# make test-e2e E2E_FIXTURE=docker-systemd-debian13-community +# make test-e2e E2E_FIXTURE=docker-systemd-debian-13-community # make ci-systemd-down SYSTEMD_OS=debian-13-community name: cp-systemd-debian-13-community @@ -34,21 +34,21 @@ x-host: &host services: host-1: <<: *host - container_name: cp-debian13-community-host-1 + container_name: cp-debian-13-community-host-1 hostname: host-1 ports: - "127.0.0.1:3030:3000" host-2: <<: *host - container_name: cp-debian13-community-host-2 + container_name: cp-debian-13-community-host-2 hostname: host-2 ports: - "127.0.0.1:3031:3000" host-3: <<: *host - container_name: cp-debian13-community-host-3 + container_name: cp-debian-13-community-host-3 hostname: host-3 ports: - "127.0.0.1:3032:3000" diff --git a/docker/control-plane-systemd-ci/debian-13/Dockerfile b/docker/control-plane-systemd-ci/debian-13/Dockerfile index 66553b18..a99a735e 100644 --- a/docker/control-plane-systemd-ci/debian-13/Dockerfile +++ b/docker/control-plane-systemd-ci/debian-13/Dockerfile @@ -21,21 +21,41 @@ RUN apt-get update && \ # pgEdge prerequisites from the release repo, so CI tests certified builds. # The RAG server package enables its own unit, which would listen on port # 8080 at boot. The Control Plane runs its own RAG units, so disable it. -RUN curl -fsSL --retry 5 https://apt.pgedge.com/repodeb/pgedge-release_latest_all.deb \ - -o /tmp/pgedge-release.deb && \ - dpkg -i /tmp/pgedge-release.deb && \ - rm /tmp/pgedge-release.deb && \ - apt-get update -o Acquire::Retries=5 && \ - apt-get install -y -o Acquire::Retries=5 \ - pgedge-postgresql-18 \ - pgedge-postgresql-18-spock50 \ - pgedge-pgbackrest \ - pgedge-patroni \ - pgedge-postgrest \ - pgedge-postgres-mcp \ - pgedge-rag-server2 && \ - rm -f /etc/systemd/system/multi-user.target.wants/pgedge-rag-server2.service && \ - rm -rf /var/lib/apt/lists/* +RUN --mount=type=secret,id=repo_client_crt \ + --mount=type=secret,id=repo_client_key \ + < [Runme extension](https://marketplace.visualstudio.com/items?itemName=stateful.runme) > in VS Code and click **Execute Cell** on each block. +> [!IMPORTANT] +> **The pgEdge package repository needs a client certificate** +> Before creating the Codespace, add `PGEDGE_CLIENT_CERT` and +> `PGEDGE_CLIENT_KEY` as *account-level* Codespaces secrets -- under your own +> [Codespaces settings](https://github.com/settings/codespaces), granting this +> repository access to each -- holding the PEM contents of your client +> certificate and its matching key. Account-level secrets need no write access +> to this repository, so there is no need to fork it; they reach the setup +> script because it runs as `postCreateCommand`, after the Codespace is up. +> The certificate must be the full chain -- your leaf certificate first, +> followed by the issuing intermediate -- because the leaf alone cannot +> authenticate. The +> repositories authenticate clients with mutual TLS, so without both secrets +> the setup leaves them disabled and the Postgres client will not install. + ## Prerequisites - [Docker Engine](https://docs.docker.com/engine/install/) (Linux) or [Docker Desktop](https://docs.docker.com/desktop/) (macOS) diff --git a/e2e/fixtures/outputs/docker-systemd-debian13-community.test_config.yaml b/e2e/fixtures/outputs/docker-systemd-debian-13-community.test_config.yaml similarity index 51% rename from e2e/fixtures/outputs/docker-systemd-debian13-community.test_config.yaml rename to e2e/fixtures/outputs/docker-systemd-debian-13-community.test_config.yaml index 9a216ce6..269af7ba 100644 --- a/e2e/fixtures/outputs/docker-systemd-debian13-community.test_config.yaml +++ b/e2e/fixtures/outputs/docker-systemd-debian-13-community.test_config.yaml @@ -3,13 +3,13 @@ hosts: host-1: external_ip: 127.0.0.1 port: 3030 - ssh_command: docker exec cp-debian13-community-host-1 sh -c + ssh_command: docker exec cp-debian-13-community-host-1 sh -c host-2: external_ip: 127.0.0.1 port: 3031 - ssh_command: docker exec cp-debian13-community-host-2 sh -c + ssh_command: docker exec cp-debian-13-community-host-2 sh -c host-3: external_ip: 127.0.0.1 port: 3032 - ssh_command: docker exec cp-debian13-community-host-3 sh -c + ssh_command: docker exec cp-debian-13-community-host-3 sh -c service_packages_not_installed: true diff --git a/e2e/fixtures/outputs/docker-systemd-debian13.test_config.yaml b/e2e/fixtures/outputs/docker-systemd-debian-13.test_config.yaml similarity index 50% rename from e2e/fixtures/outputs/docker-systemd-debian13.test_config.yaml rename to e2e/fixtures/outputs/docker-systemd-debian-13.test_config.yaml index 7a282d14..05ac9c7b 100644 --- a/e2e/fixtures/outputs/docker-systemd-debian13.test_config.yaml +++ b/e2e/fixtures/outputs/docker-systemd-debian-13.test_config.yaml @@ -3,12 +3,12 @@ hosts: host-1: external_ip: 127.0.0.1 port: 3010 - ssh_command: docker exec cp-debian13-host-1 sh -c + ssh_command: docker exec cp-debian-13-host-1 sh -c host-2: external_ip: 127.0.0.1 port: 3011 - ssh_command: docker exec cp-debian13-host-2 sh -c + ssh_command: docker exec cp-debian-13-host-2 sh -c host-3: external_ip: 127.0.0.1 port: 3012 - ssh_command: docker exec cp-debian13-host-3 sh -c + ssh_command: docker exec cp-debian-13-host-3 sh -c diff --git a/e2e/fixtures/outputs/docker-systemd-rocky9-community.test_config.yaml b/e2e/fixtures/outputs/docker-systemd-rocky-9-community.test_config.yaml similarity index 51% rename from e2e/fixtures/outputs/docker-systemd-rocky9-community.test_config.yaml rename to e2e/fixtures/outputs/docker-systemd-rocky-9-community.test_config.yaml index a65a62e5..d6aa6ddc 100644 --- a/e2e/fixtures/outputs/docker-systemd-rocky9-community.test_config.yaml +++ b/e2e/fixtures/outputs/docker-systemd-rocky-9-community.test_config.yaml @@ -3,13 +3,13 @@ hosts: host-1: external_ip: 127.0.0.1 port: 3020 - ssh_command: docker exec cp-rocky9-community-host-1 sh -c + ssh_command: docker exec cp-rocky-9-community-host-1 sh -c host-2: external_ip: 127.0.0.1 port: 3021 - ssh_command: docker exec cp-rocky9-community-host-2 sh -c + ssh_command: docker exec cp-rocky-9-community-host-2 sh -c host-3: external_ip: 127.0.0.1 port: 3022 - ssh_command: docker exec cp-rocky9-community-host-3 sh -c + ssh_command: docker exec cp-rocky-9-community-host-3 sh -c service_packages_not_installed: true diff --git a/e2e/fixtures/outputs/docker-systemd-rocky9.test_config.yaml b/e2e/fixtures/outputs/docker-systemd-rocky-9.test_config.yaml similarity index 51% rename from e2e/fixtures/outputs/docker-systemd-rocky9.test_config.yaml rename to e2e/fixtures/outputs/docker-systemd-rocky-9.test_config.yaml index 565bf68a..b76ff397 100644 --- a/e2e/fixtures/outputs/docker-systemd-rocky9.test_config.yaml +++ b/e2e/fixtures/outputs/docker-systemd-rocky-9.test_config.yaml @@ -3,12 +3,12 @@ hosts: host-1: external_ip: 127.0.0.1 port: 3000 - ssh_command: docker exec cp-rocky9-host-1 sh -c + ssh_command: docker exec cp-rocky-9-host-1 sh -c host-2: external_ip: 127.0.0.1 port: 3001 - ssh_command: docker exec cp-rocky9-host-2 sh -c + ssh_command: docker exec cp-rocky-9-host-2 sh -c host-3: external_ip: 127.0.0.1 port: 3002 - ssh_command: docker exec cp-rocky9-host-3 sh -c + ssh_command: docker exec cp-rocky-9-host-3 sh -c diff --git a/e2e/fixtures/roles/install_systemd_prerequisites/defaults/main.yaml b/e2e/fixtures/roles/install_systemd_prerequisites/defaults/main.yaml index ae6dcac9..c8223fd8 100644 --- a/e2e/fixtures/roles/install_systemd_prerequisites/defaults/main.yaml +++ b/e2e/fixtures/roles/install_systemd_prerequisites/defaults/main.yaml @@ -1,2 +1,9 @@ --- cp_source: staging +# Client certificate for the gated pgEdge repositories. Read from files on the +# controller rather than passed on the command line, so the PEM never lands in +# argv. Override the paths with PGEDGE_CLIENT_CERT_FILE / PGEDGE_CLIENT_KEY_FILE. +pgedge_client_cert_file: "{{ lookup('env', 'PGEDGE_CLIENT_CERT_FILE') | default('~/.pgedge/client.crt', true) }}" +pgedge_client_key_file: "{{ lookup('env', 'PGEDGE_CLIENT_KEY_FILE') | default('~/.pgedge/client.key', true) }}" +pgedge_client_cert: "{{ lookup('file', pgedge_client_cert_file | expanduser, errors='ignore') | default('', true) }}" +pgedge_client_key: "{{ lookup('file', pgedge_client_key_file | expanduser, errors='ignore') | default('', true) }}" diff --git a/e2e/fixtures/roles/install_systemd_prerequisites/tasks/main.yaml b/e2e/fixtures/roles/install_systemd_prerequisites/tasks/main.yaml index 1b84731c..abb01dc3 100644 --- a/e2e/fixtures/roles/install_systemd_prerequisites/tasks/main.yaml +++ b/e2e/fixtures/roles/install_systemd_prerequisites/tasks/main.yaml @@ -8,9 +8,21 @@ when: ansible_os_family == 'RedHat' changed_when: true +# Imported explicitly rather than left to dnf's auto-import from the repo's +# gpgkey=. The RPM and DEB repositories are signed with different keys, so this +# is keys/dnf specifically. +- name: Install the pgEdge package signing key (RPM) + ansible.builtin.rpm_key: + key: https://downloads.pgedge.com/keys/dnf/pgedge-rsa.pub + state: present + when: ansible_os_family == 'RedHat' + +# downloads.pgedge.com, not dnf.pgedge.com: the gated repository cannot serve +# the package that configures access to it. The repo package itself is +# unsigned, hence disable_gpg_check here. - name: Install pgEdge release RPM dnf: - name: https://dnf.pgedge.com/reporpm/pgedge-release-latest.noarch.rpm + name: https://downloads.pgedge.com/reporpm/pgedge-release-latest.noarch.rpm state: present disable_gpg_check: true when: ansible_os_family == 'RedHat' @@ -22,18 +34,6 @@ replace: 'staging' when: ansible_os_family == 'RedHat' and cp_source == 'staging' -- name: Install pgEdge packages (RPM) - dnf: - name: "{{ _rpm_packages }}" - state: present - when: ansible_os_family == 'RedHat' - -- name: Install awscli (RPM) - dnf: - name: awscli - state: present - when: ansible_os_family == 'RedHat' - # ── DEB (Debian) ────────────────────────────────────────────────────────────── - name: Install apt prerequisites (Debian) @@ -46,9 +46,11 @@ update_cache: true when: ansible_os_family == 'Debian' +# downloads.pgedge.com, not apt.pgedge.com: the gated repository cannot serve +# the package that configures access to it. - name: Download pgEdge release package (Debian) ansible.builtin.get_url: - url: https://apt.pgedge.com/repodeb/pgedge-release_latest_all.deb + url: https://downloads.pgedge.com/repodeb/pgedge-release_latest_all.deb dest: /tmp/pgedge-release.deb mode: '0644' when: ansible_os_family == 'Debian' @@ -66,6 +68,68 @@ replace: 'staging' when: ansible_os_family == 'Debian' and cp_source == 'staging' +# ── Repository client certificate ──────────────────────────────────────────── + +- name: Install the pgEdge client certificate and enable the repositories + when: pgedge_client_cert | default('') | length > 0 + and pgedge_client_key | default('') | length > 0 + block: + - name: Create the pgEdge configuration directory + ansible.builtin.file: + path: "{{ _pgedge_client_cert_dir }}" + state: directory + owner: root + group: root + mode: '0755' + - name: Write the client certificate + ansible.builtin.copy: + content: "{{ pgedge_client_cert | trim }}\n" + dest: "{{ _pgedge_client_cert_dir }}/client.crt" + owner: root + group: root + mode: '0644' + no_log: true + # Ownership and mode are left to pgedge-subscription-manager: apt reads the + # key as _apt, dnf as root. + - name: Write the client key + ansible.builtin.copy: + content: "{{ pgedge_client_key | trim }}\n" + dest: "{{ _pgedge_client_cert_dir }}/client.key" + owner: root + group: root + mode: '0600' + no_log: true + - name: Validate the certificate and enable the pgEdge repositories + ansible.builtin.command: >- + pgedge-subscription-manager install + {{ _pgedge_client_cert_dir }}/client.crt {{ _pgedge_client_cert_dir }}/client.key --force + changed_when: true + +- name: Warn when no pgEdge client certificate was supplied + ansible.builtin.debug: + msg: >- + No pgEdge client certificate supplied for this run. Any existing + repository configuration is left as it is, and installing pgEdge packages + may fail. Put the certificate and key at ~/.pgedge/client.crt and + ~/.pgedge/client.key, or point PGEDGE_CLIENT_CERT_FILE and + PGEDGE_CLIENT_KEY_FILE at them. + when: not (pgedge_client_cert | default('') | length > 0 + and pgedge_client_key | default('') | length > 0) + +# ── pgEdge packages ─────────────────────────────────────────────────────────── + +- name: Install pgEdge packages (RPM) + dnf: + name: "{{ _rpm_packages }}" + state: present + when: ansible_os_family == 'RedHat' + +- name: Install awscli (RPM) + dnf: + name: awscli + state: present + when: ansible_os_family == 'RedHat' + - name: Install pgEdge packages (DEB) apt: name: "{{ _deb_packages }}" diff --git a/e2e/fixtures/roles/install_systemd_prerequisites/vars/main.yaml b/e2e/fixtures/roles/install_systemd_prerequisites/vars/main.yaml index 3eceb34c..7276701e 100644 --- a/e2e/fixtures/roles/install_systemd_prerequisites/vars/main.yaml +++ b/e2e/fixtures/roles/install_systemd_prerequisites/vars/main.yaml @@ -5,6 +5,9 @@ _arch_transform: aarch64: arm64 arm64: arm64 +# Where the repository client certificate and key are written +_pgedge_client_cert_dir: "{{ '/etc/pki/pgedge' if ansible_os_family == 'RedHat' else '/etc/pgedge' }}" + # RPM package names _rpm_packages: - "pgedge-postgresql{{ pg_version }}" diff --git a/lima/roles/deb_prerequisites/tasks/main.yaml b/lima/roles/deb_prerequisites/tasks/main.yaml index fa7290fd..5087fb5f 100644 --- a/lima/roles/deb_prerequisites/tasks/main.yaml +++ b/lima/roles/deb_prerequisites/tasks/main.yaml @@ -15,9 +15,10 @@ - wget - git - chrony +# downloads.pgedge.com, not apt.pgedge.com -- see rhel_prerequisites. - name: Install pgEdge repository ansible.builtin.apt: - deb: https://apt.pgedge.com/repodeb/pgedge-release_latest_all.deb + deb: https://downloads.pgedge.com/repodeb/pgedge-release_latest_all.deb state: present - name: Reconfigure pgEdge repository for staging packages ansible.builtin.replace: @@ -33,10 +34,57 @@ replace: release when: not (use_staging_packages | bool) register: repo_reconfigured_to_release +- name: Install the pgEdge client certificate and enable the repositories + when: pgedge_client_cert | default('') | length > 0 + and pgedge_client_key | default('') | length > 0 + block: + - name: Create the pgEdge configuration directory + ansible.builtin.file: + path: "/etc/pgedge" + state: directory + owner: root + group: root + mode: '0755' + - name: Write the client certificate + ansible.builtin.copy: + content: "{{ pgedge_client_cert | trim }}\n" + dest: "/etc/pgedge/client.crt" + owner: root + group: root + mode: '0644' + no_log: true + # Ownership and mode are left to pgedge-subscription-manager: apt reads the + # key as _apt, dnf as root. + - name: Write the client key + ansible.builtin.copy: + content: "{{ pgedge_client_key | trim }}\n" + dest: "/etc/pgedge/client.key" + owner: root + group: root + mode: '0600' + no_log: true + - name: Validate the certificate and enable the pgEdge repositories + ansible.builtin.command: >- + pgedge-subscription-manager install + /etc/pgedge/client.crt /etc/pgedge/client.key --force + changed_when: true + +- name: Warn when no pgEdge client certificate was supplied + ansible.builtin.debug: + msg: >- + No pgEdge client certificate supplied for this run. Any existing + repository configuration is left as it is, and installing pgEdge packages + may fail. Put the certificate and key at ~/.pgedge/client.crt and + ~/.pgedge/client.key, or point PGEDGE_CLIENT_CERT_FILE and + PGEDGE_CLIENT_KEY_FILE at them. + when: not (pgedge_client_cert | default('') | length > 0 + and pgedge_client_key | default('') | length > 0) + - name: Update apt cache again ansible.builtin.apt: update_cache: yes changed_when: false + - name: Track configured Spock major for reinstall detection ansible.builtin.copy: content: "{{ spock_major | default('50') }}" diff --git a/lima/roles/rhel_prerequisites/tasks/main.yaml b/lima/roles/rhel_prerequisites/tasks/main.yaml index 2bbf32d0..0a03ccf5 100644 --- a/lima/roles/rhel_prerequisites/tasks/main.yaml +++ b/lima/roles/rhel_prerequisites/tasks/main.yaml @@ -13,9 +13,19 @@ community.general.dnf_config_manager: name: crb state: enabled +# Imported explicitly rather than left to dnf's auto-import from the repo's +# gpgkey=. The RPM and DEB repositories are signed with different keys, so this +# is keys/dnf specifically. +- name: Install the pgEdge package signing key + ansible.builtin.rpm_key: + key: https://downloads.pgedge.com/keys/dnf/pgedge-rsa.pub + state: present +# downloads.pgedge.com, not dnf.pgedge.com: the gated repository cannot serve +# the package that configures access to it. The repo package itself is +# unsigned, hence disable_gpg_check here and nowhere else. - name: Install pgEdge repository ansible.builtin.package: - name: https://dnf.pgedge.com/reporpm/pgedge-release-latest.noarch.rpm + name: https://downloads.pgedge.com/reporpm/pgedge-release-latest.noarch.rpm state: present disable_gpg_check: true - name: Reconfigure pgEdge repository for staging packages @@ -32,6 +42,52 @@ replace: release when: not (use_staging_packages | bool) register: repo_reconfigured_to_release +- name: Install the pgEdge client certificate and enable the repositories + when: pgedge_client_cert | default('') | length > 0 + and pgedge_client_key | default('') | length > 0 + block: + - name: Create the pgEdge configuration directory + ansible.builtin.file: + path: "/etc/pki/pgedge" + state: directory + owner: root + group: root + mode: '0755' + - name: Write the client certificate + ansible.builtin.copy: + content: "{{ pgedge_client_cert | trim }}\n" + dest: "/etc/pki/pgedge/client.crt" + owner: root + group: root + mode: '0644' + no_log: true + # Ownership and mode are left to pgedge-subscription-manager: apt reads the + # key as _apt, dnf as root. + - name: Write the client key + ansible.builtin.copy: + content: "{{ pgedge_client_key | trim }}\n" + dest: "/etc/pki/pgedge/client.key" + owner: root + group: root + mode: '0600' + no_log: true + - name: Validate the certificate and enable the pgEdge repositories + ansible.builtin.command: >- + pgedge-subscription-manager install + /etc/pki/pgedge/client.crt /etc/pki/pgedge/client.key --force + changed_when: true + +- name: Warn when no pgEdge client certificate was supplied + ansible.builtin.debug: + msg: >- + No pgEdge client certificate supplied for this run. Any existing + repository configuration is left as it is, and installing pgEdge packages + may fail. Put the certificate and key at ~/.pgedge/client.crt and + ~/.pgedge/client.key, or point PGEDGE_CLIENT_CERT_FILE and + PGEDGE_CLIENT_KEY_FILE at them. + when: not (pgedge_client_cert | default('') | length > 0 + and pgedge_client_key | default('') | length > 0) + - name: Track configured Spock major for reinstall detection ansible.builtin.copy: content: "{{ spock_major | default('50') }}" diff --git a/lima/vars.yaml b/lima/vars.yaml index 1e1a09ac..05261d0d 100644 --- a/lima/vars.yaml +++ b/lima/vars.yaml @@ -1,5 +1,13 @@ --- use_staging_packages: false +# Client certificate for the gated pgEdge repositories. Read from files on the +# controller rather than passed on the command line, so the PEM never lands in +# argv. Override the paths with PGEDGE_CLIENT_CERT_FILE / PGEDGE_CLIENT_KEY_FILE. +pgedge_client_cert_file: "{{ lookup('env', 'PGEDGE_CLIENT_CERT_FILE') | default('~/.pgedge/client.crt', true) }}" +pgedge_client_key_file: "{{ lookup('env', 'PGEDGE_CLIENT_KEY_FILE') | default('~/.pgedge/client.key', true) }}" +pgedge_client_cert: "{{ lookup('file', pgedge_client_cert_file | expanduser, errors='ignore') | default('', true) }}" +pgedge_client_key: "{{ lookup('file', pgedge_client_key_file | expanduser, errors='ignore') | default('', true) }}" + os: rocky-9 machines: - name: control-plane-dev-1