Summary
When a user runs sync against a SerenDB target and the target's wal_level is not set to logical, the command fails with an error asking the user to manually enable logical replication in their SerenDB project settings.
We should automate this by integrating with the SerenDB Console API to:
- Check if logical replication is enabled on the project
- Offer to enable it if not enabled
- Wait for the setting to take effect before proceeding with sync
User Story
As a user of the database replicator, I want the sync command to automatically detect and offer to enable logical replication on my SerenDB project so I don't have to manually configure it in the Console.
Technical Details
SerenDB Console API Endpoints
GET /api/projects/{project_id} - Returns project info including enable_logical_replication field
PATCH /api/projects/{project_id} - Can set enable_logical_replication: true
Authentication
- Uses same API key format as remote execution:
Authorization: Bearer seren_<key_id>_<secret>
Implementation Plan
-
Phase 1 (Interim): Add --project-id <uuid> flag to sync command
- User provides their SerenDB project ID
- CLI checks and offers to enable logical replication via Console API
-
Phase 2 (Future): Auto-detect project from endpoint hostname
- Requires new serencore endpoint:
GET /api/endpoints/by-hostname/{hostname}
- Extracts endpoint name from connection URL and looks up project
Notes
- Enabling logical replication will briefly suspend all active endpoints
- Once enabled, logical replication cannot be disabled
- Console API base URL:
https://console.serendb.com
Acceptance Criteria
Related
- User report: sync fails with "Target database wal_level is set to 'replica', but 'logical' is required"
Summary
When a user runs
syncagainst a SerenDB target and the target'swal_levelis not set tological, the command fails with an error asking the user to manually enable logical replication in their SerenDB project settings.We should automate this by integrating with the SerenDB Console API to:
User Story
As a user of the database replicator, I want the
synccommand to automatically detect and offer to enable logical replication on my SerenDB project so I don't have to manually configure it in the Console.Technical Details
SerenDB Console API Endpoints
GET /api/projects/{project_id}- Returns project info includingenable_logical_replicationfieldPATCH /api/projects/{project_id}- Can setenable_logical_replication: trueAuthentication
Authorization: Bearer seren_<key_id>_<secret>Implementation Plan
Phase 1 (Interim): Add
--project-id <uuid>flag tosynccommandPhase 2 (Future): Auto-detect project from endpoint hostname
GET /api/endpoints/by-hostname/{hostname}Notes
https://console.serendb.comAcceptance Criteria
--project-idflag tosynccommandenable_logical_replicationstatus when--project-idis providedRelated