immich-app / immich

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

[BUG] REDIS Env not passed in to redis container in docker-compose #1973

Closed dragosrotaru closed 1 year ago

dragosrotaru commented 1 year ago

The bug

Looks like the docker-compose.yml file does not actually pass in the Redis environment variables shown in example.env

 redis:
    container_name: immich_redis
    image: redis:6.2
    restart: always

The OS that Immich Server is running on

Any`

Version of Immich Server

1.50.1

Version of Immich Mobile App

N/A

Platform with the issue

Your docker-compose.yml content

N/A (see default docker-compose.yml)

Your .env content

see example.env

Reproduction steps

None

Additional information

No response

alextran1502 commented 1 year ago

Did you change example.env to .env?

dragosrotaru commented 1 year ago

@alextran1502

redis:
    container_name: immich_redis
    image: redis:6.2
    restart: always

its obvious just from reading this code that the environment variables have no effect. The .env file provided to docker-compose is not auto passed on to the container, for that you need to use the env_file key. Also, even if it was passed to the redis image as environment variables, the redis image would have no idea what to do with it because these settings need to be configured via the redis CLI or via redis.conf. Doing a search on the repo, I see these variables are only used in Data Access Layer adapters, so I am highly confident they have no effect on Redis itself.

Sources:

alextran1502 commented 1 year ago

Hmm I haven't visited Redis container for a while but I believe we did have some environment variables option for the container. Oh right we have redis options for the server's queue so we put environment variable for the server to point to the external Redis service, but we don't have anything setup for the Redis container in Immich setup

dragosrotaru commented 1 year ago

No worries, I can submit a PR

On Thu, Mar 9, 2023, 4:07 p.m. Alex @.***> wrote:

Hmm I haven't visited Redis container for a while but I believe we did have some environment variables option for the container. Oh right we have redis options for the server's queue so we put environment variable for the server to point to the external Redis service, but we don't have anything setup for the Redis container in Immich setup

— Reply to this email directly, view it on GitHub https://github.com/immich-app/immich/issues/1973#issuecomment-1461523262, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABZCWGKLIES7OU33D4FAWALW3GFURANCNFSM6AAAAAAVUVZFQU . You are receiving this because you authored the thread.Message ID: @.***>

bo0tzz commented 1 year ago

There's no need to passthrough env variables to the redis container, as the defaults work just fine for Immich. Of course if you want to change some settings on your own setup, you're free to do that.

dragosrotaru commented 1 year ago

@bo0tzz Then the documentation should be updated to reflect that, because the example.env lists Redis parameters that are not actually passed to redis. I wasted time to find that out, and so will anyone that looks at the documentation and sees:

###################################################################################
# Redis
###################################################################################

REDIS_HOSTNAME=immich_redis

# Optional Redis settings:
# REDIS_PORT=6379
# REDIS_DBINDEX=0
# REDIS_PASSWORD=
# REDIS_SOCKET=

This should say:

# These parameters are not passed to Redis in the docker-compose.yml config.

Documentation should reflect the reality of how something works so that people without knowledge of internals don't waste time digging into the internals to find out

jrasm91 commented 1 year ago

Feel free to open a PR if you think it should be updated.