docker-redis-cluster
docker-redis-cluster copied to clipboard
Add support for passwords
It would be great to be able to use docker-redis-cluster and put a password in front of it. It's not clear to me from the existing documentation whether that's possible; I'm fairly certain it isn't.
I am not sure if i want to go down this path of adding more and more features that should be configurable somehow because then it could mean that more and more features would want to be added as somehow easy configurable. And it kinda breaks and moves away from the basic idea of this dockerfile as it should be used for a quick bootstrapping of a cluster that you can spin up and use for demos/tests/development and the basic feel from me is that if you need passwords in the base setup, you are probably using it wrong and not for those kinds of intended purposes. Adding a password feels like a production thing.
We use docker in part so that we can have dev/prod parity; we would like to be able to have our development redis setup be as similar as possible to our production redis setup (which is why we're using a cluster in dev at all rather than a single redis instance). Ideally that would include being able to set a password.
This is not a blocker for us or anything; we can work around it by configuring our redis location with a URL that does or does not include a password. I get it if it's not a feature you want to support.
I will give it some more thought before deciding, but currently i am leaning towards not to support anything config based or dynamic stuff other then the bare minimum essentials like the IP variable that is required to even get it going. The idea of this one is not to have it production grade and compatible with all different types of systems and solutions. This is intended for dev/test types of environment and not much more. I think there is many other containers out there that would be possible to run at production quality instead of this one.
My current recommendation is that you fork this and modify the config file to your needs and run with that. Or you can make a sub image that overrides the config file. The only case i would be willing to accept is to have something super generic that will enable anyone to have the ability to set any key:value in the config file. I am not up to speed with all options that docker support and if there is some new way to inject stuff during startup or not. If you have any suggestion in this direction i will consider it.
This is the discussion on the docker redis image, there are few workarounds. It will be nice if we could at least override the command as in the redis vanilla image. See here:
redis:
image: redis:4
ports:
- "6379:6379"
command: "--requirepass secret"
redis_cluster:
image: grokzen/redis-cluster:4.0.9
ports:
- '7000-7007:7000-7007'
command: "--requirepass secret"
environment:
CLUSTER_ONLY: "true"
It should not be a too terrible change
It would require patching the supervisord scripts to allow the injection of the extra stuff. But unless i have access to the content of the variable command inside the container i can't really use it, Maybe patching all cli arguments sent to the docker-entrypoint.sh script and pass it along to redis-server command might work, but not sure if possible.
If can set the password, this is perfect.Waiting for update.
Fyi @Grokzen -- I implemented the option for both providing authentication for default user as well as a custom user through environment variables set during docker container build. It is backward compatible. LMK if you're intereseted in a PR to review.
Is there any update on that? @Grokzen you suggested
I think there is many other containers out there that would be possible to run at production quality instead of this one.
I could not find any example that would work with redis-py-cluster. Would appreciate some suggestions of what other image I could use.
Good idea, I have issues with auth on production, so I want test auth on local, too
for those who need authentication, I've fork this repository to support authentication. https://registry.hub.docker.com/r/phuongdm1987/docker-redis-cluster
@phuongdm1987 how to set password ? using environment?
@phuongdm1987 Can you show me using docker-compose file?
@phuongdm1987 Can you show me using docker-compose file?
@tmdgusya Here is the setup in my docker-compose file.
redis-cluster:
image: 'phuongdm1987/docker-redis-cluster:1.0.0'
volumes:
- 'redis-cluster:/data'
ports:
- '7000-7005:7000-7005'
environment:
DEFAULT_PASSWORD: 'secret'