Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HW transcoding not working for Alpine (-noml) and Synology Intel #207

Open
dankcushions opened this issue Nov 12, 2023 · 14 comments
Open

HW transcoding not working for Alpine (-noml) and Synology Intel #207

dankcushions opened this issue Nov 12, 2023 · 14 comments

Comments

@dankcushions
Copy link

Hi, Getting this sort of thing in the logs:

[Nest] 1167  - 11/12/2023, 6:34:50 PM     LOG [MediaService] Start encoding video 13b0f1ac-284d-4c41-80b4-1d202cc33f13 {"inputOptions":["-init_hw_device qsv=hw","-filter_hw_device hw"],"outputOptions":["-c:v h264_qsv","-c:a aac","-movflags faststart","-fps_mode passthrough","-map 0:0","-map 0:1","-bf 7","-refs 5","-g 256","-v verbose","-vf format=nv12,hwupload=extra_hw_frames=64,scale_qsv=720:-1","-preset 7","-global_quality 23"],"twoPass":false}
[Nest] 1167  - 11/12/2023, 6:34:50 PM   ERROR [MediaRepository] ffmpeg version 6.0 Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 13.2.1 (Alpine 13.2.1_git20231014) 20231014
  configuration: --prefix=/usr --disable-librtmp --disable-lzma --disable-static --disable-stripping --enable-avfilter --enable-gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libdrm --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libmp3lame --enable-libopenmpt --enable-libopus --enable-libplacebo --enable-libpulse --enable-librist --enable-libsoxr --enable-libsrt --enable-libssh --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-lto --enable-lv2 --enable-openssl --enable-pic --enable-postproc --enable-pthreads --enable-shared --enable-vaapi --enable-vdpau --enable-version3 --enable-vulkan --optflags=-O3 --enable-libjxl --enable-libsvtav1 --enable-libvpl
  libavutil      58.  2.100 / 58.  2.100
  libavcodec     60.  3.100 / 60.  3.100
  libavformat    60.  3.100 / 60.  3.100
  libavdevice    60.  1.100 / 60.  1.100
  libavfilter     9.  3.100 /  9.  3.100
  libswscale      7.  1.100 /  7.  1.100
  libswresample   5.  0.100 /  5.  0.100
  libpostproc    57.  1.100 / 57.  1.100
[AVHWDeviceContext @ 0x7fd7a6624e40] Cannot open DRM render node for device 0.
[AVHWDeviceContext @ 0x7fd7a6624e40] Cannot open a VA display from DRM device (null).
Device creation failed: -542398533.
Failed to set value 'qsv=hw' for option 'init_hw_device': Generic error in an external library
Error parsing global options: Generic error in an external library

[Nest] 1167  - 11/12/2023, 6:34:50 PM   ERROR [MediaService] Error: ffmpeg exited with code 1: Device creation failed: -542398533.
Failed to set value 'qsv=hw' for option 'init_hw_device': Generic error in an external library
Error parsing global options: Generic error in an external library

[Nest] 1167  - 11/12/2023, 6:34:50 PM   ERROR [MediaService] Error occurred during transcoding. Retrying with QSV acceleration disabled.

This is with a Synology 423+ NAS which has Intel J4124, which has quicksync.

Here's my docker compose:

  immich:
    image: ghcr.io/imagegenius/immich:noml
    container_name: immich
    privileged: true #needed for hw transcoding on synology (?)
    environment:
      - TZ=${TZ}
      - PGID=${PGID}
      - PUID=${PUID}
      - DB_HOSTNAME=localhost
      - DB_USERNAME=postgres
      - DB_PASSWORD=postgres
      - DB_DATABASE_NAME=postgres
      - REDIS_HOSTNAME=localhost
      - DOCKER_MODS=imagegenius/mods:universal-redis|imagegenius/mods:universal-postgres
    volumes:
      - ${CONFIG}/immich:/config
      - ${MEDIA}/photos:/photos
      - /volume1/photos:/import:ro #optional, delete after!
    ports:
      - 8080:8080
    devices:
      - /dev/dri:/dev/dri  # If using Intel QuickSync or VAAPI
    restart: unless-stopped

