dokku / dokku-redis

a redis plugin for dokku
MIT License
256 stars 39 forks source link

Wrong config for rejson #128

Open nemanjan00 opened 5 years ago

nemanjan00 commented 5 years ago

When I use rejson, I have problem starting server.

export REDIS_IMAGE="redislabs/rejson"
export REDIS_IMAGE_VERSION="1.0.4"

After this I create redis DB.

dokku redis:create test-db

What happens next is DB is created, but docker container is constantly rebooting.

What the problem is that for some reason, redis plugin put file containing "404 Not Found" in place of redis config.

How I fixed that is:

cp /var/lib/dokku/services/redis/anotherdb/config/redis.conf /var/lib/dokku/services/redis/test-db/config/redis.conf

After that, it was starting.

To make it work with app, I also had to update password in /var/lib/dokku/services/redis/test-db/config/redis.conf to the one in the REDIS_URL.

After it started working, I noticed REJSON does not work.

What I had to do also is to add loadmodule /usr/lib/redis/modules/rejson.so to /var/lib/dokku/services/redis/test-db/config/redis.conf.

Edit

Ok, apperently, this is expected behaviour, just not well documented one.

https://github.com/dokku/dokku-redis/blob/master/functions#L46

Looking at this line and one below it, we can clearly see redis repo is used for downloading default config on version basis.

Problem in this case is that rejson image version is not redis version.

Good thing is that in line 46 there is ENV variable used, so, we can provide default config ourself for rejson.

It would look something like this:

export REDIS_IMAGE="redislabs/rejson"
export REDIS_IMAGE_VERSION="1.0.4"
export REDIS_VERSION="4.0.14"

 curl -sSL "https://raw.githubusercontent.com/antirez/redis/${REDIS_VERSION:0:3}/redis.conf" > "/tmp/redis.$REDIS_VERSION.conf"

export REDIS_CONFIG_PATH="/tmp/redis.$REDIS_VERSION.conf"
josegonzalez commented 5 years ago

Pull requests for supporting alternative images more easily are welcome.

macinjoke commented 5 years ago

I faced the same issue with redis image version 5

$ export REDIS_IMAGE="redis"
$ export REDIS_IMAGE_VERSION="5"

$ dokku redis:create foo

$ cat /var/lib/dokku/services/redis/foo/config/redis.conf
404: Not Found

I also resolved this by editing redis.conf to update the password contained in REDIS_URL.

brainomite commented 2 months ago

Old issue: I wanted to document how I got redisJSON working in 2024 using redis-stack

### change appname and dbname to your setup
export appname="test" &&
export dbname="test-db" &&

export REDIS_IMAGE="redis/redis-stack" &&
### locate the correct redis version from the docker registry - "latest" doesn't work
export REDIS_IMAGE_VERSION="7.4.0-v0" &&

dokku redis:create $dbname &&
### enable redisJSON
echo loadmodule /opt/redis-stack/lib/rejson.so>>/var/lib/dokku/services/redis/"$dbname"/config/redis.conf &&
### restart to take effect
dokku redis:restart $dbname
dokku redis:link $dbname $appname