-
Notifications
You must be signed in to change notification settings - Fork 21
PostgreSQL
Self-Hosted SimpleLogin runs a Postgresql database.
Warning: previous versions of this repository ran version 12.1.
You can safely update the version of the container to 12.22.
However this version is no longer supported.
It is recommended to upgrade following instructions from this page.
Upgrading to a minor version is always safe.
- Stop the stack
./down.sh - Update the
postgrescontainer version.
services:
## SIMPLE LOGIN
## ============
postgres:
- image: postgres:12.1
+ image: postgres:12.22
container_name: sl-db
env_file: .env- Start the stack
./up.sh - Cleanup unused docker images.
It is easier to restore a backup to a database running an updated major version. Follow the steps outlined here to upgrade:
Note: those steps assume you are running version 12.1 by default
as initially documented.
- Stop Self-Hosted SimpleLogin (
docker compose down) - Run only the
postgrescontainersl-db(nosl-app,sl-emailorsl-job-runner) with version12.22. (docker compose up -d postgres) - Backup the database
- Stop
sl-db(docker compose down) - Move the
./db/folder for safety (mv ./db/ ./db_pre_update/) - Update
simplelogin-compose.yamlfile to changepostgresversion
postgres:
- image: postgres:12.22
+ image: postgres:17.7
container_name: sl-db
env_file: .env- Start
sl-dbwith version17.7: this will create an empty database. (docker compose up -d postgres) - Move the backup file to the new database folder. (
cp ./db_pre_update/simplelogin.backup ./db/) - Create a new, empty, database folder. (
mkdir ./db/) - Restore the database.
- Stop
postgres(docker compose down) - Start all containers (
docker compose up -d) - Cleanup unused docker images.
From versions 18+ onwards, PostgreSQL images will make it simple to upgrade the database in-place across major versions.
Upgrading from version 17.7 to version 18.x, however, still requires a full database backup and restore.
Perform the following steps to upgrade:
Note: those steps assume you are running version 17.7.
- Stop Self-Hosted SimpleLogin (
docker compose down) - Run only the
postgrescontainersl-db(nosl-app,sl-emailorsl-job-runner) with version17.7. (docker compose up -d postgres) - Backup the database
- Stop
sl-db(docker compose down) - Move the
./db/folder for safety (mv ./db/ ./db_pre_update/) - Create a new, empty, database folder. (
mkdir ./db/) - Update
simplelogin-compose.yamlfile to changepostgresversion
postgres:
- image: postgres:17.7
+ image: postgres:18.1
container_name: sl-db
env_file: .env
volumes:
- - ./db:/var/lib/postgresql/data
+ - ./db:/var/lib/postgresql
restart: unless-stopped- Start
sl-dbwith version18.1: this will create an empty database with data file in the./db/18/docker/subfolder. (docker compose up -d postgres) - Move the backup file to the new database folder. (
cp ./db_pre_update/simplelogin.backup ./db/) - Restore the database (from the container
pg_restore -U user -F c --dbname simplelogin /var/lib/postgresql/simplelogin.backup) - Stop
postgres(docker compose down) - Start all containers (
docker compose up -d) - Cleanup unused docker images.