(I am not sure if privileged: true is needed, but is used in my Plex service, where hardware transcoding via - /dev/dri:/dev/dri works fine)

I have not tried the regular image, or indeed the immich vanilla docker compose, but I was under the impression that hw transcoding might work in alpine as per #148 (comment)

These errors look like a driver type issue, so I wonder if maybe the above PR or #168 are not available/possible in the noml image?

@martabal
Copy link
Collaborator

Right, I didn't test if the noml version is compatible with hardware transoding and I wouldn't be surprised if it is not. As for #168, it addresses a permission issue. If you'd like to test it, follow these steps: create a new fix.sh file on your machine within a new custom-cont-init.d folder. Copy the content of this file https://github.com/imagegenius/docker-immich/blob/main/root/etc/s6-overlay/s6-rc.d/init-video-immich/run into fix.sh, and then make fix.sh executable using chmod +x fix.sh command. (Here the official guide about custom scripts)

Then add the new volume to your immich container

    volumes:
      - ${CONFIG}/immich:/config
      - ${MEDIA}/photos:/photos
      - ${CONFIG}/custom-cont-init.d:/custom-cont-init.d:ro

If this does not work, this is definetly an alpine issue

@dankcushions
Copy link
Author

Thanks. Looks like something different is happening, at least!

[Nest] 1214  - 11/13/2023, 6:43:40 PM     LOG [MediaService] Start encoding video e67d1414-8e7f-48b5-a99c-0337663e22ae {"inputOptions":["-init_hw_device qsv=hw","-filter_hw_device hw"],"outputOptions":["-c:v h264_qsv","-c:a aac","-movflags faststart","-fps_mode passthrough","-map 0:0","-map 0:1","-bf 7","-refs 5","-g 256","-v verbose","-vf format=nv12,hwupload=extra_hw_frames=64,scale_qsv=720:-1","-preset 7","-global_quality 23"],"twoPass":false}
[Nest] 1214  - 11/13/2023, 6:43:40 PM   ERROR [MediaRepository] ffmpeg version 6.0 Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 13.2.1 (Alpine 13.2.1_git20231014) 20231014
  configuration: --prefix=/usr --disable-librtmp --disable-lzma --disable-static --disable-stripping --enable-avfilter --enable-gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libdrm --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libmp3lame --enable-libopenmpt --enable-libopus --enable-libplacebo --enable-libpulse --enable-librist --enable-libsoxr --enable-libsrt --enable-libssh --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-lto --enable-lv2 --enable-openssl --enable-pic --enable-postproc --enable-pthreads --enable-shared --enable-vaapi --enable-vdpau --enable-version3 --enable-vulkan --optflags=-O3 --enable-libjxl --enable-libsvtav1 --enable-libvpl
  libavutil      58.  2.100 / 58.  2.100
  libavcodec     60.  3.100 / 60.  3.100
  libavformat    60.  3.100 / 60.  3.100
  libavdevice    60.  1.100 / 60.  1.100
  libavfilter     9.  3.100 /  9.  3.100
  libswscale      7.  1.100 /  7.  1.100
  libswresample   5.  0.100 /  5.  0.100
  libpostproc    57.  1.100 / 57.  1.100
[AVHWDeviceContext @ 0x7f547b06be40] Trying to use DRM render node for device 0, with matching kernel driver (i915).
[AVHWDeviceContext @ 0x7f547b06be40] libva: VA-API version 1.20.0
[AVHWDeviceContext @ 0x7f547b06be40] libva: User requested driver 'iHD'
[AVHWDeviceContext @ 0x7f547b06be40] libva: Trying to open /usr/lib/dri/iHD_drv_video.so
[AVHWDeviceContext @ 0x7f547b06be40] libva: va_openDriver() returns -1
[AVHWDeviceContext @ 0x7f547b06be40] Failed to initialise VAAPI connection: -1 (unknown libva error).
Device creation failed: -5.
Failed to set value 'qsv=hw' for option 'init_hw_device': I/O error
Error parsing global options: I/O error

[Nest] 1214  - 11/13/2023, 6:43:40 PM   ERROR [MediaService] Error: ffmpeg exited with code 1: Device creation failed: -5.
Failed to set value 'qsv=hw' for option 'init_hw_device': I/O error
Error parsing global options: I/O error

