Skip to content

PostgreSQL backup tool with Point-In-Time-Recovery and restore verification

FIX (healthcheck): Add cache accessibility to healthcheck

Rostislav Dugina1655d35a6db
diff --git a/.gitignore b/.gitignore
index e78432a1..b51ea47f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
+ansible/
postgresus_data/
postgresus-data/
databasus-data/
diff --git a/backend/internal/features/system/healthcheck/service.go b/backend/internal/features/system/healthcheck/service.go
index cfc85589..68d6a723 100644
--- a/backend/internal/features/system/healthcheck/service.go
+++ b/backend/internal/features/system/healthcheck/service.go
@@ -1,11 +1,14 @@
package system_healthcheck
import (
+ "context"
"databasus-backend/internal/config"
"databasus-backend/internal/features/backups/backups/backuping"
"databasus-backend/internal/features/disk"
"databasus-backend/internal/storage"
+ cache_utils "databasus-backend/internal/util/cache"
"errors"
+ "time"
)
type HealthcheckService struct {
@@ -15,6 +18,20 @@ type HealthcheckService struct {
}
func (s *HealthcheckService) IsHealthy() error {
+ return s.performHealthCheck()
+}
+
+func (s *HealthcheckService) performHealthCheck() error {
+ // Check if cache is available with PING
+ ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second)
+ defer cancel()
+
+ client := cache_utils.GetValkeyClient()
+ pingResult := client.Do(ctx, client.B().Ping().Build())
+ if pingResult.Error() != nil {
+ return errors.New("cannot connect to valkey")
+ }
+
diskUsage, err := s.diskService.GetDiskUsage()
if err != nil {
return errors.New("cannot get disk usage")
@@ -40,6 +57,7 @@ func (s *HealthcheckService) IsHealthy() error {
if config.GetEnv().IsProcessingNode {
if !s.backuperNode.IsBackuperRunning() {
return errors.New("backuper node is not running for more than 5 minutes")
+
}
}
diff --git a/frontend/src/features/playground/ui/PlaygroundWarningComponent.tsx b/frontend/src/features/playground/ui/PlaygroundWarningComponent.tsx
index db04d4ba..ed2ecd95 100644
--- a/frontend/src/features/playground/ui/PlaygroundWarningComponent.tsx
+++ b/frontend/src/features/playground/ui/PlaygroundWarningComponent.tsx
@@ -59,7 +59,7 @@ export const PlaygroundWarningComponent = (): JSX.Element => {
return (
<Modal
- title="Welcome to Databasus Playground"
+ title="Welcome to Databasus playground"
open={isVisible}
onOk={handleClose}
okText={