immich-app / immich

High performance self-hosted photo and video management solution.
https://immich.app
GNU Affero General Public License v3.0
51.92k stars 2.75k forks source link

Podman-compose and Immich: Redis can't be reached on a specific server #12966

Closed drjaska closed 1 month ago

drjaska commented 1 month ago

The bug

I recently installed Immich on my main server (Debian 12) and it works wonderfully. However when I attempted to install it on my newly installed NAS (also Debian 12) there is a lot of spam that the redis server cannot be reached by another container.

My issue looks identical to https://github.com/immich-app/immich/issues/10580 but with the exception that it only exists on 1/2 of my servers AND it doesn't go away with system reboots unlike their issue.

The OS that Immich Server is running on

Debian 12

Version of Immich Server

The latest which presumably is v1.116.0 ?

Version of Immich Mobile App

-

Platform with the issue

Your docker-compose.yml content

#
# WARNING: Make sure to use the docker-compose.yml of the current release:
#
# https://github.com/immich-app/immich/releases/latest/download/docker-compose.yml
#
# The compose file on main may not be compatible with the latest release.
#

name: immich

services:
  immich-server:
    container_name: immich_server
    image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}
    # extends:
    #   file: hwaccel.transcoding.yml
    #   service: cpu # set to one of [nvenc, quicksync, rkmpp, vaapi, vaapi-wsl] for accelerated transcoding
    volumes:
      # Do not edit the next line. If you want to change the media storage location on your system, edit the value of UPLOAD_LOCATION in the .env file
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
      - /etc/localtime:/etc/localtime:ro
    env_file:
      - .env
    ports:
      - 2283:3001
    depends_on:
      - redis
      - database
    restart: always
    healthcheck:
      disable: false

  immich-machine-learning:
    container_name: immich_machine_learning
    # For hardware acceleration, add one of -[armnn, cuda, openvino] to the image tag.
    # Example tag: ${IMMICH_VERSION:-release}-cuda
    image: ghcr.io/immich-app/immich-machine-learning:${IMMICH_VERSION:-release}
    # extends: # uncomment this section for hardware acceleration - see https://immich.app/docs/features/ml-hardware-acceleration
    #   file: hwaccel.ml.yml
    #   service: cpu # set to one of [armnn, cuda, openvino, openvino-wsl] for accelerated inference - use the `-wsl` version for WSL2 where applicable
    volumes:
      - model-cache:/cache
    env_file:
      - .env
    restart: always
    healthcheck:
      disable: false

  redis:
    container_name: immich_redis
    image: docker.io/redis:6.2-alpine@sha256:2d1463258f2764328496376f5d965f20c6a67f66ea2b06dc42af351f75248792
    healthcheck:
      test: redis-cli ping || exit 1
    restart: always

  database:
    container_name: immich_postgres
    image: docker.io/tensorchord/pgvecto-rs:pg14-v0.2.0@sha256:90724186f0a3517cf6914295b5ab410db9ce23190a2d9d0b9dd6463e3fa298f0
    environment:
      POSTGRES_PASSWORD: ${DB_PASSWORD}
      POSTGRES_USER: ${DB_USERNAME}
      POSTGRES_DB: ${DB_DATABASE_NAME}
      POSTGRES_INITDB_ARGS: '--data-checksums'
    volumes:
      # Do not edit the next line. If you want to change the database storage location on your system, edit the value of DB_DATA_LOCATION in the .env file
      - ${DB_DATA_LOCATION}:/var/lib/postgresql/data
    healthcheck:
      test: pg_isready --dbname='${DB_DATABASE_NAME}' --username='${DB_USERNAME}' || exit 1; Chksum="$$(psql --dbname='${DB_DATABASE_NAME}' --username='${DB_USERNAME}' --tuples-only --no-align --command='SELECT COALESCE(SUM(checksum_failures), 0) FROM pg_stat_database')"; echo "checksum failure count is $$Chksum"; [ "$$Chksum" = '0' ] || exit 1
      interval: 5m
      start_interval: 30s
      start_period: 5m
    command: ["postgres", "-c", "shared_preload_libraries=vectors.so", "-c", 'search_path="$$user", public, vectors', "-c", "logging_collector=on", "-c", "max_wal_size=2GB", "-c", "shared_buffers=512MB", "-c", "wal_compression=on"]
    restart: always

volumes:
  model-cache:

Your .env content

# You can find documentation for all the supported env variables at https://immich.app/docs/install/environment-variables

# The location where your uploaded files are stored
UPLOAD_LOCATION=./library
# The location where your database files are stored
DB_DATA_LOCATION=./postgres

# To set a timezone, uncomment the next line and change Etc/UTC to a TZ identifier from this list: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List
# TZ=Etc/UTC

# The Immich version to use. You can pin this to a specific version like "v1.71.0"
IMMICH_VERSION=release

# Connection secret for postgres. You should change it to a random password
# Please use only the characters `A-Za-z0-9`, without special characters or spaces
DB_PASSWORD=postgres

# The values below this line do not need to be changed
###################################################################################
DB_USERNAME=postgres
DB_DATABASE_NAME=immich

Reproduction steps