[Nest] 1214  - 11/13/2023, 6:43:40 PM   ERROR [MediaService] Error occurred during transcoding. Retrying with QSV acceleration disabled.
[Nest] 1214  - 11/13/2023, 6:43:41 PM     LOG [MediaService] Encoding success e67d1414-8e7f-48b5-a99c-0337663e22ae

Looks like it fails hw transcoding with a device creation / IO error, and then falls back to software and succeeds. i'm a bit of a linux dumbass so i'm hoping these permissions are right:

drwxrwxrwx+ 1 docker users 12 Nov 13 18:26 custom-cont-init.d
chris@synology:~$ ls -l custom-cont-init.d/fix.sh 
-rwxrwxrwx+ 1 docker users 1687 Nov 13 18:26 custom-cont-init.d/fix.sh

(the docker user is what is assigned to the PGID/PUID of the immich container)

@martabal
Copy link
Collaborator

Can you pull the image again. noml has been rebased to ubuntu. The image is a bit bigger and has typesense but no machine-learning. HW transcoding should work fine.

@dankcushions
Copy link
Author

thanks! I have tried after a pull and get a lot of this error now :

Error: connect ECONNREFUSED 127.0.0.1:6379
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1595:16) {
  errno: -111,
  code: 'ECONNREFUSED',
  syscall: 'connect',
  address: '127.0.0.1',
  port: 6379
}
s6-applyuidgid: fatal: unable to exec redis-server: No such file or directory

I am using the docker-compose in my first post. So it's using universal-redis mod as per the readme suggestion

      - REDIS_HOSTNAME=localhost
      - DOCKER_MODS=imagegenius/mods:universal-redis

It seemed to work before, at least!

@martabal
Copy link
Collaborator

Can you try to delete the redis folder in /config ?

@dankcushions
Copy link
Author

Tried that, and still getting similar errors, but there's a few strange ones earlier that may be releated:

Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package postgresql-14
chown: invalid user: ‘postgres:postgres’
PostgreSQL Database Already Initialised
[custom-init] No custom files found, skipping...
s6-envuidgid: fatal: unknown user: postgres
s6-rc: warning: unable to start service svc-mod-universal-postgres: command exited 1
s6-applyuidgid: fatal: unable to exec redis-server: No such file or directory
s6-applyuidgid: fatal: unable to exec redis-server: No such file or directory
s6-applyuidgid: fatal: unable to exec redis-server: No such file or directory
s6-applyuidgid: fatal: unable to exec redis-server: No such file or directory
s6-applyuidgid: fatal: unable to exec redis-server: No such file or directory
s6-applyuidgid: fatal: unable to exec redis-server: No such file or directory
s6-applyuidgid: fatal: unable to exec redis-server: No such file or directory
s6-applyuidgid: fatal: unable to exec redis-server: No such file or directory
s6-applyuidgid: fatal: unable to exec redis-server: No such file or directory
s6-applyuidgid: fatal: unable to exec redis-server: No such file or directory
s6-applyuidgid: fatal: unable to exec redis-server: No such file or directory
s6-applyuidgid: fatal: unable to exec redis-server: No such file or directory
s6-applyuidgid: fatal: unable to exec redis-server: No such file or directory
s6-applyuidgid: fatal: unable to exec redis-server: No such file or directory
s6-applyuidgid: fatal: unable to exec redis-server: No such file or directory
s6-applyuidgid: fatal: unable to exec redis-server: No such file or directory
s6-applyuidgid: fatal: unable to exec redis-server: No such file or directory
s6-applyuidgid: fatal: unable to exec redis-server: No such file or directory
[Nest] 434  - 11/14/2023, 11:56:44 PM     LOG [NestFactory] Starting Nest application...
[Nest] 434  - 11/14/2023, 11:56:44 PM     LOG [InstanceLoader] TypeOrmModule dependencies initialized +71ms
[Nest] 434  - 11/14/2023, 11:56:44 PM     LOG [InstanceLoader] BullModule dependencies initialized +0ms
[Nest] 434  - 11/14/2023, 11:56:44 PM     LOG [InstanceLoader] ConfigHostModule dependencies initialized +2ms
[Nest] 434  - 11/14/2023, 11:56:44 PM     LOG [InstanceLoader] DiscoveryModule dependencies initialized +0ms
[Nest] 434  - 11/14/2023, 11:56:44 PM     LOG [InstanceLoader] ScheduleModule dependencies initialized +0ms
[Nest] 434  - 11/14/2023, 11:56:44 PM     LOG [InstanceLoader] ConfigModule dependencies initialized +9ms
[Nest] 434  - 11/14/2023, 11:56:44 PM     LOG [InstanceLoader] BullModule dependencies initialized +0ms
[Nest] 434  - 11/14/2023, 11:56:44 PM     LOG [InstanceLoader] ScheduleModule dependencies initialized +1ms
[Nest] 434  - 11/14/2023, 11:56:44 PM     LOG [InstanceLoader] BullModule dependencies initialized +0ms
[Nest] 434  - 11/14/2023, 11:56:44 PM   ERROR [TypeOrmModule] Unable to connect to the database. Retrying (1)...
Error: connect ECONNREFUSED 127.0.0.1:5432
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1595:16)
Error: connect ECONNREFUSED 127.0.0.1:6379
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1595:16) {
  errno: -111,
  code: 'ECONNREFUSED',
  syscall: 'connect',
  address: '127.0.0.1',
  port: 6379
}

