diff --git a/content/en/3.serveex/91.advanced/1.authentik.md b/content/en/3.serveex/91.advanced/1.authentik.md index 809141a..304cd16 100644 --- a/content/en/3.serveex/91.advanced/1.authentik.md +++ b/content/en/3.serveex/91.advanced/1.authentik.md @@ -593,26 +593,38 @@ Then configure the applications to protect as you did on your main server, wheth The commands below assume the Postgres container is named `authentik-postgresql`, matching the [Installation](#installation) section above. Adjust it if you renamed yours. :: +::steps{level="3"} +### Dump the database + On the source machine, dump the database: ```bash [Terminal] sudo docker exec authentik-postgresql pg_dump -U authentik -F t authentik > /path/to/mydb.tar ``` -Then transfer it to the target machine. On the target machine, copy the file into the Docker container: +### Transfer the dump + +Transfer it to the target machine, then copy the file into the Docker container: ```bash [Terminal] cp /path/to/mydb.tar authentik-postgresql:/path/to/wherever ``` +### Purge existing tables + (Optional) Purge existing tables: ```bash [Terminal] sudo docker exec -i authentik-postgresql psql -U authentik -c "SELECT pg_terminate_backend(pg_stat_activity.pid) FROM pg_stat_activity WHERE pg_stat_activity.datname = 'authentik' AND pid <> pg_backend_pid();" && sudo docker exec -i authentik-postgresql psql -U authentik -d postgres -c "DROP DATABASE IF EXISTS authentik;" && sudo docker exec -i authentik-postgresql psql -U authentik -d postgres -c "CREATE DATABASE authentik;" ``` +### Restore the database + Restore the database: ```bash [Terminal] sudo docker exec authentik-postgresql pg_restore -U authentik -d authentik /path/to/wherever/mydb.tar ``` + +### Done ! +::