Convert the Authentik database migration section to steps
This commit is contained in:
@@ -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.
|
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:
|
On the source machine, dump the database:
|
||||||
|
|
||||||
```bash [Terminal]
|
```bash [Terminal]
|
||||||
sudo docker exec authentik-postgresql pg_dump -U authentik -F t authentik > /path/to/mydb.tar
|
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]
|
```bash [Terminal]
|
||||||
cp /path/to/mydb.tar authentik-postgresql:/path/to/wherever
|
cp /path/to/mydb.tar authentik-postgresql:/path/to/wherever
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Purge existing tables
|
||||||
|
|
||||||
(Optional) Purge existing tables:
|
(Optional) Purge existing tables:
|
||||||
|
|
||||||
```bash [Terminal]
|
```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;"
|
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:
|
Restore the database:
|
||||||
|
|
||||||
```bash [Terminal]
|
```bash [Terminal]
|
||||||
sudo docker exec authentik-postgresql pg_restore -U authentik -d authentik /path/to/wherever/mydb.tar
|
sudo docker exec authentik-postgresql pg_restore -U authentik -d authentik /path/to/wherever/mydb.tar
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Done !
|
||||||
|
::
|
||||||
|
|||||||
Reference in New Issue
Block a user