[BUG] Postgres issue with stable docker compose #320

Closed
opened 2026-02-04 19:37:09 +03:00 by OVERLORD · 9 comments
Owner

Originally created by @D35P4C1T0 on GitHub (Sep 20, 2022).

Describe the bug
While using the standard docker compose yml file to run immich as a stack on OMV (openmediavault) a strange behaviour occurs.
I'm also adding logs from the postgres container. The .env file is pretty much the default one, I only changed the JWT string and backup absolute path, the postgres stuff is untouched (so postgres both as username and password for the db).

Task List

Please complete the task list below. We need this information to help us reproduce the bug or point out problems in your setup. You are not providing enough info may delay our effort to help you.

  • I have read thoroughly the README setup and installation instructions.
  • I have included my docker-compose file.
  • I have included my redacted .env file.
  • I have included information on my machine, and environment.

Expected behavior
Postgres container working accordingly.

Logs

PostgreSQL Database directory appears to contain a database; Skipping initialization

2022-09-20 13:01:12.586 UTC [1] LOG:  starting PostgreSQL 14.5 (Debian 14.5-1.pgdg110+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit
2022-09-20 13:01:12.587 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
2022-09-20 13:01:12.587 UTC [1] LOG:  listening on IPv6 address "::", port 5432
2022-09-20 13:01:12.754 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2022-09-20 13:01:13.007 UTC [27] LOG:  database system was shut down at 2022-09-20 13:01:09 UTC
2022-09-20 13:01:13.181 UTC [1] LOG:  database system is ready to accept connections
2022-09-20 13:01:15.158 UTC [34] FATAL:  password authentication failed for user "postgres"
2022-09-20 13:01:15.158 UTC [34] DETAIL:  Role "postgres" does not exist.
	Connection matched pg_hba.conf line 100: "host all all all scram-sha-256"
2022-09-20 13:01:15.419 UTC [35] FATAL:  password authentication failed for user "postgres"
2022-09-20 13:01:15.419 UTC [35] DETAIL:  Role "postgres" does not exist.
	Connection matched pg_hba.conf line 100: "host all all all scram-sha-256"
2022-09-20 13:01:25.059 UTC [36] FATAL:  password authentication failed for user "postgres"
2022-09-20 13:01:25.059 UTC [36] DETAIL:  Role "postgres" does not exist.
	Connection matched pg_hba.conf line 100: "host all all all scram-sha-256"
2022-09-20 13:01:25.067 UTC [37] FATAL:  password authentication failed for user "postgres"
2022-09-20 13:01:25.067 UTC [37] DETAIL:  Role "postgres" does not exist.
	Connection matched pg_hba.conf line 100: "host all all all scram-sha-256" 

docker-compose.yml file

The stack.env file is needed for portainer to correctly provide variables to the stack

version: "3.8"

services:
  immich-server:
    image: altran1502/immich-server:release
    entrypoint: ["/bin/sh", "./start-server.sh"]
    volumes:
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
    env_file:
      - stack.env
    environment:
      - NODE_ENV=production
    depends_on:
      - redis
      - database
    restart: always

  immich-microservices:
    image: altran1502/immich-server:release
    entrypoint: ["/bin/sh", "./start-microservices.sh"]
    volumes:
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
    env_file:
      - stack.env
    environment:
      - NODE_ENV=production
    depends_on:
      - redis
      - database
    restart: always

  immich-web:
    image: altran1502/immich-web:release
    entrypoint: ["/bin/sh", "./entrypoint.sh"]

    environment:
      - PUBLIC_TZ=Europe/Rome
    restart: always

  redis:
    container_name: immich_redis
    image: redis:6.2
    restart: always

  database:
    container_name: immich_postgres
    image: postgres:14
    env_file:
      - stack.env
    environment:
      POSTGRES_USER: ${DB_USERNAME}
      POSTGRES_PASSWORD: ${DB_PASSWORD}
      POSTGRES_DB: ${DB_DATABASE_NAME}
      PG_DATA: /var/lib/postgresql/data
    volumes:
      - pgdata:/var/lib/postgresql/data
    restart: always

  immich-proxy:
    container_name: immich_proxy
    image: altran1502/immich-proxy:release
    ports:
      - 2283:8080
    logging:
      driver: none
    depends_on:
      - immich-server
    restart: always

volumes:
  pgdata:

System

  • Server Version: OMV 6
Originally created by @D35P4C1T0 on GitHub (Sep 20, 2022). **Describe the bug** While using the standard docker compose yml file to run immich as a stack on OMV (openmediavault) a strange behaviour occurs. I'm also adding logs from the postgres container. The .env file is pretty much the default one, I only changed the JWT string and backup absolute path, the postgres stuff is untouched (so `postgres` both as username and password for the db). **Task List** *Please complete the task list below. We need this information to help us reproduce the bug or point out problems in your setup. You are not providing enough info may delay our effort to help you.* - [x] I have read thoroughly the README setup and installation instructions. - [x] I have included my `docker-compose` file. - [ ] I have included my redacted `.env` file. - [x] I have included information on my machine, and environment. **Expected behavior** Postgres container working accordingly. **Logs** ``` PostgreSQL Database directory appears to contain a database; Skipping initialization 2022-09-20 13:01:12.586 UTC [1] LOG: starting PostgreSQL 14.5 (Debian 14.5-1.pgdg110+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit 2022-09-20 13:01:12.587 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432 2022-09-20 13:01:12.587 UTC [1] LOG: listening on IPv6 address "::", port 5432 2022-09-20 13:01:12.754 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432" 2022-09-20 13:01:13.007 UTC [27] LOG: database system was shut down at 2022-09-20 13:01:09 UTC 2022-09-20 13:01:13.181 UTC [1] LOG: database system is ready to accept connections 2022-09-20 13:01:15.158 UTC [34] FATAL: password authentication failed for user "postgres" 2022-09-20 13:01:15.158 UTC [34] DETAIL: Role "postgres" does not exist. Connection matched pg_hba.conf line 100: "host all all all scram-sha-256" 2022-09-20 13:01:15.419 UTC [35] FATAL: password authentication failed for user "postgres" 2022-09-20 13:01:15.419 UTC [35] DETAIL: Role "postgres" does not exist. Connection matched pg_hba.conf line 100: "host all all all scram-sha-256" 2022-09-20 13:01:25.059 UTC [36] FATAL: password authentication failed for user "postgres" 2022-09-20 13:01:25.059 UTC [36] DETAIL: Role "postgres" does not exist. Connection matched pg_hba.conf line 100: "host all all all scram-sha-256" 2022-09-20 13:01:25.067 UTC [37] FATAL: password authentication failed for user "postgres" 2022-09-20 13:01:25.067 UTC [37] DETAIL: Role "postgres" does not exist. Connection matched pg_hba.conf line 100: "host all all all scram-sha-256" ```` **docker-compose.yml file** The `stack.env` file is needed for portainer to correctly provide variables to the stack ``` version: "3.8" services: immich-server: image: altran1502/immich-server:release entrypoint: ["/bin/sh", "./start-server.sh"] volumes: - ${UPLOAD_LOCATION}:/usr/src/app/upload env_file: - stack.env environment: - NODE_ENV=production depends_on: - redis - database restart: always immich-microservices: image: altran1502/immich-server:release entrypoint: ["/bin/sh", "./start-microservices.sh"] volumes: - ${UPLOAD_LOCATION}:/usr/src/app/upload env_file: - stack.env environment: - NODE_ENV=production depends_on: - redis - database restart: always immich-web: image: altran1502/immich-web:release entrypoint: ["/bin/sh", "./entrypoint.sh"] environment: - PUBLIC_TZ=Europe/Rome restart: always redis: container_name: immich_redis image: redis:6.2 restart: always database: container_name: immich_postgres image: postgres:14 env_file: - stack.env environment: POSTGRES_USER: ${DB_USERNAME} POSTGRES_PASSWORD: ${DB_PASSWORD} POSTGRES_DB: ${DB_DATABASE_NAME} PG_DATA: /var/lib/postgresql/data volumes: - pgdata:/var/lib/postgresql/data restart: always immich-proxy: container_name: immich_proxy image: altran1502/immich-proxy:release ports: - 2283:8080 logging: driver: none depends_on: - immich-server restart: always volumes: pgdata: ``` **System** - Server Version: `OMV 6`
Author
Owner

@alextran1502 commented on GitHub (Sep 20, 2022):

Can you remove the pgdata volume and try again?

@alextran1502 commented on GitHub (Sep 20, 2022): Can you remove the pgdata volume and try again?
Author
Owner

@D35P4C1T0 commented on GitHub (Sep 20, 2022):

Your suggestion solved my issue, thanks :D

@D35P4C1T0 commented on GitHub (Sep 20, 2022): Your suggestion solved my issue, thanks :D
Author
Owner

@amnesiacsardine commented on GitHub (Oct 29, 2022):

I have the same issue except the stack has been working for over 2 months. Suddenly I have access denied like that.

I don't want to have to delete the pgdata and reupload everything again. What can I do?

I can post a new issue for it if need be.

@amnesiacsardine commented on GitHub (Oct 29, 2022): I have the same issue except the stack has been working for over 2 months. Suddenly I have access denied like that. I don't want to have to delete the pgdata and reupload everything again. What can I do? I can post a new issue for it if need be.
Author
Owner

@alextran1502 commented on GitHub (Oct 30, 2022):

@amnesiacsardine There was some small change in the Dockerfile that might be the cause. I reverted the change. Can you try upgrading to the latest version, which is 1.33.1 and see if it still causes the issue?

@alextran1502 commented on GitHub (Oct 30, 2022): @amnesiacsardine There was some small change in the Dockerfile that might be the cause. I reverted the change. Can you try upgrading to the latest version, which is `1.33.1` and see if it still causes the issue?
Author
Owner

@amnesiacsardine commented on GitHub (Oct 30, 2022):

Yes the issue is still there even after the update.

Since the previous update, I get those warnings every time I run any docker compose commands on my immich stack.

WARN[0000] The "A" variable is not set. Defaulting to a blank string.
WARN[0000] The "N5uJ" variable is not set. Defaulting to a blank
string.

It refers to my postgres password and JWT secret inside my env file. They both have a $ sign in the middle of them.

I put them between single quotes and the warning disappears but I'm afraid immich or docker includes the quotes in what it thinks the value is. Maybe?

@amnesiacsardine commented on GitHub (Oct 30, 2022): Yes the issue is still there even after the update. Since the previous update, I get those warnings every time I run any docker compose commands on my immich stack. ``` WARN[0000] The "A" variable is not set. Defaulting to a blank string. WARN[0000] The "N5uJ" variable is not set. Defaulting to a blank string. ``` It refers to my postgres password and JWT secret inside my env file. They both have a $ sign in the middle of them. I put them between single quotes and the warning disappears but I'm afraid immich or docker includes the quotes in what it thinks the value is. Maybe?
Author
Owner

@alextran1502 commented on GitHub (Oct 30, 2022):

Yes the issue is still there even after the update.

Since the previous update, I get those warnings every time I run any docker compose commands on my immich stack.

WARN[0000] The "A" variable is not set. Defaulting to a blank string.
WARN[0000] The "N5uJ" variable is not set. Defaulting to a blank
string.

It refers to my postgres password and JWT secret inside my env file. They both have a $ sign in the middle of them.

I put them between single quotes and the warning disappears but I'm afraid immich or docker includes the quotes in what it thinks the value is. Maybe?

Can you share your setup and your .env please?

@alextran1502 commented on GitHub (Oct 30, 2022): > Yes the issue is still there even after the update. > > Since the previous update, I get those warnings every time I run any docker compose commands on my immich stack. > > ``` > WARN[0000] The "A" variable is not set. Defaulting to a blank string. > WARN[0000] The "N5uJ" variable is not set. Defaulting to a blank > string. > ``` > It refers to my postgres password and JWT secret inside my env file. They both have a $ sign in the middle of them. > > I put them between single quotes and the warning disappears but I'm afraid immich or docker includes the quotes in what it thinks the value is. Maybe? Can you share your setup and your .env please?
Author
Owner

@amnesiacsardine commented on GitHub (Oct 30, 2022):

version: "3.8"

services:
  immich-server:
    image: altran1502/immich-server:release
    entrypoint: ["/bin/sh", "./start-server.sh"]
    volumes:
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
    env_file:
      - .env
    environment:
      - NODE_ENV=production
    depends_on:
      - redis
      - database
    restart: always


  immich-microservices:
    image: altran1502/immich-server:release
    entrypoint: ["/bin/sh", "./start-microservices.sh"]
    volumes:
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
    env_file:
      - .env
    environment:
      - NODE_ENV=production
    depends_on:
      - redis
      - database
    restart: always

  immich-machine-learning:
    image: altran1502/immich-machine-learning:release
    entrypoint: ["/bin/sh", "./entrypoint.sh"]
    volumes:
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
    env_file:
      - .env
    environment:
      - NODE_ENV=production
    depends_on:
      - database
    restart: always

  immich-web:
    image: altran1502/immich-web:release
    entrypoint: ["/bin/sh", "./entrypoint.sh"]
    env_file:
      - .env
    restart: always

  redis:
    container_name: immich_redis
    image: redis:6.2
    restart: always

  database:
    container_name: immich_postgres
    image: postgres:14
    env_file:
      - .env
    environment:
      POSTGRES_PASSWORD: ${DB_PASSWORD}
      POSTGRES_USER: ${DB_USERNAME}
      POSTGRES_DB: ${DB_DATABASE_NAME}
      PG_DATA: /var/lib/postgresql/data
    volumes:
      - /docker/immich/pgdb/:/var/lib/postgresql/data
    restart: always

  immich-proxy:
    container_name: immich_proxy
    image: altran1502/immich-proxy:release
    ports:
      - 2283:8080
    logging:
      driver: none
    depends_on:
      - immich-server
    restart: always

The only thing different in my docker-compose.yml compared to the guidelines is that I mapped the pgdata volume instead of using a docker volume.

And the .env

###################################################################################
# Database
###################################################################################

DB_HOSTNAME=immich_postgres
DB_USERNAME=postgres
DB_PASSWORD=whGC#4n$A@e34A3*P2t#T@
DB_DATABASE_NAME=immich

# Optional Database settings:
# DB_PORT=5432




###################################################################################
# Redis
###################################################################################

REDIS_HOSTNAME=immich_redis

# Optional Redis settings:
# REDIS_PORT=6379
# REDIS_DBINDEX=0
# REDIS_PASSWORD=
# REDIS_SOCKET=





###################################################################################
# Upload File Config
###################################################################################

UPLOAD_LOCATION=/data/immich/




###################################################################################
# JWT SECRET
###################################################################################

JWT_SECRET=Ph$5q5b8nRtGSkvB54Cti*nH5g!5MFq#GhG52y#H6L%eek$%24ZC4Ff5Fhh%Jo*eNmTCj75Gd5$N5uJ&pTVS



###################################################################################
# Reverse Geocoding
####################################################################################

# DISABLE_REVERSE_GEOCODING=false

# Reverse geocoding is done locally which has a small impact on memory usage
# This memory usage can be altered by changing the REVERSE_GEOCODING_PRECISION variable
# This ranges from 0-3 with 3 being the most precise
# 3 - Cities > 500 population: ~200MB RAM
# 2 - Cities > 1000 population: ~150MB RAM
# 1 - Cities > 5000 population: ~80MB RAM
# 0 - Cities > 15000 population: ~40MB RAM

# REVERSE_GEOCODING_PRECISION=3

####################################################################################
# WEB - Optional
####################################################################################

# Custom message on the login page, should be written in HTML form.
# For example PUBLIC_LOGIN_PAGE_MESSAGE="This is a demo instance of Immich.<br><br>Email: <i>demo@demo.de</i><br>Password: <i>demo</i>"

PUBLIC_LOGIN_PAGE_MESSAGE=

I changed some normal characters (letters and numbers) in both the pg password and the JWT secret but otherwise get the same "shape"

@amnesiacsardine commented on GitHub (Oct 30, 2022): ``` version: "3.8" services: immich-server: image: altran1502/immich-server:release entrypoint: ["/bin/sh", "./start-server.sh"] volumes: - ${UPLOAD_LOCATION}:/usr/src/app/upload env_file: - .env environment: - NODE_ENV=production depends_on: - redis - database restart: always immich-microservices: image: altran1502/immich-server:release entrypoint: ["/bin/sh", "./start-microservices.sh"] volumes: - ${UPLOAD_LOCATION}:/usr/src/app/upload env_file: - .env environment: - NODE_ENV=production depends_on: - redis - database restart: always immich-machine-learning: image: altran1502/immich-machine-learning:release entrypoint: ["/bin/sh", "./entrypoint.sh"] volumes: - ${UPLOAD_LOCATION}:/usr/src/app/upload env_file: - .env environment: - NODE_ENV=production depends_on: - database restart: always immich-web: image: altran1502/immich-web:release entrypoint: ["/bin/sh", "./entrypoint.sh"] env_file: - .env restart: always redis: container_name: immich_redis image: redis:6.2 restart: always database: container_name: immich_postgres image: postgres:14 env_file: - .env environment: POSTGRES_PASSWORD: ${DB_PASSWORD} POSTGRES_USER: ${DB_USERNAME} POSTGRES_DB: ${DB_DATABASE_NAME} PG_DATA: /var/lib/postgresql/data volumes: - /docker/immich/pgdb/:/var/lib/postgresql/data restart: always immich-proxy: container_name: immich_proxy image: altran1502/immich-proxy:release ports: - 2283:8080 logging: driver: none depends_on: - immich-server restart: always ``` The only thing different in my docker-compose.yml compared to the guidelines is that I mapped the pgdata volume instead of using a docker volume. And the .env ``` ################################################################################### # Database ################################################################################### DB_HOSTNAME=immich_postgres DB_USERNAME=postgres DB_PASSWORD=whGC#4n$A@e34A3*P2t#T@ DB_DATABASE_NAME=immich # Optional Database settings: # DB_PORT=5432 ################################################################################### # Redis ################################################################################### REDIS_HOSTNAME=immich_redis # Optional Redis settings: # REDIS_PORT=6379 # REDIS_DBINDEX=0 # REDIS_PASSWORD= # REDIS_SOCKET= ################################################################################### # Upload File Config ################################################################################### UPLOAD_LOCATION=/data/immich/ ################################################################################### # JWT SECRET ################################################################################### JWT_SECRET=Ph$5q5b8nRtGSkvB54Cti*nH5g!5MFq#GhG52y#H6L%eek$%24ZC4Ff5Fhh%Jo*eNmTCj75Gd5$N5uJ&pTVS ################################################################################### # Reverse Geocoding #################################################################################### # DISABLE_REVERSE_GEOCODING=false # Reverse geocoding is done locally which has a small impact on memory usage # This memory usage can be altered by changing the REVERSE_GEOCODING_PRECISION variable # This ranges from 0-3 with 3 being the most precise # 3 - Cities > 500 population: ~200MB RAM # 2 - Cities > 1000 population: ~150MB RAM # 1 - Cities > 5000 population: ~80MB RAM # 0 - Cities > 15000 population: ~40MB RAM # REVERSE_GEOCODING_PRECISION=3 #################################################################################### # WEB - Optional #################################################################################### # Custom message on the login page, should be written in HTML form. # For example PUBLIC_LOGIN_PAGE_MESSAGE="This is a demo instance of Immich.<br><br>Email: <i>demo@demo.de</i><br>Password: <i>demo</i>" PUBLIC_LOGIN_PAGE_MESSAGE= ``` I changed some normal characters (letters and numbers) in both the pg password and the JWT secret but otherwise get the same "shape"
Author
Owner

@amnesiacsardine commented on GitHub (Nov 1, 2022):

@alextran1502 You can forget this issue. I just logged in the postgres db and changed the password then replacing it accordingly in the .env and everything is fine again. Thanks for you hard work on this awesome project.

@amnesiacsardine commented on GitHub (Nov 1, 2022): @alextran1502 You can forget this issue. I just logged in the postgres db and changed the password then replacing it accordingly in the .env and everything is fine again. Thanks for you hard work on this awesome project.
Author
Owner

@alextran1502 commented on GitHub (Nov 1, 2022):

@alextran1502 You can forget this issue. I just logged in the postgres db and changed the password then replacing it accordingly in the .env and everything is fine again. Thanks for you hard work on this awesome project.

I am glad it works, sorry I couldn't provide more help

@alextran1502 commented on GitHub (Nov 1, 2022): > @alextran1502 You can forget this issue. I just logged in the postgres db and changed the password then replacing it accordingly in the .env and everything is fine again. Thanks for you hard work on this awesome project. I am glad it works, sorry I couldn't provide more help
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: immich-app/immich#320