-
Notifications
You must be signed in to change notification settings - Fork 304
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Trouble connecting docker image to external redis server #232
Comments
I see now it's looking for |
I'm glad you figured it out. By the way, it does use The
This is the right way to inject the file, but you left the command ( Line 21 in f4efbfd
To use your own config file, you just need to tell docker run -d --name Webdis --restart=unless-stopped -p 7379:7379 -v d:/redis-data/webdis/webdis.json:/etc/webdis.json nicolas/webdis /usr/local/bin/webdis /etc/webdis.json I'll be adding a documentation page shortly that will provide detailed steps for how to run Webdis with an external Redis instance. This use case seems common enough that it's worth having a dedicated page for. |
Yeah I was going in circles for a min. trying to figure out why I was reading/writing from Postman, but nothing appeared in my redis instance. Once I saw it was using .prod.json all became clear and worked as expected.
Maybe make an image that is ONLY Webdis (webdis-server), without the redis bits? For my use case we will create Pods that run this image so the lighter the better. I could see a webdis (what you have now), a webdis-stack which would embed the redis stack, and a webdis-server which is only webdis. The only other suggestion is to maybe go though and add the all new Redis commands so that manually adding them to the config is not necessary. Thoughts? |
Yes, I've thought about it too. I'll look into it next time I prepare a release. My goal with the Docker images was really to make it as simple as possible to try out Webdis, but I realize that this isn't really the image you'd want to use if you're using Webdis within an existing architecture. Another benefit of this is that while the images are already tiny (Docker Hub says 8.23 MB for the current In the meantime I'll take a look at how other "connected" services build their images; by this I mean services/software that you would generally not run on its own but with the service connecting to other instances in the environment, instances it depends on. Docker Compose provides a reasonably simple way to do this, but I'm not sure whether it would be what Webdis users expect to use. As for this point:
I'm not sure what you mean here. By default Webdis disables the Lines 15 to 24 in f4efbfd
If you want all commands to be allowed, just remove any entry under "acl": [ ], Disabling only There is also a wildcard |
Inspired by the questions on issue #232. Documents what should be a relatively common use case for Webdis users.
Inspired by the questions on issue #232. Documents what should be a relatively common use case for Webdis users.
Yes, I stand corrected. The issues I faced were purely the bad configuration. I can confirm that no commands needed to be enabled in the configuration for it to work. |
Cool, I'm glad it worked. By the way, I've made some final tweaks to the docs page I mentioned on the other GitHub issue and pushed it. I've listed it first in the docs README since it feels like a common use case, with the title "Running Webdis in Docker with an external Redis instance". This is not the first GitHub issue in recent months where a question eventually led to a docs page; I hope these can be useful. I still need to make the docs more prominent on the repo's main page, but first need to review the README to see if it might make sense to extract more of it there. In any case, thanks for bringing this up! It made Webdis better :-) |
Hi @nicolasff I was putting together a linqpad example for you and started running into some issues again. using this config {
"redis_host": "localhost",
"redis_port": 63791,
"verbosity": 8,
"logfile": "/dev/stdout",
"http_host": "0.0.0.0",
"http_port": 7379,
"threads": 5,
"pool_size": 20,
"daemonize": false,
"websockets": false,
"acl": [
{
"disabled": ["DEBUG", "FLUSHALL", "FLUSHDB"],
"http_basic_auth": "*:*"
}
]
} I'm using this image which I can connect to externally, no problem But webdis is giving me 503 service unavailable. However, I can connect to other instances and it works no problem. And I can change the docker command above to use the default redis port 6379 and it all works as well. I have verbose on 8, yet I'm not seeing anything that would tell me what the problem is (while pointing to 63791). |
Hey Charles, sorry I had missed this issue.
This is easy to validate, really. You can run Redis on your local machine and verify that it's listening on $ redis-cli -h localhost -p 6379 PING
PONG and then install $ docker run --rm -ti alpine:3.18.3 /bin/sh
/ # apk add redis
fetch https://dl-cdn.alpinelinux.org/alpine/v3.18/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.18/community/x86_64/APKINDEX.tar.gz
(1/1) Installing redis (7.0.12-r0)
Executing redis-7.0.12-r0.pre-install
Executing redis-7.0.12-r0.post-install
Executing busybox-1.36.1-r2.trigger
OK: 10 MiB in 16 packages
/ # redis-cli -h localhost -p 6379 PING
Could not connect to Redis at localhost:6379: Connection refused As expected, this fails since Redis is not running in this container (yes we've just installed it, but it's still not running). So yes, if you tell Webdis to connect on What you are trying to do seems common enough that there's a Stack Overflow post about it with thousands of votes: "From inside of a Docker container, how do I connect to the localhost of the machine?". As for this part:
As I mentioned in the other issue, publishing images of Webdis takes quite a while. I have a list of steps I go through which currently has 33 steps, and signing all the different images requires a custom script that's over 450 lines long. This part requires entering 5 different passwords – most of them multiple times – to pass an API token to Docker Hub, to sign images with the Trust Key, the Root Key, the Repository Key, and then to auth with AWS to publish the images there. You can read about the complex relation between images and various keys in the docs, described in detail by this diagram. So no, I really can't do one-off releases when all it would take for you to test a custom image would be to edit the docker build -t webdis:custom . |
I'm trying to test this with your docker image, and I'm not having any luck getting it to talk to my Redis server instance.
The commands above work as expected, but I'm not sure where this data is being written because my redis database is empty, even though I get a result back from webdis
I started it with the following command:
using the following webdis.json
Where is this data being stored, and how can I get it to talk with my specific instance?
The text was updated successfully, but these errors were encountered: