Skip to content

[docs] Add backup and restore instructions for PostgreSQL - #1141

Merged
Andrei Kvapil (kvaps) merged 1 commit into
mainfrom
docs-pg-restore
Jul 9, 2025
Merged

[docs] Add backup and restore instructions for PostgreSQL #1141
Andrei Kvapil (kvaps) merged 1 commit into
mainfrom
docs-pg-restore

Conversation

@klinch0

@klinch0 klinch0 commented Jul 2, 2025

Copy link
Copy Markdown
Contributor

What this PR does

Rephrase the descriptions for backup and restore variables

Release note

[docs] Add backup and restore instructions for PostgreSQL 

Summary by CodeRabbit

  • Documentation

    • Updated PostgreSQL backup restore instructions to use a YAML configuration approach for bootstrapping from a backup, replacing previous shell command examples.
    • Clarified and restructured backup and recovery documentation, including detailed configuration examples for enabling backups with S3-compatible storage.
    • Improved descriptions and default values for backup-related configuration parameters for better clarity and consistency.
  • Chores

    • Incremented the PostgreSQL app chart version.
    • Updated version mapping for the PostgreSQL package.

@coderabbitai

coderabbitai Bot commented Jul 2, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

This change updates the PostgreSQL application's Helm chart version from 0.17.0 to 0.17.1, adjusts the version mapping accordingly, and revises the README documentation to restructure backup and recovery instructions. The backup restore method now uses a YAML configuration snippet instead of shell commands, with improved clarity in the backup parameters and schema descriptions.

Changes

File(s) Change Summary
packages/apps/postgres/Chart.yaml Incremented chart version from 0.17.0 to 0.17.1.
packages/apps/versions_map Updated "postgres" version mapping: 0.17.0 now points to a specific commit; 0.17.1 added pointing to HEAD.
packages/apps/postgres/README.md Restructured backup and recovery instructions; replaced shell commands with YAML bootstrap config snippet.
packages/apps/postgres/values.schema.json Updated backup config schema descriptions and default for destinationPath for clarity and consistency.
packages/apps/postgres/values.yaml Revised backup config comments and default values for clarity and specificity; no logic changes.

Possibly related PRs

Suggested labels

documentation, size:S

Suggested reviewers

  • lllamnyp

Poem

🐇 A hop, a skip, a version bump,
Postgres charts no longer slump.
Backup tales now told with YAML grace,
Shell commands vanish without a trace.
Clearer paths to restore and save,
A rabbit’s cheer for docs so brave! 🌿✨


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
packages/apps/postgres/Chart.yaml (1)

19-19: Chart version bumped but dependent artefacts not shown

The version bump to 0.15.2 looks correct, but please ensure:

  1. Chart.lock (if present) is regenerated.
  2. Any CI publishing workflows reference the new version tag.
  3. CHANGELOG / release notes include a bullet for the new PITR bootstrap feature.

No code change needed if those items are already handled.

packages/apps/postgres/README.md (1)

24-34: Clarify bootstrap example to avoid copy-paste accidents

The sample YAML keeps bootstrap.enabled: false, which means an operator might paste the block and think restore is active while nothing happens.

-bootstrap:
-  enabled: false
+bootstrap:
+  # Set to true to start the restore procedure
+  enabled: true

Suggest explicitly commenting that the user must flip this flag (or set it to true in the snippet) to trigger the restore, and maybe add a warning that the cluster will roll back to the specified recoveryTime.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1d39643 and c4c8950.

📒 Files selected for processing (3)
  • packages/apps/postgres/Chart.yaml (1 hunks)
  • packages/apps/postgres/README.md (1 hunks)
  • packages/apps/versions_map (1 hunks)
🔇 Additional comments (1)
packages/apps/versions_map (1)

99-100: Pin 0.15.2 before the next merge to keep map immutable

0.15.1 is now correctly frozen to commit 4369b031 – nice.
For consistency, remember to pin 0.15.2 to its release commit (instead of HEAD) immediately after the chart is cut, otherwise any subsequent force-pushes to HEAD will silently change which revision gets deployed.

-postgres 0.15.2 HEAD
+# TODO: replace HEAD with the release commit SHA once merged
+postgres 0.15.2  <commit-sha>