sudo apt install --no-install-recommends podman podman-compose podman-docker netavark slirp4netns uidmap

Copypaste from the quickstart guide:

wget -O docker-compose.yml https://github.com/immich-app/immich/releases/latest/download/docker-compose.yml
wget -O .env https://github.com/immich-app/immich/releases/latest/download/example.env

unmodified and then attempt to raise the containers

podman-compose up

Relevant log output

Error: getaddrinfo ENOTFOUND redis
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:109:26) {
  errno: -3008,
  code: 'ENOTFOUND',
  syscall: 'getaddrinfo',
  hostname: 'redis'
}

Additional information

More logs from the first podman-compose up ``` Copying blob 691d73d9a1e6 done Copying blob ad3ae119ae7a done Copying blob df6c918c9a23 done Copying blob 69b04d677453 done Copying blob 1ebb322c8d2a done Copying blob 00f78fe8d1d1 done Copying blob d86b683bfb41 done Copying blob 17b0dad9733d done Copying blob 0c61db6422ae done Copying blob a04898bc73de done Copying blob 5038a7fda7ad done Copying config 83091ce6be done Writing manifest to image destination Storing signatures f4aa9b312bb07d95739f174d2b9ac60316f59f28eb98025f7ba4910192c42fad exit code: 0 podman start -a immich_machine_learning podman start -a immich_redis podman start -a immich_postgres podman start -a immich_server 1:C 26 Sep 2024 23:11:46.652 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo 1:C 26 Sep 2024 23:11:46.653 # Redis version=6.2.14, bits=64, commit=00000000, modified=0, pid=1, just started 1:C 26 Sep 2024 23:11:46.653 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf 1:M 26 Sep 2024 23:11:46.655 * monotonic clock: POSIX clock_gettime 1:M 26 Sep 2024 23:11:46.657 * Running mode=standalone, port=6379. 1:M 26 Sep 2024 23:11:46.658 # Server initialized 1:M 26 Sep 2024 23:11:46.659 * Ready to accept connections The files belonging to this database system will be owned by user "postgres". This user must also own the server process. The database cluster will be initialized with locale "en_US.utf8". The default database encoding has accordingly been set to "UTF8". The default text search configuration will be set to "english". Data page checksums are enabled. fixing permissions on existing directory /var/lib/postgresql/data ... ok creating subdirectories ... ok selecting dynamic shared memory implementation ... posix selecting default max_connections ... 100 selecting default shared_buffers ... 128MB selecting default time zone ... Etc/UTC creating configuration files ... ok running bootstrap script ... Detected CPU Cores: 2 ok performing post-bootstrap initialization ... ok syncing data to disk ... [09/26/24 23:11:59] INFO Starting gunicorn 23.0.0 [09/26/24 23:11:59] INFO Listening at: http://[::]:3003 (4) [09/26/24 23:11:59] INFO Using worker: app.config.CustomUvicornWorker [09/26/24 23:11:59] INFO Booting worker with pid: 5 ok Success. You can now start the database server using: pg_ctl -D /var/lib/postgresql/data -l logfile start initdb: warning: enabling "trust" authentication for local connections You can change this by editing pg_hba.conf or using the option -A, or --auth-local and --auth-host, the next time you run initdb. waiting for server to start....2024-09-26 23:12:12.962 UTC [47] LOG: redirecting log output to logging collector process 2024-09-26 23:12:12.962 UTC [47] HINT: Future log output will appear in directory "log". done server started CREATE DATABASE /usr/local/bin/docker-entrypoint.sh: ignoring /docker-entrypoint-initdb.d/* waiting for server to shut down.... done server stopped PostgreSQL init process complete; ready for start up. 2024-09-26 23:12:20.814 UTC [1] LOG: redirecting log output to logging collector process 2024-09-26 23:12:20.814 UTC [1] HINT: Future log output will appear in directory "log". Starting api worker Starting microservices worker [09/26/24 23:12:27] INFO Started server process [5] [09/26/24 23:12:27] INFO Waiting for application startup. [09/26/24 23:12:28] INFO Created in-memory cache with unloading after 300s of inactivity. [09/26/24 23:12:28] INFO Initialized request thread pool with 2 threads. [09/26/24 23:12:28] INFO Application startup complete. Error: getaddrinfo ENOTFOUND redis at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:109:26) { errno: -3008, code: 'ENOTFOUND', syscall: 'getaddrinfo', hostname: 'redis' } Error: getaddrinfo ENOTFOUND redis at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:109:26) { errno: -3008, code: 'ENOTFOUND', syscall: 'getaddrinfo', hostname: 'redis' } Error: getaddrinfo ENOTFOUND redis at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:109:26) { errno: -3008, code: 'ENOTFOUND', syscall: 'getaddrinfo', hostname: 'redis' } Error: getaddrinfo ENOTFOUND redis at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:109:26) { errno: -3008, code: 'ENOTFOUND', syscall: 'getaddrinfo', hostname: 'redis' } ```
drjaska commented 1 month ago

Setting TZ in .env for example to TZ=Europe/Helsinki does not solve this. I browsed through all issues which I could find with is:issue ENOTFOUND redis search and I couldn't find anything helpful there.