Update postgres/docker-compose-postgres.yml
This commit is contained in:
parent
1eb1021b93
commit
bce7afc7ca
@ -34,10 +34,11 @@ services:
|
|||||||
entrypoint: >
|
entrypoint: >
|
||||||
bash -c "
|
bash -c "
|
||||||
echo 'Waiting for PostgreSQL to start...';
|
echo 'Waiting for PostgreSQL to start...';
|
||||||
until pg_isready -h postgres -U admin; do sleep 1; done;
|
until pg_isready -h ${POSTGRESQL_HOSTNAME_NAME} -U ${POSTGRES_USER}; do sleep 1; done;
|
||||||
echo 'Creating database and restoring backup...';
|
echo 'Creating database ${POSTGRES_DB} if it does not exist...';
|
||||||
psql -h postgres -U admin -c 'CREATE DATABASE mydb;';
|
psql -h ${POSTGRESQL_HOSTNAME_NAME} -U ${POSTGRES_USER} -c 'CREATE DATABASE ${POSTGRES_DB};' || true;
|
||||||
pg_restore -h postgres -U admin -d mydb /backups/backup.dump;
|
echo 'Restoring backup from /backups/backup.dump into ${POSTGRES_DB}...';
|
||||||
|
pg_restore -h ${POSTGRESQL_HOSTNAME_NAME} -U ${POSTGRES_USER} -d ${POSTGRES_DB} ${POSTGRES_DB_DUMP};
|
||||||
echo 'Backup restored successfully.';
|
echo 'Backup restored successfully.';
|
||||||
"
|
"
|
||||||
restart: on-failure
|
restart: on-failure
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user