Comment thread packages/apps/postgres/README.md Outdated
```yaml
## @param bootstrap.enabled Restore cluster from backup
## @param bootstrap.recoveryTime Time stamp up to which recovery will proceed, expressed in RFC 3339 format, if empty, will restore latest
## @param bootstrap.oldName Name of cluster before deleting

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

klinch0 must the previous cluster be deleted before restoring a backup?

postgres 0.16.0 70f82667
postgres 0.17.0 HEAD
postgres 0.17.0 acd4663a
postgres 0.17.1 HEAD

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

klinch0 bumped the chart version again

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
packages/apps/postgres/README.md (2)

18-21: Grammar & wording polish needed

Minor readability issues:

  1. Extra double-space after “to an”.
  2. “an backup.*” → either “a backup.* key” or simply “backup.* values”.

Tighten the wording to avoid stumbling for readers.


50-56: Minor doc inconsistencies

  • “Time stamp” → “Timestamp” (one word).
  • Comment after recoveryTime: "" is very long—consider breaking to a new line for clarity.

Pure documentation polish, no functional impact.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c4c8950 and 6c8d836.

📒 Files selected for processing (5)
  • packages/apps/postgres/Chart.yaml (1 hunks)
  • packages/apps/postgres/README.md (2 hunks)
  • packages/apps/postgres/values.schema.json (2 hunks)
  • packages/apps/postgres/values.yaml (1 hunks)
  • packages/apps/versions_map (1 hunks)
✅ Files skipped from review due to trivial changes (2)
  • packages/apps/postgres/values.yaml
  • packages/apps/postgres/values.schema.json
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/apps/postgres/Chart.yaml
  • packages/apps/versions_map
🧰 Additional context used
🪛 LanguageTool
packages/apps/postgres/README.md

[grammar] ~16-~16: Use correct spacing
Context: ...e-pg> ## Operations ### How to enable backups To back up a PostgreSQL application, an...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~20-~20: Use articles correctly
Context: ...and fill in the path and credentials to an backup.*: ```yaml ## PARAM backup.en...

(QB_NEW_EN_OTHER_ERROR_IDS_11)


[grammar] ~40-~40: Use correct spacing
Context: ...te8waeGai0oog ``` ### How to recover a backup CloudNativePG supports point-in-time-re...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~42-~42: Use hyphens correctly
Context: ...ecover a backup CloudNativePG supports point-in-time-recovery. Recovering a backup is done by creating...

(QB_NEW_EN_OTHER_ERROR_IDS_29)


[grammar] ~43-~43: Use correct spacing
Context: ...base instance and restoring the data in it. Create a new PostgreSQL application wit...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~45-~45: Use commas correctly
Context: ...PostgreSQL application with a different name, but identical configuration. Set `bootst...

(QB_NEW_EN_OTHER_ERROR_IDS_33)


[grammar] ~46-~46: Use correct spacing
Context: ...stance to recover from and the recovery time: yaml ## @param bootstrap.enabled Restore cluster from backup ## @param bootstrap.recoveryTime Time stamp up to which recovery will proceed, expressed in RFC 3339 format, if empty, will restore latest ## @param bootstrap.oldName Name of cluster before deleting ## bootstrap: enabled: false recoveryTime: "" # leave empty for latest or exact timestamp; example: 2020-11-26 15:22:00.00000+00 oldName: "<previous-postgres-instance>" ### How to switch primary/secondary replica...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~59-~59: There might be a problem here.
Context: ...`` ### How to switch primary/secondary replica See: - https://cloudnative-pg.io/documentation/1.15/rolling_update/#manual-updates-supervised ## Parameters ### Common parameters | Name ...

(QB_NEW_EN_MERGED_MATCH)

🪛 Gitleaks (8.26.0)
packages/apps/postgres/README.md

36-36: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


37-37: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Build
🔇 Additional comments (2)
packages/apps/postgres/README.md (2)

35-35: Cron expression may be off by one field

"0 2 * * * *" is a six-field cron (seconds + minutes + hours + dom + month + dow).
CloudNativePG’s schedule expects the standard 5-field format (per docs) unless cronjobTimeZone is set. Double-check—if seconds aren’t supported the job will never fire.


23-37: Replace hard-coded “example” secrets with obvious placeholders