@martabal
Copy link
Collaborator

Oh damn are you using the postgres docker mod ? I don't understand why you have such errors with redis. @hydazz any ideas ?

@hydazz
Copy link
Member

hydazz commented Nov 15, 2023

the postgres docker mod continued to work on alpine, as their package support is more legacy, but its now based on debian and there is no postgres 14, I presume that its trying to install PG14, failing and skipping installing redis

@martabal
Copy link
Collaborator

I mean for this error s6-applyuidgid: fatal: unable to exec redis-server: No such file or directory

@hydazz
Copy link
Member

hydazz commented Nov 15, 2023

redis is not installed, as postgres fails to install

@dankcushions
Copy link
Author

dankcushions commented Nov 28, 2023

Sorry for the delay. I have added postgres to my -noml compose, rather than use the docker mod. i am getting a loop of:

[Nest] 360  - 11/28/2023, 11:09:12 PM     LOG [NestFactory] Starting Nest application...
[Nest] 360  - 11/28/2023, 11:09:13 PM     LOG [InstanceLoader] TypeOrmModule dependencies initialized +67ms
[Nest] 360  - 11/28/2023, 11:09:13 PM     LOG [InstanceLoader] BullModule dependencies initialized +0ms
[Nest] 360  - 11/28/2023, 11:09:13 PM     LOG [InstanceLoader] ConfigHostModule dependencies initialized +2ms
[Nest] 360  - 11/28/2023, 11:09:13 PM     LOG [InstanceLoader] DiscoveryModule dependencies initialized +0ms
[Nest] 360  - 11/28/2023, 11:09:13 PM     LOG [InstanceLoader] ScheduleModule dependencies initialized +0ms
[Nest] 360  - 11/28/2023, 11:09:13 PM     LOG [InstanceLoader] ConfigModule dependencies initialized +10ms
[Nest] 360  - 11/28/2023, 11:09:13 PM     LOG [InstanceLoader] BullModule dependencies initialized +0ms
[Nest] 360  - 11/28/2023, 11:09:13 PM     LOG [InstanceLoader] ScheduleModule dependencies initialized +0ms
[Nest] 360  - 11/28/2023, 11:09:13 PM     LOG [InstanceLoader] BullModule dependencies initialized +0ms
[Nest] 360  - 11/28/2023, 11:09:13 PM   ERROR [TypeOrmModule] Unable to connect to the database. Retrying (1)...
Error: connect ECONNREFUSED 127.0.0.1:5432
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1595:16)
[Nest] 360  - 11/28/2023, 11:09:16 PM   ERROR [TypeOrmModule] Unable to connect to the database. Retrying (2)...
Error: connect ECONNREFUSED 127.0.0.1:5432
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1595:16)
[Nest] 360  - 11/28/2023, 11:09:19 PM   ERROR [TypeOrmModule] Unable to connect to the database. Retrying (3)...
Error: connect ECONNREFUSED 127.0.0.1:5432
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1595:16)
[Nest] 360  - 11/28/2023, 11:09:22 PM   ERROR [TypeOrmModule] Unable to connect to the database. Retrying (4)...
Error: connect ECONNREFUSED 127.0.0.1:5432
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1595:16)
[Nest] 360  - 11/28/2023, 11:09:25 PM   ERROR [TypeOrmModule] Unable to connect to the database. Retrying (5)...
Error: connect ECONNREFUSED 127.0.0.1:5432
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1595:16)
[Nest] 360  - 11/28/2023, 11:09:28 PM   ERROR [TypeOrmModule] Unable to connect to the database. Retrying (6)...
Error: connect ECONNREFUSED 127.0.0.1:5432
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1595:16)
[Nest] 360  - 11/28/2023, 11:09:31 PM   ERROR [TypeOrmModule] Unable to connect to the database. Retrying (7)...
Error: connect ECONNREFUSED 127.0.0.1:5432
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1595:16)
[Nest] 360  - 11/28/2023, 11:09:34 PM   ERROR [TypeOrmModule] Unable to connect to the database. Retrying (8)...
Error: connect ECONNREFUSED 127.0.0.1:5432
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1595:16)
[Nest] 360  - 11/28/2023, 11:09:37 PM   ERROR [TypeOrmModule] Unable to connect to the database. Retrying (9)...
Error: connect ECONNREFUSED 127.0.0.1:5432
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1595:16)
[Nest] 360  - 11/28/2023, 11:09:37 PM   ERROR [ExceptionHandler] connect ECONNREFUSED 127.0.0.1:5432
Error: connect ECONNREFUSED 127.0.0.1:5432
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1595:16)

