mirror of
https://github.com/spantaleev/matrix-docker-ansible-deploy.git
synced 2024-12-24 18:08:28 +01:00
Merge pull request #901 from marcquark/backup_postgres
Recommend a better way of backing up postgres
This commit is contained in:
commit
fd18769e55
@ -51,20 +51,15 @@ ansible-playbook -i inventory/hosts setup.yml --tags=run-postgres-vacuum,start
|
|||||||
To make a back up of the current PostgreSQL database, make sure it's running and then execute a command like this on the server:
|
To make a back up of the current PostgreSQL database, make sure it's running and then execute a command like this on the server:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker run \
|
/usr/bin/docker exec \
|
||||||
--rm \
|
|
||||||
--log-driver=none \
|
|
||||||
--network=matrix \
|
|
||||||
--env-file=/matrix/postgres/env-postgres-psql \
|
--env-file=/matrix/postgres/env-postgres-psql \
|
||||||
docker.io/postgres:13.1-alpine \
|
matrix-postgres \
|
||||||
pg_dumpall -h matrix-postgres \
|
/usr/local/bin/pg_dumpall -h matrix-postgres \
|
||||||
| gzip -c \
|
| gzip -c \
|
||||||
> /postgres.sql.gz
|
> /matrix/postgres.sql.gz
|
||||||
```
|
```
|
||||||
|
|
||||||
If you are using an [external Postgres server](configuring-playbook-external-postgres.md), the above command will not work, because the credentials file (`/matrix/postgres/env-postgres-psql`) is not available.
|
If you are using an [external Postgres server](configuring-playbook-external-postgres.md), the above command will not work, because neither the credentials file (`/matrix/postgres/env-postgres-psql`), nor the `matrix-postgres` container is available.
|
||||||
|
|
||||||
If your server is on the ARM32 [architecture](alternative-architectures.md), you may need to remove the `-alpine` suffix from the image name in the command above.
|
|
||||||
|
|
||||||
Restoring a backup made this way can be done by [importing it](importing-postgres.md).
|
Restoring a backup made this way can be done by [importing it](importing-postgres.md).
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user