Postgres 12 went end of life Nov 2024
Postgres 12, used by Simplelogin went end of life November 2024. I've seen some reports of people successfully using Postgres 13 but that even went end of life November 2025,
Specifically, the docker image for version 12.1 was released 6 years ago.
Is it possible to use version 14 or higher to stay with something supported?
https://endoflife.date/postgresql.
I have been able to change my tag to 12.22 which is the last version released and all seems to be OK. This image is approximately 1 year old.
Many thanks
I have been able to upgrade to 17.7 without issue.
This seems to run successfully in a self-hosted scenario so far.
You need to:
- Stop SimpleLogin
- Run only the
postgrescontainersl-db(nosl-app,sl-emailorsl-job-runner) with version12.22. - Backup the database
- Stop
sl-db - Remove the
./db/folder and re-create it empty. - Start
sl-dbwith version17.7: this will create an empty database. - Restore the database.
- Restart all containers.
Hey @springcomp . Thank you very mush!! This worked fine for me! Time will tell if there are any issues but all seems good so far.
I wonder if there is a reason why this is not the case for new deployments?
To make it easier for others:
- Stop SimpleLogin (
docker compose down) - Run only the postgres container sl-db (no sl-app, sl-email or sl-job-runner) with version 12.22. (
docker compose up -d postgres) - Backup the database
- Stop sl-db (
docker compose down) - Move the ./db/ folder to keep the old version safe (
mv db db_pre_update) - Modify compose file to change postgres version
- Start sl-db with version 17.7: this will create an empty database. (
docker compose up -d postgres) - Move the backup file in to the new db folder
cp db_pre_update/simplelogin.backup db - Restore the database.
- Stop postgres (
docker compose down) - Start all containers (
docker compose up -d)
@preArcMed821 FYI, I was also able to run version 18.1 without issue for a few hours.
Thanks again @springcomp. I just completed the upgrade without issue. I'd missed your guide and had just written up my own to share and then saw yours, and they are essentially identical 💯
Great to see you have modified the compose file on your repo 👍 Thanks for all your contributions.
For anyone else reading this, I highly recommend @springcomp 's repo and guide for setting up SimpleLogin fullly in Docker (including Postfix) with Traefik:
Hi @springcomp @preArcMed821 - would you guys happen to know how to upgrade postgres without the docker compose setup but just the standard docker install? running app-ci:v4.70.0 at current...
I saw tne convo with @nguyenkims on the proposed amendment of the official upgrade doc and would be curious if I could ask you for the safe recipe to upgrade to postgres 18.x or later. Keen to have a supported version of the database as well...
@melbv
This should do it (use at your own risk!)
Overview
This guide covers PostgreSQL upgrades for the upstream self-hosted SimpleLogin setup
that uses standalone docker run commands (not Docker Compose).
The recommended strategy for major upgrades is always:
- Stop SimpleLogin application containers.
- Create a verified backup.
- Start a new PostgreSQL version with a fresh data directory.
- Restore the backup.
- Validate before resuming traffic.
This minimizes upgrade risk and provides a clear rollback path.
Assumptions
- PostgreSQL container name is
sl-db. - App containers are
sl-app,sl-email,sl-job-runner. - Data directory on host is
$(pwd)/sl/db. - Database name is
simplelogin. - The same PostgreSQL credentials are reused after upgrade.
If your setup differs, adjust container names and paths accordingly.
Preflight Checks
Run these checks before changing versions:
docker ps --format '{{.Names}}' | grep -E '^sl-db$'
docker exec -it sl-db psql -U myuser -d simplelogin -c 'SELECT version();'
Replace myuser with your PostgreSQL user.
Backup (Required)
Create a compressed custom-format backup on the host:
mkdir -p ./sl/db
docker exec -t sl-db pg_dump -U myuser -d simplelogin -F c > ./sl/simplelogin.backup
Validate the backup file before continuing:
test -s ./sl/simplelogin.backup
Optional extra safety:
sha256sum ./sl/simplelogin.backup
Minor Version Upgrade
Minor upgrades are usually in-place and low risk (example: 12.1 -> 12.22).
- Stop and remove the current PostgreSQL container:
docker stop sl-db
docker rm sl-db
- Start the new minor version with the existing data volume:
docker run -d \
--name sl-db \
-e POSTGRES_PASSWORD=mypassword \
-e POSTGRES_USER=myuser \
-e POSTGRES_DB=simplelogin \
-p 127.0.0.1:5432:5432 \
-v $(pwd)/sl/db:/var/lib/postgresql/data \
--restart always \
--network="sl-network" \
postgres:12.22
- Verify:
docker exec -it sl-db psql -U myuser -d simplelogin -c 'SELECT version();'
Major Version Upgrade (up to PostgreSQL 17.x)
Use backup/restore for major upgrades (example: 12.x -> 17.7).
- Stop app containers to avoid writes during backup/restore:
docker stop sl-app sl-email sl-job-runner
-
Create and verify backup (see previous section).
-
Stop and remove old PostgreSQL container:
docker stop sl-db
docker rm sl-db
- Preserve old data directory for rollback:
mv ./sl/db ./sl/db_pre_update_$(date +%Y%m%d_%H%M%S)
mkdir -p ./sl/db
- Start new PostgreSQL major version with fresh data directory:
docker run -d \
--name sl-db \
-e POSTGRES_PASSWORD=mypassword \
-e POSTGRES_USER=myuser \
-e POSTGRES_DB=simplelogin \
-p 127.0.0.1:5432:5432 \
-v $(pwd)/sl/db:/var/lib/postgresql/data \
--restart always \
--network="sl-network" \
postgres:17.7
- Wait for readiness:
until docker exec sl-db pg_isready -U myuser -d simplelogin -h 127.0.0.1 -p 5432; do sleep 2; done
- Restore:
cat ./sl/simplelogin.backup | docker exec -i sl-db pg_restore -U myuser -d simplelogin --clean --if-exists --no-owner --no-privileges
- Validate data:
docker exec -it sl-db psql -U myuser -d simplelogin -c 'SELECT COUNT(*) FROM users;'
- Resume app containers:
docker start sl-app sl-email sl-job-runner
Upgrade to PostgreSQL 18+
Moving from 17.x to 18.x still requires backup/restore.
Important change for official images from 18+: host volume should target
/var/lib/postgresql (not /var/lib/postgresql/data).
- Repeat the same major-upgrade flow above through the backup step.
- Start PostgreSQL 18+ with the new mount target:
docker run -d \
--name sl-db \
-e POSTGRES_PASSWORD=mypassword \
-e POSTGRES_USER=myuser \
-e POSTGRES_DB=simplelogin \
-p 127.0.0.1:5432:5432 \
-v $(pwd)/sl/db:/var/lib/postgresql \
--restart always \
--network="sl-network" \
postgres:18.1
- Wait for readiness and restore using the same restore command.
For PostgreSQL 18+, data files are expected under a versioned subdirectory
inside ./sl/db after first start.
Rollback
If validation fails after restore:
- Stop and remove the new
sl-dbcontainer. - Move failed data directory aside.
- Restore old data directory from
./sl/db_pre_update_*. - Start PostgreSQL with the previous image tag.
Example:
docker stop sl-db
docker rm sl-db
mv ./sl/db ./sl/db_failed_$(date +%Y%m%d_%H%M%S)
mv "$(ls -dt ./sl/db_pre_update_* | head -1)" ./sl/db
After rollback, verify with:
docker exec -it sl-db psql -U myuser -d simplelogin -c 'SELECT version();'
Post-Upgrade Checklist
- PostgreSQL version is the expected target version.
- Application login works.
- Alias creation and forwarding still work.
- No recurring database errors in logs:
docker logs --tail=200 sl-db
docker logs --tail=200 sl-app
@springcomp - thanks a million - ill have a spin today
Thanks for the effort there @springcomp - it seems i had massive conflicts between the pg_dump version i had in the container, the one I had on the machine and the pg_restore i was then using and my .backup file seemed corrupted. I decided not to move versions at the end and stayed at 12.1 - it seems I am not savy enough with db utilities to not make a mess of the upgrade...
Thanks @springcomp, upgraded postgres from 12.1 to 18.4 by following your guide here and it works with SimpleLogin app version 4.81.6 - latest at the time of writing
I did make my own compose.yaml since I was unaware of yours :)
Finally managed to update to PG18 and latest app. Believe it or not, my version of Ubuntu (20.04 at the time) was the principal blocker to update to PG17... Thanks @springcomp for the tutorial