Note I am still using postgres 14, as using postgres 15 as per the latest readme gives me a compatibility error with my previously built postgres 14 database. i could just delete this but i presume that will cause problems with my current immich installation(?). anyway, postgres (14) seems to start up ok:

chmod: changing permissions of '/var/run/postgresql': Operation not permitted

PostgreSQL Database directory appears to contain a database; Skipping initialization

2023-11-28 23:06:00.284 GMT [1] LOG:  starting PostgreSQL 14.10 (Debian 14.10-1.pgdg120+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit
2023-11-28 23:06:00.284 GMT [1] LOG:  listening on IPv4 address "127.0.0.1", port 5432
2023-11-28 23:06:00.284 GMT [1] LOG:  could not bind IPv6 address "::1": Cannot assign requested address
2023-11-28 23:06:01.034 GMT [1] LOG:  listening on Unix socket "/run/postgresql/.s.PGSQL.5432"
2023-11-28 23:06:03.921 GMT [14] LOG:  database system was shut down at 2023-11-28 23:04:21 GMT
2023-11-28 23:06:04.710 GMT [1] LOG:  database system is ready to accept connections

also note that I'm not using external db port 5432 as synology OS already uses that for something, so I have forwarded from 6543 (I think).

  immich:
    image: ghcr.io/imagegenius/immich:noml
    container_name: immich
    privileged: true #needed for hw transcoding on synology (?)
    environment:
      - TZ=${TZ}
      - PGID=${PGID}
      - PUID=${PUID}
      - DB_HOSTNAME=localhost
      - DB_USERNAME=postgres
      - DB_PASSWORD=postgres
      - DB_DATABASE_NAME=immich
      - DB_PORT=5432
      - REDIS_HOSTNAME=localhost
      - DOCKER_MODS=imagegenius/mods:universal-redis
    volumes:
      - ${CONFIG}/immich:/config
      - ${MEDIA}/photos:/photos
      - /volume1/photos:/import:ro #optional, delete after!
#      - ${DATA}/chris/custom-cont-init.d:/custom-cont-init.d:ro
    ports:
      - 8080:8080
    devices:
      - /dev/dri:/dev/dri  # If using Intel QuickSync or VAAPI
    depends_on:
      - postgres14
    restart: unless-stopped

  postgres14:
    image: postgres:14
    container_name: immich_db
    ports:
      - 6543:5432 # 5432 is taken on host, so forward from 6543
    user: "${PUID}:${PGID}"
    environment:
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: postgres
      POSTGRES_DB: immich
    volumes:
      - ${CONFIG}/immich/postgres:/var/lib/postgresql/data
    restart: unless-stopped

@martabal
Copy link
Collaborator

You need to change DB_HOSTNAME and DB_PORT then

@dankcushions
Copy link
Author

thanks, though I'm still struggling!

latest compose:

  immich:
    image: ghcr.io/imagegenius/immich:noml
    container_name: immich
    privileged: true #needed for hw transcoding on synology (?)
    environment:
      - TZ=${TZ}
      - PGID=${PGID}
      - PUID=${PUID}
      - DB_HOSTNAME=immich_db
      - DB_USERNAME=postgres
      - DB_PASSWORD=postgres
      - DB_DATABASE_NAME=immich
      - DB_PORT=5432
      - REDIS_HOSTNAME=localhost
      - DOCKER_MODS=imagegenius/mods:universal-redis
    volumes:
      - ${CONFIG}/immich:/config
      - ${MEDIA}/photos:/photos
      - /volume1/photos:/import:ro #optional, delete after!
#      - ${DATA}/chris/custom-cont-init.d:/custom-cont-init.d:ro
    ports:
      - 8080:8080
    devices:
      - /dev/dri:/dev/dri  # If using Intel QuickSync or VAAPI
    depends_on:
      - immich_db
    restart: unless-stopped

  immich_db:
    image: postgres:14
    container_name: immich_db
    ports:
      - 6543:5432 # 5432 is taken on host, so forward from 6543
    user: "${PUID}:${PGID}"
    environment:
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: postgres
      POSTGRES_DB: immich
    volumes:
      - ${CONFIG}/immich/postgres:/var/lib/postgresql/data
    restart: unless-stopped

I have changed DB_HOSTNAME to immich_db which I think is right, but if I have DB_PORT at 6543 I get

[Nest] 624  - 12/02/2023, 3:32:30 PM   ERROR [TypeOrmModule] Unable to connect to the database. Retrying (1)...
Error: connect ECONNREFUSED 172.20.0.7:5432
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1595:16)

