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

Immich server fails to start with IMMICH_HOST = '[::]', ignores IMMICH_HOST = '0.0.0.0' #14616

Open
1 of 3 tasks
E-gy opened this issue Dec 10, 2024 · 4 comments
Open
1 of 3 tasks

Comments

@E-gy
Copy link

E-gy commented Dec 10, 2024

The bug

With IMMICH_HOST=[::], Starting the service generates the following error:

immich_server    | Error: getaddrinfo ENOTFOUND [::]
immich_server    |     at GetAddrInfoReqWrap.onlookupall [as oncomplete] (node:dns:120:26) {
immich_server    |   errno: -3008,
immich_server    |   code: 'ENOTFOUND',
immich_server    |   syscall: 'getaddrinfo',
immich_server    |   hostname: '[::]'
immich_server    | }
immich_server    | api worker exited with code 1

When the host is instead set to IMMICH_HOST=0.0.0.0', the setting becomes ignored - the server listens on 127.0.0.1:

...
immich_server    | [Nest] 16  - 12/10/2024, 10:59:37 AM     LOG [Api:RoutesResolver] ViewController {/api/view}:
immich_server    | [Nest] 16  - 12/10/2024, 10:59:37 AM     LOG [Api:RouterExplorer] Mapped {/api/view/folder/unique-paths, GET} route
immich_server    | [Nest] 16  - 12/10/2024, 10:59:37 AM     LOG [Api:RouterExplorer] Mapped {/api/view/folder, GET} route
immich_server    | [Nest] 16  - 12/10/2024, 10:59:37 AM     LOG [Api:NestApplication] Nest application successfully started
immich_server    | [Nest] 16  - 12/10/2024, 10:59:37 AM     LOG [Api:Bootstrap] Immich Server is listening on http://127.0.0.1:2283 [v1.122.2] [production]

Similar behaviour for IMMICH_HOST=:: (note the absence of braces) - the server starts and listens on [::1] instead

immich_server    | [Nest] 16  - 12/10/2024, 11:01:53 AM     LOG [Api:Bootstrap] Immich Server is listening on http://[::1]:2283 [v1.122.2] [production]

The OS that Immich Server is running on

Rocky Linux 9 + Docker compose

Version of Immich Server

1.122.2

Version of Immich Mobile App

1.22.2

Platform with the issue

  • Server
  • Web
  • Mobile

Your docker-compose.yml content

services:
  immich-server:
    container_name: immich_server
    image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}
    networks:
      - galery-priv
    volumes:
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
      - /etc/localtime:/etc/localtime:ro
    env_file:
      - .env
    environment:
      - 'IMMICH_HOST=[::]'
      - 'IMMICH_PORT=2283'
    ports:
      - 2283:2283
     depends_on:
      - redis
      - database
    restart: always
    deploy:
      resources:
        limits:
          cpus: '1.5'
          memory: 1G
...

Your .env content

(irrelevant)

Reproduction steps

Apply IMMICH_HOST as per above.

Relevant log output

No response

Additional information

The immich container is placed in a bridged docker network (c.f. compose above), shared with an nginx container. However since this version, since immich only listens on loopback address, the reverse proxy can no longer access immich.

Bug bypass:
Map port 2283 to host (as is done in the compose above - would not be necessary in this setup otherwise), and add host.docker.internal mapping for the reverse proxy container

services:
  reverse-proxy:
+    extra_hosts:
+        - "host.docker.internal:host-gateway"

Alternatively, hardcode subnet and IP ranges for the network shared with reverse proxy and assign a static IP to immich.

@mmomjian
Copy link
Contributor

Closely related to #13782 , can be tracked there. Ty!

@mmomjian mmomjian closed this as not planned Won't fix, can't repro, duplicate, stale Dec 10, 2024
@mmomjian mmomjian reopened this Dec 10, 2024
@mmomjian
Copy link
Contributor

Maybe this issue is different. Are you saying it only listens on local host?

@E-gy
Copy link
Author

E-gy commented Dec 10, 2024

For 0.0.0.0 and :: - yes.
For [::] - error and container exit.

@E-gy
Copy link
Author

E-gy commented Dec 10, 2024

After docker system prune + server reboot (and reupping everything from scratch) for some reason i'm failing to reproduce any of the above🤔
Immich seems to be working as intended... however the logs are now missleading

With default configuration (so no IMMICH_HOST env var), the log is

immich_server    | [Nest] 16  - 12/10/2024, 11:37:50 AM     LOG [Api:Bootstrap] Immich Server is listening on http://[::1]:2283 [v1.122.2] [production]

[::1] is technically IPv6 loopback address. The server is however accepting connections from any IP (including v4). Just saying the logs should print [::] instead in this case.

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

2 participants