Using and installing Redis with Docker or direct on your server

Thanks guys,

Redis is new for me outside of using in Docker…

Anything in particular I should know about setting it up?

It’s super easy to use you just need a Redis connection url.

Redis is also a superpowers memory database. You can enable it as caching for server actions response and also on NodeJS routes with templating.

It will serve those urls 10 times faster from cache.

1 Like

See:

Nope. Nothing fancy. If you want to test things Heroku has a free plan. I haven’t tried this but I guess you can attach it to a free heroku app and copy the connection string and use it as external connection in Wappler.

You can also use several desktop db managers(i.e. tableplus) to manage the data if you want to check what and how it stores it.

1 Like

Success!

For others, the install that worked for me on a Centos 8 instance:

sudo dnf install redis nano
sudo nano /etc/redis.conf (change line "supervised no" to "supervised systemd"; save and exit)
sudo systemctl start redis.service
sudo systemctl enable redis

Check status if service to confirm running:

sudo systemctl status redis
redis-cli ping (receive back PONG)

Setup redis in Wappler:

3 Likes

Hi Ken,

How did you sort out Redis per target/environment for remotes?

Jon

Just getting started here :coffee: bit I think I just change the settings per target. All settings on these tabs change as you change your active target, right?

1 Like

The redis setting is in the config.js file and for me at least it is not changing per target. Also this wouldn’t work for me because I only have one target. The deployment is handled outside of Wappler.

I requested @patrick to be able to parse bindings in config.js but for now I’m stuck if I don’t modify again core files.

Just checked, and you’re right (although I really thought I had one sandbox project that had different settings per target.) Only SOME of those settings (eg. Stripe keys) are retained per target.

Looks like everything I work on has the default redis uri.

I agree, it would be helpful to have all settings on those tabs set per target or be able to have ENV, etc. in the config.

1 Like

Anyway if you want to go the ENV route.

Go to
lib/setup/redis.js

And change line 5 for

 global.redisClient = redis.createClient(config.redis === true ? 'redis://redis' : process.env.REDIS_URL);

Or whatever ENV variable you are using.

2 Likes

Thanks for this JonL! I agree though with the sentiment in this thread. It would be nice if redis URL was environment specific. @George this would be nice feature request to enable local redis for dev and hosted redis for downstream environments.

1 Like