Install Redis server 'locally' on my Laravel server

I only need a small redis server for queue and caching. I want to install the redis server with my Docker image and connect via 127.0.0.1.

I have tried :::

including the redis package in the Docker file and it installs fine.

I have set the Redis host to 127.0.0.1 in my fly.toml

I get Connection refused errors in my logs and the queue / cache is not running.

I am assuming I will need to set the redis server running via the supervisor, any help appreciated!

I guess the first thing to say is that Fly recommends Redis be run separately. As in the guide: Full Stack Laravel · Fly (which is being updated next week). That makes sense, particularly when it comes to scaling and consistency (like if you have 2+ vms for your app, running Redis within each of those vms would result in 2+ caches, and they would then get out of sync and make purging hard).

If you do want to persist, I guess you would either be getting connection refused if Redis is not running, or it is running but has the wrong connection details. So the first thing to debug this would be seeing if Redis is actually running. If not, well thats your answer. You could use fly ssh console to SSH into the app’s vm to check.

But yes, you will need to use some kind of multi-process approach to keep it running. For example check this thread for the new Fly approach (here, for queues):

But that will result in a separate vm.

Or if you do want to use supervisor (so, within a single vm) but that’s not working, maybe check the suggested solution here (scroll down to the very bottom of the page) and compare to yours:

And then once you confirm Redis is running (whether in a separate vm, or in the same one as a process kept running by e.g supervisor), you can debug the connection host/port/password to connect to it :slight_smile:

Hi @greg thanks for the great response. I did get the Redis server running on the servers. I did forget to unset REDIS_PASSWORD secret. It turns out id you send a password to a redis server that doesn’t need one it will fail AUTH.

I will probably revert to using the Redis VMs I had already setup, as I wanted to debug / eliminate an issue.

Cheers, Tom

1 Like