|
4 | 4 |
|
5 | 5 | Postgres-backup backup postgres database to local or remote storage. |
6 | 6 | # usage |
7 | | -## docker |
| 7 | +## backup |
| 8 | +### docker |
8 | 9 | ```shell |
9 | 10 | docker run -v ./config.hcl:/etc/postgres_backup/config.hcl ghcr.io/deltalaboratory/postgres-backup:latest |
10 | 11 | ``` |
11 | | -## docker compose |
| 12 | +### docker compose |
12 | 13 | ```yaml |
13 | 14 | backup: |
14 | 15 | image: ghcr.io/deltalaboratory/postgres-backup:latest |
15 | 16 | volumes: |
16 | 17 | - ./postgres-backup.hcl:/etc/postgres_backup/config.hcl |
17 | 18 | restart: unless-stopped |
18 | 19 | ``` |
| 20 | +
|
| 21 | +## restore |
| 22 | +The restore command allows you to restore PostgreSQL databases from backups stored in S3 or local storage. |
| 23 | +
|
| 24 | +### examples |
| 25 | +```shell |
| 26 | +# List available backups from all configured storage backends |
| 27 | +postgres-backup restore --list |
| 28 | + |
| 29 | +# Restore the latest backup to the configured database |
| 30 | +postgres-backup restore --latest |
| 31 | + |
| 32 | +# Restore a specific backup by timestamp/filename |
| 33 | +postgres-backup restore --backup 2024-01-15T10:30:00 |
| 34 | + |
| 35 | +# Restore to a different database |
| 36 | +postgres-backup restore --latest --to-database mydb_restored |
| 37 | + |
| 38 | +# Restore from specific storage backend only |
| 39 | +postgres-backup restore --list --storage s3 |
| 40 | +postgres-backup restore --latest --storage local |
| 41 | +``` |
| 42 | + |
| 43 | +### docker restore |
| 44 | +```shell |
| 45 | +# List backups |
| 46 | +docker run -v ./config.hcl:/etc/postgres_backup/config.hcl ghcr.io/deltalaboratory/postgres-backup:latest restore --list |
| 47 | + |
| 48 | +# Restore latest backup |
| 49 | +docker run -v ./config.hcl:/etc/postgres_backup/config.hcl ghcr.io/deltalaboratory/postgres-backup:latest restore --latest |
| 50 | +``` |
19 | 51 | # configuration |
20 | 52 | this project uses [HCL](https://github.com/hashicorp/hcl) for configuration file. |
21 | 53 | default configuration find path is "/etc/postgres_backup/config.hcl". this can be overridden by environment variable `CONFIG_PATH`. |
@@ -105,7 +137,7 @@ verbose = false |
105 | 137 | - [ ] Support multiple database backup |
106 | 138 | - [ ] Support notification |
107 | 139 | - [X] Support backup retention |
108 | | -- [ ] Support backup restore |
| 140 | +- [X] Support backup restore |
109 | 141 | - [ ] Support streaming compress/upload backup |
110 | 142 | - [ ] Support backup encryption |
111 | 143 | - [ ] Support backup status dashboard? |
0 commit comments