immich icon indicating copy to clipboard operation
immich copied to clipboard

Incorrect redis server naming in example docker-compose triggers Redis NOAUTH error

Open a10kiloham opened this issue 1 year ago • 4 comments
trafficstars

The bug

In the docker-compose the redis image is named 'immich_redis' which is sensible. However in the default sample .env, this is not included, so those using that will get NOAUTH errors because without REDIS_HOSTNAME configured, it defaults to 'redis' which is undefined unless one is already running a local redis image accessible under that name.

The OS that Immich Server is running on

Docker

Version of Immich Server

latest

Version of Immich Mobile App

latest

Platform with the issue

  • [X] Server
  • [ ] Web
  • [ ] Mobile

Your docker-compose.yml content

redis:
    container_name: immich_redis
    image: docker.io/redis:6.2-alpine@sha256:328fe6a5822256d065debb36617a8169dbfbd77b797c525288e465f56c1d392b
    healthcheck:
      test: redis-cli ping || exit 1
    networks:
      - immich
    restart: always

Your .env content

# Fix
REDIS_HOSTNAME=immich_redis

Reproduction steps

Curl the existing docker-compose.yml and .env files

Relevant log output

No response

Additional information

Submitting PR to fix this

a10kiloham avatar Jul 26 '24 16:07 a10kiloham

Proposed solution here - https://github.com/immich-app/immich/pull/11378

a10kiloham avatar Jul 26 '24 17:07 a10kiloham

So, most instances of docker will resolve either the container name, hostname, or service name (which is redis) to the container.

With that said, I've felt that we should fix this issue before we go to stable. I would propose something different than your PR, though. I've seen a lot of people have this issue come up.

I honestly think we should specify the service name, container name, and hostname for every service to all be identical. Something like immich-server, immich-redis, immich-postgres. (you can't use _ in hostnames). At the same time we could add those as the hostnames to the default env file, and it shouldn't break old installs. Whether this will actually happen is a big question.

Example:

services:
  immich-server:
    container_name: immich-server
    hostname: immich-server
    image: ...

mmomjian avatar Jul 26 '24 17:07 mmomjian

Yeah these are all inelegant options. I have a legacy container named redis and this is what tripped me up. The correct way is indeed immich-redis style naming I agree. Your proposal makes the most sense but will lead to some breaking changes I suppose.

a10kiloham avatar Jul 26 '24 18:07 a10kiloham

We can solve this right before going stable to avoid making unnecessary breaking changes to others setup now

alextran1502 avatar Jul 26 '24 18:07 alextran1502

Yeah, so this isn't an actual bug with immich, and I will be closing the issue. We are aware of some usability improvements that can be made with the docker compose file and we will work to make those improvements as we get closer to a stable release.

The server does default to redis, which is the service name of the container in the default setup, so everything works as expected.

jrasm91 avatar Jun 23 '25 19:06 jrasm91