or 5432:

[Nest] 624  - 12/02/2023, 3:32:30 PM   ERROR [TypeOrmModule] Unable to connect to the database. Retrying (1)...
Error: connect ECONNREFUSED 172.20.0.7:5432
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1595:16)

(I guess they both log port 5432 as 6543:5432 just forwards to 5432 within the container)

i then tried using the internal IP of this box: 192:168:1.4 as DB_HOSTNAME and it seems to connect but errors:

[Nest] 741  - 12/02/2023, 3:55:34 PM     LOG [NestFactory] Starting Nest application...
[Nest] 741  - 12/02/2023, 3:55:34 PM     LOG [InstanceLoader] TypeOrmModule dependencies initialized +57ms
[Nest] 741  - 12/02/2023, 3:55:34 PM     LOG [InstanceLoader] BullModule dependencies initialized +0ms
[Nest] 741  - 12/02/2023, 3:55:34 PM     LOG [InstanceLoader] ConfigHostModule dependencies initialized +2ms
[Nest] 741  - 12/02/2023, 3:55:34 PM     LOG [InstanceLoader] DiscoveryModule dependencies initialized +0ms
[Nest] 741  - 12/02/2023, 3:55:34 PM     LOG [InstanceLoader] ScheduleModule dependencies initialized +0ms
[Nest] 741  - 12/02/2023, 3:55:34 PM     LOG [InstanceLoader] ConfigModule dependencies initialized +8ms
[Nest] 741  - 12/02/2023, 3:55:34 PM     LOG [InstanceLoader] BullModule dependencies initialized +0ms
[Nest] 741  - 12/02/2023, 3:55:34 PM     LOG [InstanceLoader] ScheduleModule dependencies initialized +1ms
[Nest] 741  - 12/02/2023, 3:55:34 PM     LOG [InstanceLoader] BullModule dependencies initialized +0ms
[Nest] 741  - 12/02/2023, 3:55:34 PM   ERROR [TypeOrmModule] Unable to connect to the database. Retrying (1)...
Error: Connection terminated unexpectedly
    at Connection.<anonymous> (/app/immich/server/node_modules/pg/lib/client.js:132:73)
    at Object.onceWrapper (node:events:628:28)
    at Connection.emit (node:events:514:28)
    at Socket.<anonymous> (/app/immich/server/node_modules/pg/lib/connection.js:63:12)
    at Socket.emit (node:events:514:28)
    at TCP.<anonymous> (node:net:337:12)
