ERROR [TypeOrmModule] Unable to connect to the database
Is anyone else having this issue here? https://github.com/immich-app/immich/issues/2476
I've tired the fix here https://github.com/immich-app/immich/issues/2931#issuecomment-1605396092 but it won't work as the postgres container won't start for long enough to be able to exec into the bash to apply the fix.
GitHub
[BUG] Docker stack can not connect to DB · Issue #2476 · immich-app...
The bug For unknow reason my docker crashed. After that i am unable to get Immich to work. I have tried backup of the whole VM running docker and also tried to create new networks and assign them i...
GitHub
[BUG] Postgres database failed to start after 1.63.0 update · Issue...
The bug I updated my docker containers this morning to the latest versions and Immich fails to full start (get a 500 error). There are errors in the logs that it cannot connect to the database. So ...
25 Replies
If your postgres container isn't starting up at all then this is probably not an immich problem. Can you post the postgres logs?
20/08/2023 22:10:19 Error: Database is uninitialized and superuser password is not specified. 20/08/2023 22:10:19 You must specify POSTGRES_PASSWORD to a non-empty value for the 20/08/2023 22:10:19 superuser. For example, "-e POSTGRES_PASSWORD=password" on "docker run". 20/08/2023 22:10:19 20/08/2023 22:10:19 You may also use "POSTGRES_HOST_AUTH_METHOD=trust" to allow all 20/08/2023 22:10:19 connections without a password. This is not recommended. 20/08/2023 22:10:19 20/08/2023 22:10:19 See PostgreSQL documentation about "trust": 20/08/2023 22:10:19 https://www.postgresql.org/docs/current/auth-trust.html 20/08/2023 22:10:21 Error: Database is uninitialized and superuser password is not specified. 20/08/2023 22:10:21 You must specify POSTGRES_PASSWORD to a non-empty value for the 20/08/2023 22:10:21 superuser. For example, "-e POSTGRES_PASSWORD=password" on "docker run".
PostgreSQL Documentation
21.4. Trust Authentication
21.4. Trust Authentication When trust authentication is specified, PostgreSQL assumes that anyone who can connect to the server is authorized to …
(might be useful to note that the pgdata folder also seems to have its owner remapped to '70' and not the user that the container is started as....that an issue?)
Is this a new setup or a preexisting one? If the latter, have you made any changes etc recently?
brand new
Then the error about missing POSTGRES_PASSWORD is the one to go off. Are you using the standard compose setup?
yes - except for one thing: I've changed the name for the container 'database' to 'immich_postgres' - but I've made sure (i think) that that name change is reflected everywhere else that 'database' was referenced. Unless this is a hard coded variable?
Can you post your compose and .env?
(I can - but the character limits will wreck it)
(please excuse the formatting nightmare - is there a better way of sharing the compose and env?)
wrap your text in (```)
it's easier to read 😄
oh - how do I do that?
(and yeah, I bet it will be!)
It's a bit hard to explain on discord without triggering it lol
wow that is nicer!
thank you
Is your .env file in the same folder as the compose yml?
No. But it’s path is correct .
Does it not follow paths?
The .env is used in two ways: to set variables for the containers, and for interpolating into the compose file (
${FOO}
). For the latter, I believe it needs to be in the same folderAh. Ok. So I need to move it back then, I’ll try that.
Quick question: where is that documented? It seems that containers do this differently, and it’s never really clear…did I miss this ?
I think this is a docker compose default, not related to Immich. https://docs.docker.com/compose/environment-variables/set-environment-variables/#substitute-with-an-env-file
Docker Documentation
Ways to set environment variables in Compose
How to set, use and manage environment variables in Compose
ok - we're getting there... now I'm seeing this from the 'immich_microservices' container. Anyone any thoughts?
That's a redis error, is redis up and running?
dozzzle shows it as fine
dozzle??
Are the redis logs happy, and is the hostname that you configured correct?
So question around that: is the host name supposed to match the local IP, or the globally reachable URL that will be on the letsencrypt certificate ?
Or some other placeholder url if this is never to be internet-facing? (Say accessed over a vpn, for example)
redis is running internal to the docker network, and gets a DNS name assigned based on its container name (usually immich_redis iirc, the defaults should work if you don't touch any of it)