It’s a little confusing how to correctly setup an external managed Redis server (on DO).
Right now, looking at documentation, and also comments on this forum there are 2 ways that has been discussed to achieve this:
Go to Server Connect settings, and add the connection string in there, replacing redis://redis
Go to the resource manager, add service to server > choose DB > add redis.
There is the Redis section on the Project Options screen.
To use Redis in a Docker container, this is simple. I just use the section in targets, and choose Enable Redis, and Docker.
Now we also have in Resource Manager the Database Clusters section, where you can setup or import a Redis DB.
So technically there is now 5 different configuration options for Redis.
What I’ve tried:
Setting up Redis on the prod server, by adding service > add db > add Redis and putting the DO Managed Redis URL in there and deploying. It does go ‘green’ as if it’s working fine. I then choose this in the Project Options Redis section as a Cloud Database.
Problem: it locks the app. There is no option here to put in any credentials so I’m assuming this is incorrect if the Redis DB is outside the Docker Container.
I’ve tried adding the Redis DB in Database Clusters - it all imports fine and then I choose this in the Redis section on Project Options for the prod server, choose Cloud DB and then choose the DB server I imported in the Database Clusters section and deploy.
Problem: The deploy fails, it states the container for web and redis are started, but, the green dot that indicates the server is running just flashes green, then red, then permanently red.
The option I haven’t tried is to turn redis off in the project settings, and then add the connection string in the server connnect redis settings. Turning this off doesn’t seem the correct approach, but then it only gives me two options, docker, or cloud and so needs one selected.
For dev, and staging I use Redis in the Docker Container. For Prod I want to use a managed Redis DB as I’ll be running multiple replica’s of my node app and so need to point the sessions to one managed DB.
Any help appreciated - this i’m assuming is simple but I’m missing something.
Digital Ocean does not display a ‘Managed Redis DB’ but I assume setting up Redis on the server as ‘services’ in Wappler just set’s it up on the server itself and not a managed DB.
Using ‘docker ps -a’ to see all docker containers on the remote server, it shows two Redis containers. One looks to be the same name convention for when I setup a Redis within a Docker Container, and then a wappler-compose version, which is the Redis setup external to the Docker Container.
I tried removing the redis setup within Docker, and saved the target again (that points to the external Redis) but it recreates it each time I deploy.
In yhe dokver-compose file for the remote target, it is displaying this with the project_options correctly pointing redis at the remote service (I don’t know if this is correct or if it should include code relevant to the remote redis).
Ideally, I can just setup a Managed Redis DB with Digital Ocean, and point to this - but i’m not having luck with that. So I’m trying to configure it when creating within Wappler but I cannot find a way around the Networking error.
@George could you just please provide a simple step-by-step on how to connect to an external, managed Redis DB? I’m sure others looking to scale a node application would find this useful.
I did have an initial error, as the connection string created by Wappler did not include the secure connection extra ‘s’ but once that was included, all works fine.
It might be worth splitting your step-by-step into a separate post that’s more easily found by the community - clearly some confusion about how to setup Redis so I think that would help (and limit the questions being asked in the future).
In the next Wappler update there will be also some improvements in auto generating the Redis settings for local targets, so it should go much more smoothly now.