Skip to content

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

FEATURE (helm): Add Helm chart installation

Rostislav Duginba37b30e8369
diff --git a/README.md b/README.md
index 3996b201..e3c31b4b 100644
--- a/README.md
+++ b/README.md
@@ -157,6 +157,40 @@ Then run:
docker compose up -d
```
+### Option 4: Kubernetes with Helm
+
+For Kubernetes deployments, use the official Helm chart:
+
+```bash
+helm install postgresus ./deploy/postgresus -n postgresus --create-namespace
+```
+
+To customize the installation, create a `values.yaml` file:
+
+```yaml
+ingress:
+ hosts:
+ - host: backup.yourdomain.com
+ paths:
+ - path: /
+ pathType: Prefix
+ tls:
+ - secretName: backup-yourdomain-com-tls
+ hosts:
+ - backup.yourdomain.com
+
+persistence:
+ size: 20Gi
+```
+
+Then install with your custom values:
+
+```bash
+helm install postgresus ./deploy/postgresus -n postgresus --create-namespace -f values.yaml
+```
+
+See the [Helm chart README](deploy/postgresus/README.md) for all configuration options.
+
---
## 🚀 Usage
diff --git a/postgresus/.helmignore b/deploy/postgresus/.helmignore
similarity index 100%
rename from postgresus/.helmignore
rename to deploy/postgresus/.helmignore
diff --git a/postgresus/Chart.yaml b/deploy/postgresus/Chart.yaml
similarity index 79%
rename from postgresus/Chart.yaml
rename to deploy/postgresus/Chart.yaml
index 5f7320a0..4fdf0b53 100644
--- a/postgresus/Chart.yaml
+++ b/deploy/postgresus/Chart.yaml
@@ -10,6 +10,3 @@ keywords:
- database
- restore
home: https://github.com/RostislavDugin/postgresus
-maintainers:
- - name: Alexander Gazal
diff --git a/deploy/postgresus/README.md b/deploy/postgresus/README.md
new file mode 100644
index 00000000..2dd9c7dd
--- /dev/null
+++ b/deploy/postgresus/README.md
@@ -0,0 +1,84 @@
+# Postgresus Helm Chart
+
+## Installation
+
+```bash
+helm install postgresus ./deploy/postgresus -n postgresus --create-namespace
+```
+
+## Configuration
+
+### Main Parameters
+
+| Parameter | Description | Default Value |
+| ------------------ | ------------------ | --------------------------- |
+| `namespace.create` | Create namespace | `true` |
+| `namespace.name` | Namespace name | `postgresus` |
+| `image.repository` | Docker image | `rostislavdugin/postgresus` |
+| `image.tag` | Image tag | `latest` |
+| `image.pullPolicy` | Image pull policy | `Always` |
+| `replicaCount` | Number of replicas | `1` |
+
+### Resources
+
+| Parameter | Description | Default Value |
+| --------------------------- | -------------- | ------------- |
+| `resources.requests.memory` | Memory request | `1Gi` |
+| `resources.requests.cpu` | CPU request | `500m` |
+| `resources.limits.memory` | Memory limit | `1Gi` |
+| `resources.limits.cpu` | CPU limit | `500m` |
+
+### Storage
+
+| Parameter | Description | Default Value |
+| ------------------------------ | ------------------------- | ---------------------- |
+| `persistence.enabled` | Enable persistent storage | `true` |
+| `persistence.storageClassName` | Storage class | `""` (cluster default) |
+| `persistence.accessMode` | Access mode | `ReadWriteOnce` |
+| `persistence.size` | Storage size | `10Gi` |
+| `persistence.mountPath` | Mount path | `/postgresus-data` |
+
+### Service
+
+| Parameter | Description | Default Value |
+| -------------------------- | ----------------------- | ------------- |
+| `service.type` | Service type | `ClusterIP` |
+| `service.port` | Service port | `4005` |
+| `service.targetPort` | Target port | `4005` |
+| `service.headless.enabled` | Enable headless service | `true` |
+
+### Ingress
+
+| Parameter | Description | Default Value |
+| ----------------------- | ----------------- | ------------------------ |
+| `ingress.enabled` | Enable Ingress | `true` |
+| `ingress.className` | Ingress class | `nginx` |
+| `ingress.hosts[0].host` | Hostname | `postgresus.example.com` |
+| `ingress.tls` | TLS configuration | See values.yaml |
+
+### Health Checks
+
+| Parameter | Description | Default Value |
+| ------------------------ | ---------------------- | ------------- |
+| `livenessProbe.enabled` | Enable liveness probe | `true` |
+| `readinessProbe.enabled` | Enable readiness probe | `true` |
+
+## Custom Ingress Example
+
+```yaml
+# custom-values.yaml
+ingress:
+ hosts:
+ - host: backup.example.com
+ paths:
+ - path: /
+ pathType: Prefix
+ tls:
+ - secretName: backup-example-com-tls
+ hosts:
+ - backup.example.com
+```
+
+```bash
+helm install postgresus ./deploy/postgresus -n postgresus --create-namespace -f custom-values.yaml
+```
diff --git a/postgresus/templates/_helpers.tpl b/deploy/postgresus/helm/_helpers.tpl
similarity index 100%
rename from postgresus/templates/_helpers.tpl
rename to deploy/postgresus/helm/_helpers.tpl
diff --git a/postgresus/templates/ingress.yaml b/deploy/postgresus/helm/ingress.yaml
similarity index 100%
rename from postgresus/templates/ingress.yaml
rename to deploy/postgresus/helm/ingress.yaml
diff --git a/postgresus/templates/namespace.yaml b/deploy/postgresus/helm/namespace.yaml
similarity index 100%
rename from postgresus/templates/namespace.yaml
rename to deploy/postgresus/helm/namespace.yaml
diff --git a/postgresus/templates/service.yaml b/deploy/postgresus/helm/service.yaml
similarity index 100%
rename from postgresus/templates/service.yaml
rename to deploy/postgresus/helm/service.yaml
diff --git a/postgresus/templates/statefulset.yaml b/deploy/postgresus/helm/statefulset.yaml
similarity index 97%
rename from postgresus/templates/statefulset.yaml
rename to deploy/postgresus/helm/statefulset.yaml
index 5281d45d..c5f982af 100644
--- a/postgresus/templates/statefulset.yaml
+++ b/deploy/postgresus/helm/statefulset.yaml
@@ -71,7 +71,9 @@ spec:
spec:
accessModes:
- {{ .Values.persistence.accessMode }}
+ {{- if .Values.persistence.storageClassName }}
storageClassName: {{ .Values.persistence.storageClassName }}
+ {{- end }}
resources:
requests:
storage: {{ .Values.persistence.size }}
diff --git a/postgresus/values.yaml b/deploy/postgresus/values.yaml
similarity index 84%
rename from postgresus/values.yaml
rename to deploy/postgresus/values.yaml
index d4358f75..ce470672 100644
--- a/postgresus/values.yaml
+++ b/deploy/postgresus/values.yaml
@@ -8,8 +8,8 @@ namespace:
# Image configuration
image:
repository: rostislavdugin/postgresus
- tag: v1.45.3
- pullPolicy: IfNotPresent
+ tag: latest
+ pullPolicy: Always
# StatefulSet configuration
replicaCount: 1
@@ -26,8 +26,8 @@ service:
# Resource limits and requests
resources:
requests:
- memory: "512Mi"
- cpu: "250m"
+ memory: "1Gi"
+ cpu: "500m"
limits:
memory: "1Gi"
cpu: "500m"
@@ -35,7 +35,9 @@ resources:
# Persistent storage configuration
persistence:
enabled: true
- storageClassName: longhorn-pg
+ # Storage class name. Leave empty to use cluster default.
+ # Examples: "longhorn", "standard", "gp2", etc.
+ storageClassName: ""
accessMode: ReadWriteOnce
size: 10Gi
# Mount path in container
@@ -71,11 +73,12 @@ ingress:
hosts:
- postgresus.example.com
-# Health checks configuration (commented out by default)
+# Health checks configuration
+# Note: The application only has /api/v1/system/health endpoint
livenessProbe:
- enabled: false
+ enabled: true
httpGet:
- path: /health
+ path: /api/v1/system/health
port: 4005
initialDelaySeconds: 30
periodSeconds: 10
@@ -83,11 +86,11 @@ livenessProbe:
failureThreshold: 3
readinessProbe:
- enabled: false
+ enabled: true
httpGet:
- path: /ready
+ path: /api/v1/system/health
port: 4005
- initialDelaySeconds: 5
+ initialDelaySeconds: 10
periodSeconds: 5
timeoutSeconds: 3
failureThreshold: 3
diff --git a/postgresus/README.md b/postgresus/README.md
deleted file mode 100644
index 30341010..00000000
--- a/postgresus/README.md
+++ /dev/null
@@ -1,189 +0,0 @@
-# Postgresus Helm Chart
-
-Helm chart for deploying Postgresus - a PostgreSQL backup and management system.
-
-## Description
-
-This Helm chart deploys Postgresus in a Kubernetes cluster using StatefulSet to ensure persistent data storage.
-
-## Installation
-
-### Install with Default Values
-
-```bash
-helm install postgresus ./helm-chart/postgresus -n postgresus --create-namespace
-```
-
-### Install with Custom Values
-
-```bash
-helm install postgresus ./helm-chart/postgresus -n postgresus --create-namespace -f custom-values.yaml
-```
-
-### Upgrade Release
-
-```bash
-helm upgrade postgresus ./helm-chart/postgresus -n postgresus
-```
-
-### Uninstall Release
-
-```bash
-helm uninstall postgresus -n postgresus
-```
-
-## Configuration
-
-### Main Parameters
-
-| Parameter | Description | Default Value |
-|----------|----------|----------------------|
-| `namespace.create` | Create namespace | `true` |
-| `namespace.name` | Namespace name | `postgresus` |
-| `image.repository` | Docker image | `rostislavdugin/postgresus` |
-| `image.tag` | Image tag | `v1.34.0` |
-| `image.pullPolicy` | Image pull policy | `IfNotPresent` |
-| `replicaCount` | Number of replicas | `1` |
-
-### Resources
-
-| Parameter | Description | Default Value |
-|----------|----------|----------------------|
-| `resources.requests.memory` | Memory request | `512Mi` |
-| `resources.requests.cpu` | CPU request | `250m` |
-| `resources.limits.memory` | Memory limit | `1Gi` |
-| `resources.limits.cpu` | CPU limit | `500m` |
-
-### Storage
-
-| Parameter | Description | Default Value |
-|----------|----------|----------------------|
-| `persistence.enabled` | Enable persistent storage | `true` |
-| `persistence.storageClassName` | Storage class | `longhorn` |
-| `persistence.accessMode` | Access mode | `ReadWriteOnce` |
-| `persistence.size` | Storage size | `10Gi` |
-| `persistence.mountPath` | Mount path | `/postgresus-data` |
-
-### Service
-
-| Parameter | Description | Default Value |
-|----------|----------|----------------------|
-| `service.type` | Service type | `ClusterIP` |
-| `service.port` | Service port | `4005` |
-| `service.targetPort` | Target port | `4005` |
-| `service.headless.enabled` | Enable headless service | `true` |
-
-### Ingress
-
-| Parameter | Description | Default Value |
-|----------|----------|----------------------|
-| `ingress.enabled` | Enable Ingress | `true` |
-| `ingress.className` | Ingress class | `nginx` |
-| `ingress.hosts[0].host` | Hostname | `postgresus.home.fwz.ru` |
-| `ingress.tls` | TLS configuration | See values.yaml |
-
-### Health Checks
-
-| Parameter | Description | Default Value |
-|----------|----------|----------------------|
-| `livenessProbe.enabled` | Enable liveness probe | `false` |
-| `readinessProbe.enabled` | Enable readiness probe | `false` |
-
-## Usage Examples
-
-### Change Image Version
-
-```yaml
-# custom-values.yaml
-image:
- tag: v1.20.0
-```
-
-```bash
-helm upgrade postgresus ./helm-chart/postgresus -n postgresus -f custom-values.yaml
-```
-
-### Change Storage Size
-
-```yaml
-# custom-values.yaml
-persistence:
- size: 50Gi
-```
-
-### Configure Ingress for Different Domain
-
-```yaml
-# custom-values.yaml
-ingress:
- hosts:
- - host: backup.example.com
- paths:
- - path: /
- pathType: Prefix
- tls:
- - secretName: backup-example-com-tls
- hosts:
- - backup.example.com
-```
-
-### Enable Health Checks
-
-```yaml
-# custom-values.yaml
-livenessProbe:
- enabled: true
-
-readinessProbe:
- enabled: true
-```
-
-## Verify Deployment
-
-```bash
-# Check release status
-helm status postgresus -n postgresus
-
-# View pods
-kubectl get pods -n postgresus
-
-# View services
-kubectl get svc -n postgresus
-
-# View ingress
-kubectl get ingress -n postgresus
-
-# View PVC
-kubectl get pvc -n postgresus
-```
-
-## Debugging
-
-```bash
-# View logs
-kubectl logs -n postgresus -l app=postgresus
-
-# View events
-kubectl get events -n postgresus
-
-# Describe StatefulSet
-kubectl describe statefulset postgresus -n postgresus
-
-# Render templates without installation
-helm template postgresus ./helm-chart/postgresus -n postgresus
-```
-
-## Requirements
-
-- Kubernetes 1.19+
-- Helm 3.0+
-- PV provisioner (e.g., Longhorn)
-- Nginx Ingress Controller (optional)
-- Cert-Manager (optional, for automatic certificates)
-
-## Notes
-
-- The chart uses StatefulSet to ensure stable data storage
-- Headless service is created automatically for StatefulSet
-- By default, one application instance is created (replica=1)
-- It's recommended to configure a backup policy for PVC