From dff97c55dc1f505268421774a3b83f103a2a2356 Mon Sep 17 00:00:00 2001 From: Grendgi Date: Tue, 16 Jun 2026 13:22:08 +0300 Subject: [PATCH] fix: wait for files postgres readiness --- .gitea/workflows/deploy.yaml | 2 ++ cmd/server/main.go | 2 +- k8s/postgres.yaml | 4 +++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/deploy.yaml b/.gitea/workflows/deploy.yaml index d13fa72..f69aa50 100644 --- a/.gitea/workflows/deploy.yaml +++ b/.gitea/workflows/deploy.yaml @@ -51,6 +51,8 @@ jobs: kubectl apply -f k8s/secrets.yaml kubectl apply -f k8s/configmap.yaml kubectl apply -f k8s/postgres.yaml + kubectl -n files rollout status statefulset/postgres --timeout=240s + kubectl -n files wait --for=condition=ready pod -l app=files-postgres --timeout=240s kubectl apply -f k8s/server-deployment.yaml kubectl apply -f k8s/server-service.yaml kubectl -n files set image deployment/files-server \ diff --git a/cmd/server/main.go b/cmd/server/main.go index cde072c..0b1f146 100644 --- a/cmd/server/main.go +++ b/cmd/server/main.go @@ -28,7 +28,7 @@ func main() { ctx, stop := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM) defer stop() - pool, err := commondb.ConnectWithRetry(ctx, cfg.DatabaseURL, 2*time.Minute) + pool, err := commondb.ConnectWithRetry(ctx, cfg.DatabaseURL, 10*time.Minute) if err != nil { slog.Error("connect database", "error", err) os.Exit(1) diff --git a/k8s/postgres.yaml b/k8s/postgres.yaml index 2fc3a8e..105eba0 100644 --- a/k8s/postgres.yaml +++ b/k8s/postgres.yaml @@ -34,6 +34,9 @@ spec: envFrom: - secretRef: name: postgres-secret + env: + - name: PGDATA + value: /var/lib/postgresql/data/pgdata volumeMounts: - name: data mountPath: /var/lib/postgresql/data @@ -52,4 +55,3 @@ spec: resources: requests: storage: 10Gi -