The snippet currently publishes what look like real S3 credentials (oobaiRus9pah8PhohL1ThaeTa4UVa7gu, ju3eum4dekeich9ahM1te8waeGai0oog). Even if they are dummy values, static-analysis tools (and humans) will treat them as leaked secrets. Use unmistakable placeholders to prevent accidental copy-paste of invalid keys and to silence secret-scanners.

-  s3AccessKey: oobaiRus9pah8PhohL1ThaeTa4UVa7gu
-  s3SecretKey: ju3eum4dekeich9ahM1te8waeGai0oog
+  # Replace with your S3 credentials
+  s3AccessKey: <S3_ACCESS_KEY>
+  s3SecretKey: <S3_SECRET_KEY>
⛔ Skipped due to learnings
Learnt from: NickVolynkin
PR: cozystack/cozystack#1120
File: packages/apps/ferretdb/README.md:35-37
Timestamp: 2025-07-02T09:58:11.406Z
Learning: In the cozystack repository, the maintainer NickVolynkin prefers to keep realistic-looking example credentials in README documentation rather than using generic placeholders like <ACCESS_KEY>, even though they are just examples and not real secrets.

## HowTos
## Operations

### How to switch primary/secondary replica

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved down to line 59

Rephrase the descriptions for backup and restore variables

Co-authored-by: Nick Volynkin <nick.volynkin@gmail.com>
Signed-off-by: Nick Volynkin <nick.volynkin@gmail.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (1)
packages/apps/postgres/README.md (1)

40-46: State whether the old cluster must be deleted before bootstrap

Readers may wonder (see previous review comment) if the original cluster has to be removed for name reuse. Add an explicit note, e.g.:

“The previous cluster must be deleted (or renamed) before restoring with bootstrap.oldName.”

Avoids operational surprises.

🧹 Nitpick comments (2)
packages/apps/postgres/values.yaml (1)

62-69: Clarify retention-policy units & destination path wording

retentionPolicy accepts strings like 30d, 24h, etc., but the comment does not say that the suffix is mandatory nor that mixed units are allowed. Likewise, “Path to store the backup” implicitly requires an S3 URI – worth stating “must be an S3/S3-compatible URI”.
Minor doc tweak keeps future users from feeding plain paths.

packages/apps/postgres/README.md (1)

14-22: Backup snippet contradicts the instructions (enabled: false)

The paragraph says “set backup.enabled to true”, but the YAML that follows keeps it false, which readers will copy verbatim.

-backup:
-  enabled: false
+backup:
+  enabled: true
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6c8d836 and e99d238.

