mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2024-11-24 02:24:07 +03:00
188ff966f8
* Re-organize compose/ into environment-specific file groups Closes #1316. * Commit missing files That was weird: git failed to commit one specific folder previously
26 lines
741 B
Bash
26 lines
741 B
Bash
#!/usr/bin/env bash
|
|
|
|
set -o errexit
|
|
set -o pipefail
|
|
set -o nounset
|
|
|
|
|
|
# we might run into trouble when using the default `postgres` user, e.g. when dropping the postgres
|
|
# database in restore.sh. Check that something else is used here
|
|
if [ "$POSTGRES_USER" == "postgres" ]
|
|
then
|
|
echo "creating a backup as the postgres user is not supported, make sure to set the POSTGRES_USER environment variable"
|
|
exit 1
|
|
fi
|
|
|
|
# export the postgres password so that subsequent commands don't ask for it
|
|
export PGPASSWORD=$POSTGRES_PASSWORD
|
|
|
|
echo "creating backup"
|
|
echo "---------------"
|
|
|
|
FILENAME=backup_$(date +'%Y_%m_%dT%H_%M_%S').sql.gz
|
|
pg_dump -h postgres -U $POSTGRES_USER | gzip > /backups/$FILENAME
|
|
|
|
echo "successfully created backup $FILENAME"
|