[Nest] 741  - 12/02/2023, 3:55:37 PM   ERROR [TypeOrmModule] Unable to connect to the database. Retrying (2)...
Error: Connection terminated unexpectedly
    at Connection.<anonymous> (/app/immich/server/node_modules/pg/lib/client.js:132:73)
    at Object.onceWrapper (node:events:628:28)
    at Connection.emit (node:events:514:28)
    at Socket.<anonymous> (/app/immich/server/node_modules/pg/lib/connection.js:63:12)
    at Socket.emit (node:events:514:28)
    at TCP.<anonymous> (node:net:337:12)
[Nest] 741  - 12/02/2023, 3:55:40 PM   ERROR [TypeOrmModule] Unable to connect to the database. Retrying (3)...
Error: Connection terminated unexpectedly
    at Connection.<anonymous> (/app/immich/server/node_modules/pg/lib/client.js:132:73)
    at Object.onceWrapper (node:events:628:28)
    at Connection.emit (node:events:514:28)
    at Socket.<anonymous> (/app/immich/server/node_modules/pg/lib/connection.js:63:12)
    at Socket.emit (node:events:514:28)
    at TCP.<anonymous> (node:net:337:12)
[Nest] 741  - 12/02/2023, 3:55:43 PM   ERROR [TypeOrmModule] Unable to connect to the database. Retrying (4)...
Error: read ECONNRESET
    at TCP.onStreamRead (node:internal/stream_base_commons:217:20)
[Nest] 741  - 12/02/2023, 3:55:46 PM   ERROR [TypeOrmModule] Unable to connect to the database. Retrying (5)...
Error: read ECONNRESET
    at TCP.onStreamRead (node:internal/stream_base_commons:217:20)
[Nest] 741  - 12/02/2023, 3:55:49 PM   ERROR [TypeOrmModule] Unable to connect to the database. Retrying (6)...
Error: read ECONNRESET
    at TCP.onStreamRead (node:internal/stream_base_commons:217:20)
[Nest] 741  - 12/02/2023, 3:55:52 PM   ERROR [TypeOrmModule] Unable to connect to the database. Retrying (7)...
Error: read ECONNRESET
    at TCP.onStreamRead (node:internal/stream_base_commons:217:20)
[Nest] 741  - 12/02/2023, 3:55:55 PM   ERROR [TypeOrmModule] Unable to connect to the database. Retrying (8)...
Error: read ECONNRESET
    at TCP.onStreamRead (node:internal/stream_base_commons:217:20)
[Nest] 741  - 12/02/2023, 3:55:58 PM   ERROR [TypeOrmModule] Unable to connect to the database. Retrying (9)...
Error: Connection terminated unexpectedly
    at Connection.<anonymous> (/app/immich/server/node_modules/pg/lib/client.js:132:73)
    at Object.onceWrapper (node:events:628:28)
    at Connection.emit (node:events:514:28)
    at Socket.<anonymous> (/app/immich/server/node_modules/pg/lib/connection.js:63:12)
    at Socket.emit (node:events:514:28)
    at TCP.<anonymous> (node:net:337:12)
[Nest] 741  - 12/02/2023, 3:55:58 PM   ERROR [ExceptionHandler] Connection terminated unexpectedly
Error: Connection terminated unexpectedly
    at Connection.<anonymous> (/app/immich/server/node_modules/pg/lib/client.js:132:73)
    at Object.onceWrapper (node:events:628:28)
    at Connection.emit (node:events:514:28)
    at Socket.<anonymous> (/app/immich/server/node_modules/pg/lib/connection.js:63:12)
    at Socket.emit (node:events:514:28)
    at TCP.<anonymous> (node:net:337:12)

@kellian78
Copy link

hello dit you still struggling ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants