Skip to content
This repository has been archived by the owner on Jan 18, 2024. It is now read-only.

Add Support for GCS and Azure backups #401

Merged
merged 14 commits into from
Jan 24, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions charts/timescaledb-single/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,16 @@ Please see the included NOTICE for copyright information and LICENSE for a copy
# TimescaleDB Single

##### Table of Contents
- [Introduction](#introduction)
- [Installing](#installing)
- [Installing from the Timescale Helm Repo](#installing-from-the-timescale-helm-repo)
- [Connecting to TimescaleDBs](#connecting-to-timescaledbs)
- [Connecting from inside the Cluster](#connecting-from-inside-the-cluster)
- [Create backups to S3](#create-backups-to-s3)
- [Cleanup](#cleanup)
- [Further reading](#further-reading)
- [TimescaleDB Single](#timescaledb-single)
gunnarsundberg marked this conversation as resolved.
Show resolved Hide resolved
- [Table of Contents](#table-of-contents)
- [Introduction](#introduction)
- [Installing](#installing)
- [Installing from the Timescale Helm Repo](#installing-from-the-timescale-helm-repo)
- [Connecting to TimescaleDBs](#connecting-to-timescaledbs)
- [Connecting from inside the Cluster](#connecting-from-inside-the-cluster)
- [Create backups to S3 or GCS](#create-backups-to-s3-or-gcs)
- [Cleanup](#cleanup)
- [Further reading](#further-reading)

## Introduction
This directory contains a Helm chart to deploy a three
Expand Down Expand Up @@ -139,7 +141,7 @@ RELEASE=my-release
kubectl exec -ti $(kubectl get pod -o name -l role=master,release=$RELEASE) psql
```

## Create backups to S3
## Create backups to S3 or GCS
The backup is disabled by default, look at the
[Administrator Guide](admin-guide.md#backups) on how to configure backup location, credentials, schedules, etc.

Expand Down
25 changes: 25 additions & 0 deletions charts/timescaledb-single/admin-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,31 @@ backup:
helm upgrade --install example -f myvalues.yaml charts/timescaledb-single
```

### Create backups to GCS
the following items are required for you to enable creating backups to GCS:

- a GCS bucket available for your backups
- a [Service Account](https://cloud.google.com/storage/docs/projects#service-accounts)
- [IAM Permissions for Cloud Storage](https://docs.aws.amazon.com/AmazonS3/latest/user-guide/add-bucket-policy.html) that allows the service account read and write access to (parts of) the bucket
- [Service Account Key](https://cloud.google.com/iam/docs/creating-managing-service-account-keys) for authentication

The service account key should be configured through the `RELEASE-pgbackrest-secrets` secret. Once you create this secret
with the service account key, you can enable backups by setting `backup.enabled` to `true` and configuring `pgabackrest` to use GCS for backups. For example, if `RELEASE-pgbackrest-secrets` was configured as `your-service-key.json`:

```yaml
# Filename: myvalues.yaml
backup:
enabled: true
pgBackRest:
repo1-type: gcs
repo1-path: /repo
repo1-gcs-bucket: your-bucket
repo1-gcs-key: /etc/pgbackrest_secrets/your-service-key.json
```
```
helm upgrade --install example -f myvalues.yaml charts/timescaledb-single
```

### Control the backup schedule
If you want to alter the backup jobs, or their schedule, you can override the `backup.jobs` in your configuration, for example:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,9 @@ spec:
- mountPath: {{ template "scripts_dir" . }}
name: timescaledb-scripts
readOnly: true
- mountPath: /etc/pgbackrest_secrets
name: pgbackrest-secrets
readOnly: true
- mountPath: {{ template "post_init_dir" . | quote }}
name: post-init
readOnly: true
Expand Down Expand Up @@ -403,6 +406,9 @@ spec:
- mountPath: {{ template "scripts_dir" . }}
name: timescaledb-scripts
readOnly: true
- mountPath: /etc/pgbackrest_secrets
name: pgbackrest-secrets
readOnly: true
env:
- name: PGHOST
value: {{ template "socket_directory" . }}
Expand Down Expand Up @@ -510,6 +516,11 @@ spec:
name: {{ template "timescaledb.fullname" . }}-pgbackrest
defaultMode: 416 # 0640 permissions
optional: true
- name: pgbackrest-secrets
Copy link
Contributor

Choose a reason for hiding this comment

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

You just made this secret mandatory, not just for those wanting to enable GCS backups, but for everyone.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Would it be mandatory since line 523 is optional: true?

Copy link
Contributor

Choose a reason for hiding this comment

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

I stand corrected. I didn't see that and didn't know about the optional option.

secret:
secretName: {{ template "timescaledb.fullname" . }}-pgbackrest-secrets
defaultMode: 416
optional: true
- name: certificate
secret:
secretName: {{ template "secrets_certificate" . }}
Expand Down