Postgres authentication error using Compose plugin

  • Hello all,


    After some help here with including my environment variables in the Compose plugin, I am back with another issue. When pressing 'up' in the plugin, with my compose and variable files added and correctly edited, I get this error:


    "PostgresError: password authentication failed for user "postgres""


    The odd thing is that I have already run this application outside of the Compose plugin, and it worked. I can't understand what might be wrong but the logs would definitely suggest a postgres authentication error. The default password for postgres is "postgres", i have changed mine to a 20 character string of upper, lowercase letters and numbers (no special characters).


    Logs from the troublesome container are here and my compose file and environment variables are below:


    Compose:

    Environment variables:

    I ride bikes a long way.
    longbikejourney.com


    omv 7.7.17-1 (Sandworm) | Linux 6.12.43+deb12-amd64 | Intel(R) Xeon(R) CPU E3-1220 V2 @ 3.10GHz | Dell PowerEdge R210 16GB RAM

    Edited once, last by Nick0 ().

    • Official Post

    I don't use immich but it looks like the container doesn't have the postgres password and you aren't passing the postgres password to the immich container in the compose file. As I mentioned before, when you use the env_file parameter in a compose file, it automatically passes all values in the env_file to the container. You need to manually pass the environment variables to each container that needs them. While this may seem like extra work, it is better in my opinion because you aren't passing environment variables to container that don't need them.

    omv 8.0.6-2 synchrony | 6.17 proxmox kernel

    plugins :: omvextrasorg 8.0.2 | kvm 8.0.2 | compose 8.1.2 | cterm 8.0 | borgbackup 8.0.2 | cputemp 8.0 | mergerfs 8.0 | scripts 8.0.1 | writecache 8.1


    omv-extras.org plugins source code and issue tracker - github - changelogs


    Please try ctrl-shift-R and read this before posting a question.

    Please put your OMV system details in your signature.
    Please don't PM for support... Too many PMs!

  • I don't use immich but it looks like the container doesn't have the postgres password and you aren't passing the postgres password to the immich container in the compose file. As I mentioned before, when you use the env_file parameter in a compose file, it automatically passes all values in the env_file to the container. You need to manually pass the environment variables to each container that needs them. While this may seem like extra work, it is better in my opinion because you aren't passing environment variables to container that don't need them.

    Many thanks,


    So, does this mean that I should add:

    Code
    environment:
          POSTGRES_PASSWORD: ${DB_PASSWORD}

    to the part of the compose file that deals with the container_name: immich_server, right at the top (line 13)? Is this what you mean by: "manually pass the environment variables to each container that needs them."?


    I was under the impression that the variables at the bottom of the compose file were used for the whole file, but is it really the case that they also need to be added to the part of the compose file that has the container that will be calling for them? Sorry, I am probably not explaining this very well!


    If I try adding POSTGRES_PASSWORD: ${DB_PASSWORD} like this:

    Code
    services:
      immich-server:
        container_name: immich_server
        image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}
        environment:
          POSTGRES_PASSWORD: ${DB_PASSWORD}
        # extends:
        #   file: hwaccel.transcoding.yml
        #   service: cpu # set to one of [nvenc, quicksync, rkmpp, vaapi, vaapi-wsl] for accelerated transcoding
        volumes:

    ... I am still getting the same error.


    So, it seems that I am still not understanding this. I did rum immich up without the compose plugin and it worked (this was with the compose and .env file in the same folder and using the docker-compose up -d command, so I am thinking the current problem means that things need to be done differently with the plugin.


    Thanks,

    Nick.

    I ride bikes a long way.
    longbikejourney.com


    omv 7.7.17-1 (Sandworm) | Linux 6.12.43+deb12-amd64 | Intel(R) Xeon(R) CPU E3-1220 V2 @ 3.10GHz | Dell PowerEdge R210 16GB RAM

    • Official Post

    So, it seems that I am still not understanding this. I did rum immich up without the compose plugin and it worked (this was with the compose and .env file in the same folder and using the docker-compose up -d command, so I am thinking the current problem means that things need to be done differently with the plugin.

    You are doing it different since you took the env_file param out of the compose file. You can add it back. The .env file will just be named immich.env (or whatever you named the compose file).

    omv 8.0.6-2 synchrony | 6.17 proxmox kernel

    plugins :: omvextrasorg 8.0.2 | kvm 8.0.2 | compose 8.1.2 | cterm 8.0 | borgbackup 8.0.2 | cputemp 8.0 | mergerfs 8.0 | scripts 8.0.1 | writecache 8.1


    omv-extras.org plugins source code and issue tracker - github - changelogs


    Please try ctrl-shift-R and read this before posting a question.

    Please put your OMV system details in your signature.
    Please don't PM for support... Too many PMs!

  • You are doing it different since you took the env_file param out of the compose file. You can add it back. The .env file will just be named immich.env (or whatever you named the compose file).

    Thank you for spotting that, ryecoaaron - I'm not even sure why I removed that! Good to know how the .env file is named, too and it's all working now thanks to you. I also learned about environment variables :) Thanks again for helping me to fix this - just the 15,000 photos to migrate manually now :O

    I ride bikes a long way.
    longbikejourney.com


    omv 7.7.17-1 (Sandworm) | Linux 6.12.43+deb12-amd64 | Intel(R) Xeon(R) CPU E3-1220 V2 @ 3.10GHz | Dell PowerEdge R210 16GB RAM

  • Nick0

    Added the Label resolved
    • Official Post

    I'm not even sure why I removed that!

    I told you to. But adding the variables need to the right services can be difficult with multi-service compose files. Your original env_file would've had to have the filename changed though.

    omv 8.0.6-2 synchrony | 6.17 proxmox kernel

    plugins :: omvextrasorg 8.0.2 | kvm 8.0.2 | compose 8.1.2 | cterm 8.0 | borgbackup 8.0.2 | cputemp 8.0 | mergerfs 8.0 | scripts 8.0.1 | writecache 8.1


    omv-extras.org plugins source code and issue tracker - github - changelogs


    Please try ctrl-shift-R and read this before posting a question.

    Please put your OMV system details in your signature.
    Please don't PM for support... Too many PMs!

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!