Docker: Recent changes broke Postgres setup
Some recent changes have broken the database connection on docker setups when upgrading to 1.3rc1
- After upgrade the API container tries to connect with postgres on host
localhost
instead ofpostgres
. SettingDATABASE_HOST=postgres
in the.env
file fixes this - Connection to the server fails with
django.db.utils.OperationalError: connection to server at "postgres" (172.19.0.7), port 5432 failed: FATAL: role "funkwhale" does not exist
.
Not fully sure how to best address this, but here are my suggestions:
SetDATABASE_HOST=postgres
in theenv.prod.sample
file and document the change so users can adjust their existing.env
file on upgradeDocument how to add the "funkwhale" role to the existing postgres container. Obviously this cannot be done by a migration (due to the connection failing), so I assume this is a manual upgrade step
Correction: Actually it is all of the DATABASE_* variables that need different behaviour. So the default environment file should probably contain:
DATABASE_HOST=postgres
DATABASE_USER=postgres
DATABASE_NAME=postgres
to retain the old behaviour.