hassio-addons: πŸ› [Immich] Unable to connect to the database

Description

Any help would be greatly appreciated

Installed Immich addon using the default settings

sql server cant connect durring install

psql: error: connection to server on socket β€œ/var/run/postgresql/.s.PGSQL.5432” failed: No such file or directory Is the server running locally and accepting connections on that socket?

Then later on this loops

[Nest] 727 - 09/20/2023, 1:40:12 PM ERROR [TypeOrmModule] Unable to connect to the database. Retrying (1)… Error: connect ECONNREFUSED 172.30.32.1:5432 at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1495:16) It is highly recommended to use a minimum Redis version of 6.2.0 Current: 6.0.16

See full logs attached

Reproduction steps

1. Install Immich
2. Click Start
3. Go to logs
4. See error

Addon Logs

Starting...
/etc/cont-init.d/00-banner.sh: executing
-----------------------------------------------------------
 Add-on: Immich
 Self-hosted photo and video backup solution directly from your mobile phone
-----------------------------------------------------------
 Add-on version: 1.78.1
 You are running the latest version of this add-on.
 System: Home Assistant OS 10.5  (aarch64 / yellow)
 Home Assistant Core: 2023.9.2
 Home Assistant Supervisor: 2023.09.2
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums
-----------------------------------------------------------
 Provided by: https://github.com/alexbelgium/hassio-addons 
-----------------------------------------------------------
 Defining permissions for main user : 
User UID: 1000
User GID : 1000
-----------------------------------------------------------
/etc/cont-init.d/00-global_var.sh: executing
DB_DATABASE_NAME='immich'
DB_HOSTNAME='homeassistant.local'
DB_PASSWORD=******
DB_PORT='5432'
DB_USERNAME='postgres'
JWT_SECRET='REMOVED'
PGID='1000'
PUID='1000'
TYPESENSE_ENABLED='false'
TZ='Europe/Paris'
data_location='/share/immich'
/etc/cont-init.d/00-local_mounts.sh: executing
/etc/cont-init.d/00-smb_mounts.sh: executing
/etc/cont-init.d/01-custom_script.sh: executing
[13:39:50] INFO: Execute /config/addons_autoscripts/immich.sh if existing
[13:39:50] INFO: ... no script found
/etc/cont-init.d/20-folders.sh: executing
[13:39:51] INFO: Setting data location
... check /share/immich folder exists
... setting permissions
... correcting official script
/etc/cont-init.d/99-database.sh: executing
[21:39:51] WARNING: Your previous database was exported to /share/postgresql_immich.tar.gz
[21:39:51] INFO: Defining database
[21:39:51] INFO: -----------------
[21:39:51] INFO: Connecting to external postgresql
[21:39:51] INFO: 
psql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: No such file or directory
	Is the server running locally and accepting connections on that socket?
Error : /etc/cont-init.d/99-database.sh exiting 2
/etc/cont-init.d/99-deprecation: executing
╔════════════════════════════════════════════════════╗
╠════════════════════════════════════════════════════╣
β•‘                                                    β•‘
β•‘             This image is deprecated.              β•‘
β•‘      We will not offer support for this image      β•‘
β•‘            and it will not be updated.             β•‘
β•‘                                                    β•‘
╠════════════════════════════════════════════════════╣
β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•
Due to versioning issues, the jammy branch is deprecated.
══════════════════════════════════════════════════════
/etc/cont-init.d/99-run.sh: executing
[13:39:53] INFO: Setting variables
DB_DATABASE_NAME='immich'
DB_HOSTNAME='homeassistant.local'
DB_PASSWORD=******
DB_PORT='5432'
DB_USERNAME='postgres'

JWT_SECRET='REMOVED'
PGID='1000'
PUID='1000'
TYPESENSE_ENABLED='false'
TZ='Europe/Paris'
data_location='/share/immich'
[13:39:56] INFO: Defining database
[13:39:56] INFO: -----------------
[13:39:56] INFO: Using internal postgresql
[13:39:56] INFO: 
 * Starting PostgreSQL 14 database server
   ...done.
ERROR:  role "root" already exists
ERROR:  database "immich" already exists
ERROR:  role "immich" already exists
GRANT
[13:40:00] INFO: Starting redis
 
Starting the upstream container
 
555:C 20 Sep 2023 13:40:00.661 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
555:C 20 Sep 2023 13:40:00.661 # Redis version=6.0.16, bits=64, commit=00000000, modified=0, pid=555, just started
555:C 20 Sep 2023 13:40:00.661 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
555:M 20 Sep 2023 13:40:00.669 * Running mode=standalone, port=6379.
555:M 20 Sep 2023 13:40:00.670 # Server initialized
555:M 20 Sep 2023 13:40:00.670 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
555:M 20 Sep 2023 13:40:00.680 * Ready to accept connections
[migrations] started
[migrations] no migrations found
╔═══════════════════════════════╗
       __  _____ _____       __
      / / |_   _/ ____|     / /
     / /    | || |  __     / /
    / /     | || | |_ |   / /
   / /     _| || |__| |  / /
  /_/     |_____\_____| /_/
  Baseimage from linuxserver.io
╠═══════════════════════════════╣
  To support this applications developer(s) visit:
  Immich: https://immich.app/docs/overview/support-the-project
╠═══════════════════════════════╣
  User/Group ID:
  User UID: 1000
  User GID: 1000
