feat: support self-signed certs for redis/valkey #20576
Open
+75
−3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Despite ioredis supported TLS connection out of the box, the support never was implemented in immich.
This means if a user already have Redis/Valkey setup on there environment will need a separate instance of Redis to run immich, since the authentication will fail
So this PR allow, by the use of environment variable to:
REDIS_TLS = true
(disable by default)REDIS_INSECURE_TLS = true
How Has This Been Tested?
In this link you have a docker image (older version but with all the changes) and there 2 ways to test the changes, these test assume a existing Redis/Valkey is already setup with TLS
Test 1: Setup the Redis as describe in documentation (I using REDIS_HOSTNAME, REDIS_USERNAME and REDIS_PASSWORD) and then enable both REDIS_TLS and REDIS_TLS_INSECURE, this way no certs need to be provided
Test 2: Setup the Redis as describe in documentation and setup a mount point with the Redis Certificates (I just mounted the secret
valkey-tls
in/tls-redis
). Then you just add the following env:Notes: In my k3s cluster I use valkey bitnami chart with the following values for tls:
Exemple deployment for Test 2 (based on my setup):
Checklist:
src/services/
uses repositories implementations for database calls, filesystem operations, etc.src/repositories/
is pretty basic/simple and does not have any immich specific logic (that belongs insrc/services/
)