With Kamal, you run Redis yourself as an accessory — a Docker container managed by Kamal alongside
your app. You define it in config/deploy.yml:
accessories:
redis:
image: redis:7
host: your-server-ip
port: 6379
volumes:
- /data/redis:/data
cmd: redis-server --appendonly yes # enables persistence
Kamal starts/stops it with kamal accessory boot redis. Your app then connects via
REDIS_URL=redis://your-server-ip:6379/0 set as a Kamal secret.
The key difference from Heroku: you manage the Redis instance — backups, updates, memory limits are
your responsibility. For a cache that's low stakes (lost cache = slower responses briefly), but if you
use Redis for Action Cable too you'd want it reliable.
Since you're planning a Heroku → Kamal migration anyway, it makes sense to switch to Redis now with
that future setup in mind. One Redis accessory in Kamal covers both the cache and Action Cable, same
as one add-on would on Heroku.
Want to go ahead with the Redis switch in the code?
With Kamal, you run Redis yourself as an accessory — a Docker container managed by Kamal alongside
your app. You define it in config/deploy.yml:
accessories:
redis:
image: redis:7
host: your-server-ip
port: 6379
volumes:
- /data/redis:/data
cmd: redis-server --appendonly yes # enables persistence
Kamal starts/stops it with kamal accessory boot redis. Your app then connects via
REDIS_URL=redis://your-server-ip:6379/0 set as a Kamal secret.
The key difference from Heroku: you manage the Redis instance — backups, updates, memory limits are
your responsibility. For a cache that's low stakes (lost cache = slower responses briefly), but if you
use Redis for Action Cable too you'd want it reliable.
Since you're planning a Heroku → Kamal migration anyway, it makes sense to switch to Redis now with
that future setup in mind. One Redis accessory in Kamal covers both the cache and Action Cable, same
as one add-on would on Heroku.
Want to go ahead with the Redis switch in the code?