sync
This commit is contained in:
133
README.md
133
README.md
@@ -11,7 +11,7 @@ BackupSidecar is configured through environment variables. Below is a breakdown
|
||||
These variables apply to both backup and restore operations.
|
||||
|
||||
- **`OPERATION_MODE`** _(optional)_ - Defines the operation type (`backup` or `restore`). Defaults to `backup`.
|
||||
- **`BACKUP_MODE`** _(optional)_ - Defines the backup type (`directory` or `postgres`). Defaults to `directory`.
|
||||
- **`BACKUP_MODE`** _(optional)_ - Defines the backup type (`directory`, `postgres`, or `s3`). Defaults to `directory`.
|
||||
- **`RESTIC_PASSWORD`** _(required)_ - The encryption password for Restic.
|
||||
- **`RESTIC_REPOSITORY`** _(required)_ - The URI of the Restic repository (e.g., `rest:http://your-rest-server:8000/backup`).
|
||||
- **`RESTIC_REST_USERNAME`** _(optional)_ - The username for REST server authentication.
|
||||
@@ -55,6 +55,22 @@ For `postgres` mode, the following database-related variables are required:
|
||||
- **`RESTORE_SNAPSHOT_ID`** _(optional)_ - The specific snapshot ID to restore (defaults to `latest`).
|
||||
- **`PSQL_ARGS`** _(optional)_ - Additional flags for `psql` (e.g., `--single-transaction`).
|
||||
|
||||
### S3 Operations
|
||||
|
||||
For `s3` mode, the following S3-related variables are required:
|
||||
|
||||
**Common Variables:**
|
||||
|
||||
- **`S3_BUCKET`** _(required)_ - The name of the S3 bucket to backup/restore.
|
||||
- **`S3_ENDPOINT`** _(required)_ - The S3 endpoint URL (e.g., `http://minio:9000` for MinIO).
|
||||
- **`MINIO_ACCESS_KEY`** _(required)_ - The MinIO access key for S3 authentication.
|
||||
- **`MINIO_SECRET_KEY`** _(required)_ - The MinIO secret key for S3 authentication.
|
||||
- **`S3_PREFIX`** _(optional)_ - Optional path prefix within the bucket to backup/restore.
|
||||
|
||||
**Restore-Specific Variables:**
|
||||
|
||||
- **`RESTORE_SNAPSHOT_ID`** _(optional)_ - The specific snapshot ID to restore (defaults to `latest`).
|
||||
|
||||
## Dependencies
|
||||
|
||||
Ensure the following commands are available in the container:
|
||||
@@ -64,6 +80,7 @@ Ensure the following commands are available in the container:
|
||||
- `jq`
|
||||
- `pg_dump` _(only required for PostgreSQL backup operations)_
|
||||
- `psql` _(only required for PostgreSQL restore operations)_
|
||||
- `mc` _(only required for S3 operations)_
|
||||
|
||||
## Usage
|
||||
|
||||
@@ -236,6 +253,120 @@ spec:
|
||||
value: "Database Restore Notification"
|
||||
```
|
||||
|
||||
Example Kubernetes Job manifest for running BackupSidecar to backup an S3 bucket:
|
||||
|
||||
```yaml
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: backupsidecar-s3-backup
|
||||
namespace: authentik
|
||||
spec:
|
||||
backoffLimit: 3
|
||||
activeDeadlineSeconds: 600
|
||||
template:
|
||||
spec:
|
||||
restartPolicy: OnFailure
|
||||
containers:
|
||||
- name: backupsidecar
|
||||
image: backupsidecar:latest
|
||||
env:
|
||||
- name: OPERATION_MODE
|
||||
value: "backup"
|
||||
- name: BACKUP_MODE
|
||||
value: "s3"
|
||||
- name: S3_BUCKET
|
||||
value: "my-bucket"
|
||||
- name: S3_ENDPOINT
|
||||
value: "http://minio:9000"
|
||||
- name: S3_PREFIX
|
||||
value: "data" # optional
|
||||
- name: MINIO_ACCESS_KEY
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: minio-secret
|
||||
key: access_key
|
||||
- name: MINIO_SECRET_KEY
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: minio-secret
|
||||
key: secret_key
|
||||
- name: RESTIC_REPOSITORY
|
||||
value: "rest:http://rest-server:8000/backup"
|
||||
- name: RESTIC_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: backupsidecar-secret
|
||||
key: restic_password
|
||||
- name: GOTIFYHOST
|
||||
value: "http://gotify.example.com"
|
||||
- name: GOTIFYTOKEN
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: backupsidecar-secret
|
||||
key: gotify_token
|
||||
- name: GOTIFYTOPIC
|
||||
value: "S3 Backup Notification"
|
||||
```
|
||||
|
||||
Example Kubernetes Job manifest for running BackupSidecar to restore an S3 bucket:
|
||||
|
||||
```yaml
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: backupsidecar-s3-restore
|
||||
namespace: authentik
|
||||
spec:
|
||||
backoffLimit: 3
|
||||
activeDeadlineSeconds: 600
|
||||
template:
|
||||
spec:
|
||||
restartPolicy: OnFailure
|
||||
containers:
|
||||
- name: backupsidecar
|
||||
image: backupsidecar:latest
|
||||
env:
|
||||
- name: OPERATION_MODE
|
||||
value: "restore"
|
||||
- name: BACKUP_MODE
|
||||
value: "s3"
|
||||
- name: S3_BUCKET
|
||||
value: "my-bucket"
|
||||
- name: S3_ENDPOINT
|
||||
value: "http://minio:9000"
|
||||
- name: S3_PREFIX
|
||||
value: "data" # optional
|
||||
- name: RESTORE_SNAPSHOT_ID
|
||||
value: "abc123def456" # optional, defaults to latest
|
||||
- name: MINIO_ACCESS_KEY
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: minio-secret
|
||||
key: access_key
|
||||
- name: MINIO_SECRET_KEY
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: minio-secret
|
||||
key: secret_key
|
||||
- name: RESTIC_REPOSITORY
|
||||
value: "rest:http://rest-server:8000/backup"
|
||||
- name: RESTIC_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: backupsidecar-secret
|
||||
key: restic_password
|
||||
- name: GOTIFYHOST
|
||||
value: "http://gotify.example.com"
|
||||
- name: GOTIFYTOKEN
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: backupsidecar-secret
|
||||
key: gotify_token
|
||||
- name: GOTIFYTOPIC
|
||||
value: "S3 Restore Notification"
|
||||
```
|
||||
|
||||
## Notifications
|
||||
|
||||
The script can send success or failure notifications via Gotify when enabled. To enable notifications, set `ENABLE_GOTIFY=true` and provide the required Gotify configuration variables (`GOTIFYHOST`, `GOTIFYTOKEN`, `GOTIFYTOPIC`). When notifications are disabled, backup status messages are still logged to the console.
|
||||
|
||||
Reference in New Issue
Block a user