📒 Files selected for processing (5)
  • packages/apps/postgres/Chart.yaml (1 hunks)
  • packages/apps/postgres/README.md (2 hunks)
  • packages/apps/postgres/values.schema.json (3 hunks)
  • packages/apps/postgres/values.yaml (1 hunks)
  • packages/apps/versions_map (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • packages/apps/postgres/Chart.yaml
  • packages/apps/versions_map
  • packages/apps/postgres/values.schema.json
🧰 Additional context used
🪛 LanguageTool
packages/apps/postgres/README.md

[grammar] ~16-~16: Use correct spacing
Context: ...e-pg> ## Operations ### How to enable backups To back up a PostgreSQL application, an...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~20-~20: Use articles correctly
Context: ...and fill in the path and credentials to an backup.*: ```yaml ## PARAM backup.en...

(QB_NEW_EN_OTHER_ERROR_IDS_11)


[grammar] ~40-~40: Use correct spacing
Context: ...te8waeGai0oog ``` ### How to recover a backup CloudNativePG supports point-in-time-re...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~42-~42: Use hyphens correctly
Context: ...ecover a backup CloudNativePG supports point-in-time-recovery. Recovering a backup is done by creating...

(QB_NEW_EN_OTHER_ERROR_IDS_29)


[grammar] ~43-~43: Use correct spacing
Context: ...base instance and restoring the data in it. Create a new PostgreSQL application wit...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~45-~45: Use commas correctly
Context: ...PostgreSQL application with a different name, but identical configuration. Set `bootst...

(QB_NEW_EN_OTHER_ERROR_IDS_33)


[grammar] ~46-~46: Use correct spacing
Context: ...stance to recover from and the recovery time: yaml ## @param bootstrap.enabled Restore database cluster from a backup ## @param bootstrap.recoveryTime Timestamp (PITR) up to which recovery will proceed, expressed in RFC 3339 format. If left empty, will restore latest ## @param bootstrap.oldName Name of database cluster before deleting ## bootstrap: enabled: false recoveryTime: "" # leave empty for latest or exact timestamp; example: 2020-11-26 15:22:00.00000+00 oldName: "<previous-postgres-instance>" ### How to switch primary/secondary replica...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~59-~59: There might be a problem here.
Context: ...`` ### How to switch primary/secondary replica See: - https://cloudnative-pg.io/documentation/1.15/rolling_update/#manual-updates-supervised ## Parameters ### Common parameters | Name ...

(QB_NEW_EN_MERGED_MATCH)


[grammar] ~98-~98: Use correct spacing
Context: ...ch9ahM1te8waeGai0oog` | ### Bootstrap parameters | Name | Descriptio...

(QB_NEW_EN_OTHER_ERROR_IDS_5)

🪛 Gitleaks (8.26.0)
packages/apps/postgres/README.md

36-36: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


37-37: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

packages/apps/postgres/values.yaml

75-75: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


76-76: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Build
🔇 Additional comments (2)
packages/apps/postgres/values.yaml (1)

74-74: Six-field cron expression – confirm CloudNativePG expects seconds

"0 2 * * * *" includes a leading seconds field. CloudNativePG accepts both 5- and 6-field crons depending on operator version. Double-check that 0.17.1 still interprets the first field as seconds; otherwise the job will fire at 02:00 every second for the whole minute.

packages/apps/postgres/README.md (1)

22-38: Mask sample S3 credentials to avoid leaking & failing linters

Same concern as in values.yaml. Replace with obvious placeholders:

-  s3AccessKey: oobaiRus9pah8PhohL1ThaeTa4UVa7gu
-  s3SecretKey: ju3eum4dekeich9ahM1te8waeGai0oog
+  s3AccessKey: "<S3_ACCESS_KEY>"
+  s3SecretKey: "<S3_SECRET_KEY>"

This removes Gitleaks findings and prevents accidental exposure.

⛔ Skipped due to learnings
Learnt from: NickVolynkin
PR: cozystack/cozystack#1120
File: packages/apps/ferretdb/README.md:35-37
Timestamp: 2025-07-02T09:58:11.406Z
Learning: In the cozystack repository, the maintainer NickVolynkin prefers to keep realistic-looking example credentials in README documentation rather than using generic placeholders like <ACCESS_KEY>, even though they are just examples and not real secrets.

Comment on lines 70 to 76
enabled: false
retentionPolicy: 30d
destinationPath: s3://BUCKET_NAME/
destinationPath: s3://bucket/path/to/folder/
endpointURL: http://minio-gateway-service:9000
schedule: "0 2 * * * *"
s3AccessKey: oobaiRus9pah8PhohL1ThaeTa4UVa7gu
s3SecretKey: ju3eum4dekeich9ahM1te8waeGai0oog

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Example S3 credentials look real — replace with obvious placeholders

Static analysis flagged the access & secret keys. Even if they are dummy, anything that looks valid will fail CI hooks (Gitleaks) and risks copy-paste into production.

-  s3AccessKey: oobaiRus9pah8PhohL1ThaeTa4UVa7gu
-  s3SecretKey: ju3eum4dekeich9ahM1te8waeGai0oog
+  # Use your own credentials – these are placeholders
+  s3AccessKey: "<S3_ACCESS_KEY>"
+  s3SecretKey: "<S3_SECRET_KEY>"

Please update the README snippet to match.

🧰 Tools
🪛 Gitleaks (8.26.0)

75-75: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


76-76: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

🤖 Prompt for AI Agents
In packages/apps/postgres/values.yaml around lines 70 to 76, the S3 access and
secret keys appear to be real credentials, which triggers security scanning
tools and risks accidental exposure. Replace these keys with obvious placeholder
values like "YOUR_ACCESS_KEY" and "YOUR_SECRET_KEY" to clearly indicate they are
examples and not real credentials. Also update the README snippet accordingly to
use these placeholders.

@kvaps Andrei Kvapil (kvaps) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kvaps
Andrei Kvapil (kvaps) merged commit f628e7d into main Jul 9, 2025
18 checks passed
@kvaps
Andrei Kvapil (kvaps) deleted the docs-pg-restore branch July 9, 2025 09:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants