PostgreSQL backup tool with Point-In-Time-Recovery and restore verification
TypeScript backupbackupsdatabasedatabase-backupdevopsdockergolangkubernetesmariadbmongodbmysqlpgpostgrespostgresqls3self-hostedsystem-administrationtoolsweb-ui
FEATURE (postgres): Add PostgreSQL 12 tests and CI \ CD config
Rostislav Dugina941fbd09350
diff --git a/.github/workflows/ci-release.yml b/.github/workflows/ci-release.ymlindex 8a36be96..7620b876 100644--- a/.github/workflows/ci-release.yml+++ b/.github/workflows/ci-release.yml@@ -127,6 +127,7 @@ jobs:TEST_GOOGLE_DRIVE_CLIENT_SECRET=${{ secrets.TEST_GOOGLE_DRIVE_CLIENT_SECRET }}TEST_GOOGLE_DRIVE_TOKEN_JSON=${{ secrets.TEST_GOOGLE_DRIVE_TOKEN_JSON }}# testing DBs+ TEST_POSTGRES_12_PORT=5000TEST_POSTGRES_13_PORT=5001TEST_POSTGRES_14_PORT=5002TEST_POSTGRES_15_PORT=5003@@ -154,6 +155,7 @@ jobs:timeout 60 bash -c 'until docker exec dev-db pg_isready -h localhost -p 5437 -U postgres; do sleep 2; done'# Wait for test databases+ timeout 60 bash -c 'until nc -z localhost 5000; do sleep 2; done'timeout 60 bash -c 'until nc -z localhost 5001; do sleep 2; done'timeout 60 bash -c 'until nc -z localhost 5002; do sleep 2; done'timeout 60 bash -c 'until nc -z localhost 5003; do sleep 2; done'diff --git a/backend/.env.development.example b/backend/.env.development.exampleindex 11264b12..05098693 100644--- a/backend/.env.development.example+++ b/backend/.env.development.example@@ -17,6 +17,7 @@ TEST_GOOGLE_DRIVE_CLIENT_ID=TEST_GOOGLE_DRIVE_CLIENT_SECRET=TEST_GOOGLE_DRIVE_TOKEN_JSON="{\"access_token\":\"ya29..."# testing DBs+TEST_POSTGRES_12_PORT=5000TEST_POSTGRES_13_PORT=5001TEST_POSTGRES_14_PORT=5002TEST_POSTGRES_15_PORT=5003diff --git a/backend/docker-compose.yml.example b/backend/docker-compose.yml.exampleindex cda7e829..2c5785dd 100644--- a/backend/docker-compose.yml.example+++ b/backend/docker-compose.yml.example@@ -32,6 +32,17 @@ services:command: server /data --console-address ":9001"# Test PostgreSQL containers+ test-postgres-12:+ image: postgres:12+ ports:+ - "${TEST_POSTGRES_12_PORT}:5432"+ environment:+ - POSTGRES_DB=testdb+ - POSTGRES_USER=testuser+ - POSTGRES_PASSWORD=testpassword+ container_name: test-postgres-12+ shm_size: 1gb+test-postgres-13:image: postgres:13ports:diff --git a/backend/internal/config/config.go b/backend/internal/config/config.goindex 32674270..50221600 100644--- a/backend/internal/config/config.go+++ b/backend/internal/config/config.go@@ -33,6 +33,7 @@ type EnvVariables struct {TestGoogleDriveClientSecret string `env:"TEST_GOOGLE_DRIVE_CLIENT_SECRET"`TestGoogleDriveTokenJSON string `env:"TEST_GOOGLE_DRIVE_TOKEN_JSON"`+ TestPostgres12Port string `env:"TEST_POSTGRES_12_PORT"`TestPostgres13Port string `env:"TEST_POSTGRES_13_PORT"`TestPostgres14Port string `env:"TEST_POSTGRES_14_PORT"`TestPostgres15Port string `env:"TEST_POSTGRES_15_PORT"`@@ -145,6 +146,10 @@ func loadEnvVariables() {env.TempFolder = filepath.Join(filepath.Dir(backendRoot), "postgresus-data", "temp")if env.IsTesting {+ if env.TestPostgres12Port == "" {+ log.Error("TEST_POSTGRES_12_PORT is empty")+ os.Exit(1)+ }if env.TestPostgres13Port == "" {log.Error("TEST_POSTGRES_13_PORT is empty")os.Exit(1)diff --git a/backend/internal/features/tests/postgresql_backup_restore_test.go b/backend/internal/features/tests/postgresql_backup_restore_test.goindex 3f203cc4..37580a1b 100644--- a/backend/internal/features/tests/postgresql_backup_restore_test.go+++ b/backend/internal/features/tests/postgresql_backup_restore_test.go@@ -69,6 +69,7 @@ func Test_BackupAndRestorePostgresql_RestoreIsSuccesful(t *testing.T) {version stringport string}{+ {"PostgreSQL 12", "12", env.TestPostgres12Port},{"PostgreSQL 13", "13", env.TestPostgres13Port},{"PostgreSQL 14", "14", env.TestPostgres14Port},{"PostgreSQL 15", "15", env.TestPostgres15Port},diff --git a/frontend/src/features/backups/ui/BackupsComponent.tsx b/frontend/src/features/backups/ui/BackupsComponent.tsxindex 9a35721b..3b9dddd5 100644--- a/frontend/src/features/backups/ui/BackupsComponent.tsx+++ b/frontend/src/features/backups/ui/BackupsComponent.tsx@@ -175,6 +175,7 @@ export const BackupsComponent = ({ database, isCanManageDBs, scrollContainerReftry {await backupsApi.makeBackup(database.id);+ await new Promise((resolve) => setTimeout(resolve, 1000));setCurrentLimit(BACKUPS_PAGE_SIZE);setHasMore(true);await loadBackups(BACKUPS_PAGE_SIZE);