Troubleshooting help--Redis issue? Postgres? Or something else?

I’m following the Rails Getting Started Tutorial and I followed it to the end. The only change I made was when I created a new rails app, I designated database=postgresql.
When I visit the app, it takes forever to load, sometimes throwing a 502 error. On the dashboard monitoring page, I’m repeatedly getting Could not proxy HTTP request and /usr/local/lib/ruby/3.1.0/socket.rb:1214:in __connect_nonblock’: Connection refused - connect(2) for 127.0.0.1:6379 (RedisClient::CannotConnectError)` errors. Additionally, sockets don’t seem to be working–when I update a name on the site with another tab open to the /names index page, I don’t see the update on my other tab unless I refresh the page.

WebSockets won’t work until you have redis set up, so let’s fix that.

127.0.0.1 is localhost, which likely indicates that the REDIS_URL secret is not set.

First check to see if you have redis allocated:

fly redis list

If you do NOT see any names listed there, create one with:

fly redis create

Look for a line that looks like Apps in the personal org can connect to at and copy the URL and replace <url> in the following like with that value:

fly secrets set REDIS_URL=<url>

If you DID see a name in the fly redis list command above, you can find the redis url by running the following command, substituting <name> in the following line with that name:

fly redis status <name>

Once you have the URL, run the fly secrets set line above.

2 Likes