... | ... | @@ -80,7 +80,7 @@ You can also do that from a container: |
|
|
|
|
|
```bash
|
|
|
docker ps # get a listing of all containers on this machine
|
|
|
docker exec -it wyatt_local_db psql -U wyatt # to open psql (DB command line interaction) interactively as user wyatt on DB container wyatt_local_db
|
|
|
docker exec -it wyatt_local_db psql -U postgres # to open psql (DB command line interaction) interactively as user wyatt on DB container wyatt_local_db
|
|
|
\l # lists all DB's
|
|
|
\c <name of DB> # connects to DB
|
|
|
\d # describes all in that DB
|
... | ... | @@ -189,9 +189,9 @@ cd /tmp/backup-restore |
|
|
aws $AWS_OPTS s3 cp s3://xlrit-backups/wyatt_${SOURCE_ENV}_db/wyatt_${SOURCE_ENV}_db_${DATE}.zip .
|
|
|
unzip wyatt_${SOURCE_ENV}_db_${DATE}.zip # enter password
|
|
|
docker cp backups/wyatt_${SOURCE_ENV}_db_${DATE}.db wyatt_${TARGET_ENV}_db:/tmp/wyatt.db
|
|
|
docker exec -t wyatt_${TARGET_ENV}_db psql -U wyatt -d wyatt -c "DROP SCHEMA IF EXISTS public CASCADE;"
|
|
|
docker exec -t wyatt_${TARGET_ENV}_db psql -U wyatt -d wyatt -c "CREATE SCHEMA IF NOT EXISTS public;"
|
|
|
docker exec -t wyatt_${TARGET_ENV}_db pg_restore --verbose --create -Fc -U wyatt -d wyatt /tmp/wyatt.db
|
|
|
docker exec -t wyatt_${TARGET_ENV}_db psql -U postgres -d postgres -c "DROP SCHEMA IF EXISTS public CASCADE;"
|
|
|
docker exec -t wyatt_${TARGET_ENV}_db psql -U postgres -d postgres -c "CREATE SCHEMA IF NOT EXISTS public;"
|
|
|
docker exec -t wyatt_${TARGET_ENV}_db pg_restore --verbose --create -Fc -U postgres -d postgres /tmp/wyatt.db
|
|
|
```
|
|
|
|
|
|
Afterwards you can safely start the application again. All should work now on the target environment but with a restored DB from that environment and that date.
|
... | ... | |