From 53869ac14abcf78d360c7bf8071ad7044494c7d2 Mon Sep 17 00:00:00 2001 From: Marc Leuser Date: Sun, 21 Feb 2021 21:38:20 +0100 Subject: [PATCH 1/2] recommend a better way of backing up postgres don't spawn an extra container run pg_dumpall within matrix-postgres instead, ensures correct version store under /matrix so a backup of the folder will contain a DB dump use absolute paths just in case something in the ENV is messed up --- docs/maintenance-postgres.md | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/docs/maintenance-postgres.md b/docs/maintenance-postgres.md index 50f5a55d..a8eb6edf 100644 --- a/docs/maintenance-postgres.md +++ b/docs/maintenance-postgres.md @@ -51,15 +51,12 @@ 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: ```bash -docker run \ ---rm \ ---log-driver=none \ ---network=matrix \ +/usr/bin/docker exec \ --env-file=/matrix/postgres/env-postgres-psql \ -docker.io/postgres:13.1-alpine \ -pg_dumpall -h matrix-postgres \ +matrix-postgres \ +/usr/local/bin/pg_dumpall -h matrix-postgres \ | 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. From ca223559107b20a747f0cda926605d1b4356c0f9 Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Mon, 22 Feb 2021 08:36:42 +0200 Subject: [PATCH 2/2] Update backup docs a bit --- docs/maintenance-postgres.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/docs/maintenance-postgres.md b/docs/maintenance-postgres.md index a8eb6edf..acbea54c 100644 --- a/docs/maintenance-postgres.md +++ b/docs/maintenance-postgres.md @@ -59,9 +59,7 @@ matrix-postgres \ > /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 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. +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. Restoring a backup made this way can be done by [importing it](importing-postgres.md).