β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•
[custom-init] No custom files found, skipping...
[Nest] 727  - 09/20/2023, 1:40:12 PM     LOG [NestFactory] Starting Nest application...
[Nest] 727  - 09/20/2023, 1:40:12 PM     LOG [InstanceLoader] TypeOrmModule dependencies initialized +172ms
[Nest] 727  - 09/20/2023, 1:40:12 PM     LOG [InstanceLoader] BullModule dependencies initialized +0ms
[Nest] 727  - 09/20/2023, 1:40:12 PM     LOG [InstanceLoader] ConfigHostModule dependencies initialized +3ms
[Nest] 727  - 09/20/2023, 1:40:12 PM     LOG [InstanceLoader] DiscoveryModule dependencies initialized +1ms
[Nest] 727  - 09/20/2023, 1:40:12 PM     LOG [InstanceLoader] ConfigModule dependencies initialized +23ms
[Nest] 727  - 09/20/2023, 1:40:12 PM     LOG [InstanceLoader] ScheduleModule dependencies initialized +0ms
[Nest] 727  - 09/20/2023, 1:40:12 PM     LOG [InstanceLoader] BullModule dependencies initialized +1ms
[Nest] 727  - 09/20/2023, 1:40:12 PM     LOG [InstanceLoader] BullModule dependencies initialized +1ms
[Nest] 727  - 09/20/2023, 1:40:12 PM   ERROR [TypeOrmModule] Unable to connect to the database. Retrying (1)...
Error: connect ECONNREFUSED 172.30.32.1:5432
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1495:16)
It is highly recommended to use a minimum Redis version of 6.2.0
           Current: 6.0.16
It is highly recommended to use a minimum Redis version of 6.2.0
           Current: 6.0.16
It is highly recommended to use a minimum Redis version of 6.2.0
           Current: 6.0.16
It is highly recommended to use a minimum Redis version of 6.2.0
           Current: 6.0.16
It is highly recommended to use a minimum Redis version of 6.2.0
           Current: 6.0.16
It is highly recommended to use a minimum Redis version of 6.2.0
           Current: 6.0.16
It is highly recommended to use a minimum Redis version of 6.2.0
           Current: 6.0.16
It is highly recommended to use a minimum Redis version of 6.2.0
           Current: 6.0.16
It is highly recommended to use a minimum Redis version of 6.2.0
           Current: 6.0.16
It is highly recommended to use a minimum Redis version of 6.2.0
           Current: 6.0.16
[Nest] 727  - 09/20/2023, 1:40:15 PM   ERROR [TypeOrmModule] Unable to connect to the database. Retrying (2)...
Error: connect ECONNREFUSED 172.30.32.1:5432
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1495:16)
[Nest] 727  - 09/20/2023, 1:40:18 PM   ERROR [TypeOrmModule] Unable to connect to the database. Retrying (3)...
Error: connect ECONNREFUSED 172.30.32.1:5432
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1495:16)
[Nest] 727  - 09/20/2023, 1:40:21 PM   ERROR [TypeOrmModule] Unable to connect to the database. Retrying (4)...
Error: connect ECONNREFUSED 172.30.32.1:5432
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1495:16)
[Nest] 727  - 09/20/2023, 1:40:24 PM   ERROR [TypeOrmModule] Unable to connect to the database. Retrying (5)...
Error: connect ECONNREFUSED 172.30.32.1:5432
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1495:16)
[Nest] 727  - 09/20/2023, 1:40:27 PM   ERROR [TypeOrmModule] Unable to connect to the database. Retrying (6)...
Error: connect ECONNREFUSED 172.30.32.1:5432
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1495:16)
[Nest] 727  - 09/20/2023, 1:40:30 PM   ERROR [TypeOrmModule] Unable to connect to the database. Retrying (7)...
Error: connect ECONNREFUSED 172.30.32.1:5432
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1495:16)
[Nest] 727  - 09/20/2023, 1:40:33 PM   ERROR [TypeOrmModule] Unable to connect to the database. Retrying (8)...
Error: connect ECONNREFUSED 172.30.32.1:5432
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1495:16)
[Nest] 727  - 09/20/2023, 1:40:36 PM   ERROR [TypeOrmModule] Unable to connect to the database. Retrying (9)...
Error: connect ECONNREFUSED 172.30.32.1:5432
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1495:16)
[Nest] 727  - 09/20/2023, 1:40:36 PM   ERROR [ExceptionHandler] connect ECONNREFUSED 172.30.32.1:5432
Error: connect ECONNREFUSED 172.30.32.1:5432
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1495:16)

About this issue

  • Original URL
  • State: closed
  • Created 9 months ago
  • Comments: 21 (9 by maintainers)

Commits related to this issue

Most upvoted comments

Thanks @hydazz for merging it. @alexbelgium I guess you need to rebuild image of addon.

Thanks a ton both you.

Yes, nicely seen! We can also modify the files through my dockerfile (with a sed command for example) but it’s true that modifying the upstream container the best solution !

we will export the MACHINE_LEARNING_WORKERS and MACHINE_LEARNING_WORKER_TIMEOUT for you to play with as needed

Perfect. It works with all ML features. πŸŽ‰

Thanks very much! Rebuild ongoing! New env are set as optional with default values of 1 worker and 120 seconds

Hi, the requirement is at least 4go ram it seems… https://documentation.immich.app/docs/install/requirements ; perhaps you could ask in the immich GitHub repo otherwise

Thank you very much for helping out. Looking further, it looks fimiliar with fix(ml): set higher default worker timeout they have added timeout to 120sec instead of 30s default to their docker compose way. I see we are using single docker solution, not sure where to pass this value.

On parallel I tried installing immich using docker compose outside HA (on same HW) and it is working fine with machine learning things working too. (Now Home Assistant complains about I am running other software outside HA in docker but I can ignore that)

Update: found a place where it should be added. Raised an issue in that repo Increase worker timout

Pushed ; please let me know

@alexbelgium Thanks, Works fine now.

Thanks for the quick response. I can confirm that v5 is working for me as well