2021-08-06 15:36:59 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2023-11-03 10:13:40 +00:00
|
|
|
set -eux pipefail
|
2021-08-06 15:36:59 +00:00
|
|
|
|
|
|
|
function main() {
|
2023-03-24 11:11:57 +00:00
|
|
|
local role_snapshot_id="${1:-latest}"
|
|
|
|
local db_snapshot_id="${2:-latest}"
|
|
|
|
local file_snapshot_id="${3:-latest}"
|
2023-03-10 14:43:21 +00:00
|
|
|
|
2021-08-06 15:36:59 +00:00
|
|
|
|
2021-08-09 22:41:53 +00:00
|
|
|
start-maintenance.sh
|
|
|
|
|
2021-08-06 15:36:59 +00:00
|
|
|
file_env AWS_ACCESS_KEY_ID
|
|
|
|
file_env AWS_SECRET_ACCESS_KEY
|
|
|
|
|
|
|
|
file_env POSTGRES_DB
|
|
|
|
file_env POSTGRES_PASSWORD
|
|
|
|
file_env POSTGRES_USER
|
|
|
|
|
|
|
|
drop-create-db
|
2021-08-09 22:41:53 +00:00
|
|
|
|
2023-03-10 14:43:21 +00:00
|
|
|
restore-roles ${role_snapshot_id}
|
|
|
|
restore-db ${db_snapshot_id}
|
|
|
|
restore-directory '/var/backups/' ${file_snapshot_id}
|
2021-08-06 15:36:59 +00:00
|
|
|
|
2021-12-15 12:49:57 +00:00
|
|
|
end-maintenance.sh
|
2021-08-06 15:36:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
source /usr/local/lib/functions.sh
|
|
|
|
source /usr/local/lib/pg-functions.sh
|
2021-08-09 22:41:53 +00:00
|
|
|
source /usr/local/lib/file-functions.sh
|
2021-12-15 12:49:57 +00:00
|
|
|
|
2023-03-10 14:43:21 +00:00
|
|
|
main "$@"
|