Files
authentik/website/docs/troubleshooting/postgres/upgrade_docker.md
4d62 f388cac07c website/docs: next release notes: add upgrade instructions for postgres to 16 (#9727)
* init

Signed-off-by: 4d62 <157558804+4d62ext@users.noreply.github.com>

* start

* db pass upd

* more

* oops

* simplify setting up v16 service

* cut off pg

* finish

* release breaking changes

* 2024.next

* i need to be less distracted

* rework upgrade instructions

Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>

* ci: remove postgres 12 tests

Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>

* spelling

Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>

* try?

* fix release notes

* iirc theres a danger thing

* typo

* suggestion

Co-authored-by: Tana M Berry <tanamarieberry@yahoo.com>
Signed-off-by: 4d62 <157558804+4d62ext@users.noreply.github.com>

* suggestion

Co-authored-by: Tana M Berry <tanamarieberry@yahoo.com>
Signed-off-by: 4d62 <157558804+4d62ext@users.noreply.github.com>

* suggestion

Co-authored-by: Tana M Berry <tanamarieberry@yahoo.com>
Signed-off-by: 4d62 <157558804+4d62ext@users.noreply.github.com>

* suggestion

Co-authored-by: Tana M Berry <tanamarieberry@yahoo.com>
Signed-off-by: 4d62 <157558804+4d62ext@users.noreply.github.com>

* suggestion

Co-authored-by: Tana M Berry <tanamarieberry@yahoo.com>
Signed-off-by: 4d62 <157558804+4d62ext@users.noreply.github.com>

* suggestion

Co-authored-by: Tana M Berry <tanamarieberry@yahoo.com>
Signed-off-by: 4d62 <157558804+4d62ext@users.noreply.github.com>

* suggestion

Co-authored-by: Tana M Berry <tanamarieberry@yahoo.com>
Signed-off-by: 4d62 <157558804+4d62ext@users.noreply.github.com>

* Update website/docs/troubleshooting/postgres/upgrade_docker.md

Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>

* prettier

Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>

* add to sidebar 

Signed-off-by: 4d62 <ext@4d62.me>

* 🙊

Signed-off-by: 4d62 <ext@4d62.me>

* make website

Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>

---------

Signed-off-by: 4d62 <157558804+4d62ext@users.noreply.github.com>
Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>
Signed-off-by: 4d62 <ext@4d62.me>
Co-authored-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>
Co-authored-by: Tana M Berry <tanamarieberry@yahoo.com>
2024-05-29 15:31:21 +02:00

1.7 KiB

title
title
Upgrade PostgreSQL on Docker Compose

Dump your database

Dump your existing database with docker compose exec postgresql pg_dump -U authentik -d authentik -cC > upgrade_backup_12.sql.

Stop your authentik stack

Stop all services with docker compose down.

Backup your existing database

If you use Docker volumes you can run the following command: docker volume create authentik_database_backup && docker run --rm -v authentik_database:/from -v authentik_database_backup:/to alpine sh -c 'cd /from && cp -a . /to'. You can find the name of the authentik_database volume with docker volume ls.

If your data is a file path: cp -a /path/to/v12-data /path/to/v12-backup

Delete your old database

:::::danger Do not execute this step without checking that the backup (previous step) completed successfully. :::::

If you use Docker volumes: docker volume rm -f authentik_database.

If your data is a file path: rm -rf /path/to/v12-data

Modify your docker-compose.yml file

Update the PostgreSQL service image from docker.io/library/postgres:12-alpine to docker.io/library/postgres:16-alpine.

Add network_mode: none to prevent connections being established to the database during the upgrade.

Recreate the database container

Pull new images and re-create the PostgreSQL container: docker compose pull && docker compose up --force-recreate -d postgresql

Apply your backup to the new database: cat upgrade_backup_12.sql | docker compose exec postgresql psql -U authentik

Remove the network configuration setting network_mode: none that you added to the Compose file in the previous step.

Recreate authentik

Start authentik again: docker compose up --force-recreate -d