Upgrade umami v1 to v2
How I upgraded umami docker compose from v1 to v2.
I am using a self-hosted analytics tool called umami. It is easy to understand, unlike Google Analytics which needs a degree to get the basics and it's on my server. So no headaches regarding GDPR and stuff.
I am running this with docker compose
and sometimes the upgrade process is, let's say, a bit tricky. Therefore I waited for the big v2.x
update.
Today I figured let's see what this v2.x
is all about. Checking Github Issues and Discussions I saw nothing problematic, so let's do it.
I also found some docs regarding the migration from v1
to v2
:
Upgrading umami
I am currently running these tags:
ghcr.io/umami-software/umami:postgresql-v1.40.0
postgres:12.14-alpine
First I checked which version of PostgreSQL is supported and I am in luck, v12.14 is the minium version. Found that
Create a backup
First things first: Always create a backup!
docker exec -it blog_umami-db_1 pg_dumpall -U umami > umami-All.dump
Migration
The migration needs to be run in the OLD version of the container. So in my case v1.40.0
which already was running. I found that weird, but here we go:
Migration output:
Updating
After the migration was successful I just had to update my docker image tag to the latest stable one: postgresql-v2.5.0
That was it!
Updating postgres
My current PostgreSQL container was running with the tag postgres:12.14-alpine
. So I updated to the latest patch release of the version 12
which is 12.16
as of writing this.
Then I tried to update the container to the version 13.12
but that did not work. The container kept restarting. After some Google Foo, I discovered that PostgreSQL will not do the migration for you. It will actually refuse to start when there is an older database version in the database location.
You actually need to create a database dump. Start a fresh and empty PostgreSQL container and then import that dump into the new instance.
Personally, I would prefer to do the migration at startup, but hey, you can not get it all. I know it could be possible with pg_upgrade
.
Here are some more info regarding this:
Since I am still in the minimum requirement for umami I will do this another time. Too lazy right now. 😉