| Engineering | Infrastructure | How to deploy Redis and Sidekiq on a Rails app using Digital Ocean
How to deploy Redis and Sidekiq on a Rails app using Digital Ocean


This guide is a continuation of How to deploy a Rails app using Digital Ocean and will walk through how to deploy Redis and Sidekiq on the same Digital Ocean Droplet as your Rails application.

SSH into server

$ ssh deploy@[ip_address]

Install Redis

$ sudo apt install redis-server

Check if Redis is running

Redis should already be running on boot of the server.

$ systemctl status redis

You should see a response that looks similar to this. Look for the active (running) status:

 redis-server.service - Advanced key-value store
   Loaded: loaded (/lib/systemd/system/redis-server.service; enabled; vendor preset: enabled)
   Active: active (running) since Sat 2019-07-27 20:09:11 UTC; 1min 20s ago
     Docs: http://redis.io/documentation,
 Main PID: 20499 (redis-server)
   CGroup: /system.slice/redis-server.service
           └─20499 /usr/bin/redis-server  

If you see an error where Redis canno be found Unit redis.service could not be found., symlink from Created symlink /etc/systemd/system/redis.service → /lib/systemd/system/redis-server.service. using:

$ sudo systemctl enable redis-server

Reload the deamon and restart redis

$ systemctl daemon-reload
$ systemctl restart redis

Configure Redis

The default redis configuration should work for most hobby applications. In case you need to modify the redis config, run:

$ sudo nano /etc/redis/redis.conf

Add Sidekiq Capistrano Gem to Gemfile.rb to development gem group

group :development do
  gem 'capistrano-sidekiq'

Install the gem

$ bundle

Add Sidekiq to your to Capfile

require 'capistrano/sidekiq'