Open odscjames opened 1 year ago
Brief Description npm run docker:start can't connect to Redis
npm run docker:start
Severity Low
Steps to Reproduce in .env set
REDIS_HOSTNAME=redis
Try to run locally with docker
Expected Results/Behaviour You see
{ name: 'redisConnect', value: 'Redis: Connection to redis ready' }
Actual Results/Behaviour
Redis: Unable to connect to the redis database: ConnectionTimeoutError: Connection timeout
Workaround
diff --git a/config/redis.js b/config/redis.js index 3c64d21..20545d3 100644 --- a/config/redis.js +++ b/config/redis.js @@ -3,9 +3,9 @@ import config from './config.js'; let connectionOptions = {}; // https://learn.microsoft.com/en-us/azure/azure-cache-for-redis/cache-best-practices-connection -if (config.REDIS_KEY && config.REDIS_HOSTNAME) { +if (config.REDIS_HOSTNAME) { connectionOptions = { - url: `rediss://${config.REDIS_HOSTNAME}:${config.REDIS_PORT}`, + url: `redis://${config.REDIS_HOSTNAME}:${config.REDIS_PORT}`, password: config.REDIS_KEY, socket: { connectTimeout: 5000,
First line change needed as there is no key and we still want to set up all the fancy stuff.
Second line change needed as there is no SSL on the Redis Docker.
I guess we'll need to add a config.REDIS_SSL option
Or we assume production always uses SSL and dev never does, and after line 29 just add:
} else { connectionOptions = { url: `redis://${config.REDIS_HOSTNAME}:${config.REDIS_PORT}` } }
Brief Description
npm run docker:start
can't connect to RedisSeverity Low
Steps to Reproduce in .env set
Try to run locally with docker
Expected Results/Behaviour You see
Actual Results/Behaviour
Workaround
First line change needed as there is no key and we still want to set up all the fancy stuff.
Second line change needed as there is no SSL on the Redis Docker.
I guess we'll need to add a config.REDIS_SSL option