FEATURE: Cluster-based PostgreSQL backup management & bulk import (1.x line) #135
+3,222
−13
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR description
Context / Versioning
main.v1.3.0up tov1.33.0, plus this cluster feature.mainbranch is currently atv2.0.3.v1.33.0, not againstv2.0.3. If you want this feature onmain, it would need to be ported to thev2.xcodebase.What this PR adds (high level)
Cluster-based backup management
clustersthat lets you:Workspace-aware, cluster-level scheduler
Databaserecords within the workspace (excluding templates/system DBs).Bulk import from cluster (frontend)
list-databases-directendpoint).Safer propagation of cluster defaults
Backend changes
New
clustersfeature (backend)Files under
backend/internal/features/clusters/…:Models
Workspace, holds default backup settings and notifiers.Service
PostgresqlDatabaselogic.Databaseif missing.Controller & routes
POST /clusters– create cluster.GET /clusters– list clusters byworkspace_id.PUT /clusters/{id}– update cluster.POST /clusters/{id}/run-backup– run cluster backup once.GET /clusters/{id}/databases– list accessible DBs in a cluster.GET /clusters/{id}/propagation/preview– preview changes to existing DBs.POST /clusters/{id}/propagation/apply– apply those changes.Background scheduler
BackupInterval.ShouldTriggerBackupandCluster.LastRunAtto decide when to run.LastRunAt.Backup configuration enhancements
ClusterID *uuid.UUIDManagedByCluster boolWHERE is_backups_enabled = TRUE AND (managed_by_cluster = FALSE OR cluster_id IS NULL)ManagedByCluster = true,ClusterID = cluster.ID.Migrations introduced by this PR (cluster-related)
New SQL migrations under
backend/migrations:clustersandpostgresql_clusterstables.cluster_excluded_databasestable.last_run_attracking to clusters.cluster_idandmanaged_by_clustercolumns tobackup_configs.These are additive and don’t change semantics for existing deployments that don’t use clusters.
Frontend changes
New “Clusters” tab
workspaceand permission info to ClustersComponent.Bulk DB creation from cluster
databaseApi.listDatabasesDirect.EditBackupConfigComponent(no extra API calls yet).EditDatabaseNotifiersComponent.Cluster API and models
frontend/src/entity/clusters:Docs
Changes vs
v1.3.0(high level)Compared to the older
v1.3.0tag, this branch already includes upstream 1.x features such as:Workspaces & access control
Extended storage and notifier support
User management & OAuth
This PR builds on top of those 1.x additions and adds cluster-based backup management on top.
Migration & compatibility notes
Existing installations without clusters
When using clusters
clusters,postgresql_clusters,cluster_excluded_databases, and cluster-relatedbackup_configscolumns are required.ManagedByCluster = trueandClusterIDset; they are then driven by the cluster scheduler.Testing
Things I’d recommend verifying/that this PR is designed to support:
Backend
v1.3.0line).Database+ BackupConfig.LastRunAtas expected.Frontend