mirror of
https://github.com/OneUptime/oneuptime
synced 2024-11-22 15:24:55 +00:00
11 lines
661 B
Bash
11 lines
661 B
Bash
# This file takes last 30 days backup. Make sure you run this file atleast once/day.
|
|
# The backup will be in the format of db-(date of the month).backup
|
|
# Before the backup, please make sure DATABASE_RESTORE_* ENV vars in config.env is set properly.
|
|
|
|
export $(grep -v '^#' config.env | xargs)
|
|
|
|
sudo docker run -it --net=host --rm \
|
|
--env-file config.env \
|
|
--volume=$(pwd)$DATABASE_RESTORE_DIRECTORY:/var/lib/postgresql/data \
|
|
postgres:latest /usr/bin/pg_restore --dbname=postgresql://$DATABASE_RESTORE_USERNAME:$DATABASE_RESTORE_PASSWORD@$DATABASE_RESTORE_HOST:$DATABASE_RESTORE_PORT/$DATABASE_RESTORE_NAME /var/lib/postgresql/data/$DATABASE_RESTORE_FILENAME
|