mediakit not connecting to postgres #44
-
|
I'm getting the following postgres connection error in the log, my compose/stack for my database is, and for mediakit, 172.25.0.3 is the correct docker IP for the postgres server. so I'm not sure why mediakit is unable to log in. |
Beta Was this translation helpful? Give feedback.
Replies: 9 comments 7 replies
-
|
Let me provide a simpler debugging approach: Check environment variables inside the containerRun this command to check what environment variables MediaKit is actually receiving: docker exec immich-mediakit env | grep PSQLThis will show you the actual values of:
If Common causes:
The error showing "postgres" user suggests MediaKit is falling back to default values because it's not receiving your custom environment variables. |
Beta Was this translation helpful? Give feedback.
-
|
Hi, thanks for your setup! |
Beta Was this translation helpful? Give feedback.
-
|
Ok, I split it up, but am still getting the username error,
Here's my Immich compose/stack, followed by my ENV, And my Immich Mediakit compose/stack and ENV, It seems like Mediakit sees the postgres server? It's just not able to login with the postgres username? could there be something preventing it from using that username? Any thoughts on how to get better logging details about the attempt to connect/login? Thanks!! |
Beta Was this translation helpful? Give feedback.
-
|
Our code reads environment variables like Looking at your MediaKit docker-compose.yml, I notice you're not using an I suggest trying our exact setup approach first. You can find complete working examples here: The key difference is adding this to your MediaKit compose file: services:
immich-mediakit:
env_file:
- .env
# ... rest of your configThis should ensure MediaKit receives the correct database credentials from your |
Beta Was this translation helpful? Give feedback.
-
|
Thanks for the detailed setup info! I can see you're using Portainer which should handle environment variables correctly. I just added a debugging feature that might help us figure out what's going on. MediaKit will now show the environment variables it receives at startup (with the password partially hidden for security). When you restart MediaKit, you should see something like this in the logs: This will tell us if MediaKit is actually getting the right values from Portainer. If the password looks wrong or truncated, we'll know it's an environment variable issue. If it looks correct, then we know the problem is somewhere else in the connection process. Could you pull new version and restart MediaKit and share what the environment variables section shows? That should help us narrow down where the issue is coming from. |
Beta Was this translation helpful? Give feedback.
-
|
Looking at your latest log output, I notice something that might be the issue: But from your Immich docker-compose configuration, PostgreSQL was initialized with: POSTGRES_USER: ${DB_USERNAME} # postgres
POSTGRES_PASSWORD: ${DB_PASSWORD}And your ENV file shows: Possible cause: When PostgreSQL initializes for the first time, it creates a user based on Can you verify:
Let me know what the |
Beta Was this translation helpful? Give feedback.
-
|
Your logs show the issue clearly: This is what MediaKit received from your Portainer environment. If your ENV file actually has MediaKit is receiving The authentication failure is expected when the username is wrong. Regarding your setup: Our official documentation provides standard Docker Compose examples that work out of the box: If you choose to use Portainer or other custom deployment methods, you need to ensure the environment variables are configured correctly in that platform. The logs clearly show MediaKit is receiving the wrong credentials, which is a configuration issue on your end. Either:
The MediaKit code is working as designed - it's using exactly what your environment provides. |
Beta Was this translation helpful? Give feedback.
-
|
you're literally not reading my posts. if you want to make a good faith effort to figure out why your product doesn't work, let me know, if you want to keep not reading what my issue is then your product is going to remain broken. |
Beta Was this translation helpful? Give feedback.
-
|
I apologize if my previous responses didn't address your specific point clearly. Let me be direct: Technical Assessment: Your logs show that MediaKit is receiving the correct credentials and successfully reaching the PostgreSQL server. The authentication failure ( Since Immich connects successfully with the same credentials but MediaKit doesn't, this points to a PostgreSQL access control configuration problem - likely Diagnostic steps you can try: # Test connection from MediaKit container using the exact same credentials
docker exec -it immich-mediakit psql -h immich_postgres -U immichdb -d immich
# Check PostgreSQL's authentication configuration
docker exec -it immich_postgres cat /var/lib/postgresql/data/pg_hba.conf
# Check what host the immichdb user is allowed to connect from
docker exec -it immich_postgres psql -U postgres -d immich -c "SELECT * FROM pg_user WHERE usename='immichdb';"Regarding support: MediaKit is an open-source tool that I maintain and share freely with the community. I provide it as-is without any commercial obligation. I've spent considerable time trying to help troubleshoot your setup, but I can only assist with issues related to the MediaKit code itself. Environment configuration issues with Docker, Portainer, or PostgreSQL access controls are outside the scope of what I can reasonably support. If you'd like to continue using MediaKit, the diagnostic steps above should help you identify the PostgreSQL configuration issue. Otherwise, that's perfectly fine too. |
Beta Was this translation helpful? Give feedback.
which is crazy because nowhere in the immich stack or deployment container does it have postgres as the username. so it seems the docker for immich always uses postgres/postgres for the database. I changed the stack for immich-mediakit to use postgres/postgres and now it's logging in.
So I'll be bringing that up with the immich team.