Created
Apr 8, 2022 8:13 AM
Department
Engineering
Category
Deployment
Technology
Ruby on Rails
Tags
Date
URL
Setting up a sidekiq - Redis worker server in Rails and Cloud66
‣
Project configuration
- Add
gem 'sidekiq'
to your project’sGemfile
- Create a
Procfile
at your project’s root directory with the following contents - Add the following line to
config/environments/production.rb
. Do the same forstaging
- For Rails 6+: Create a new
config/sidekiq.yml
file with the following contents
worker: bundle exec sidekiq -e $RAILS_ENV
config.active_job.queue_adapter = :sidekiq
:queues:
- default
- active_storage_analysis
- active_storage_purge
This will ensure jobs launched by ActiveStorage won’t sit idle forever. If you are using any queue other than default
in any of your jobs. make sure to add it here as well
- optional: To track sidekiq’s performance, add the following to the
config/routes.rb
file:
require 'sidekiq/web'
mount Sidekiq::Web => '/sidekiq'
‣
Cloud66 configuration
Redis
- In the Cloud66 main app screen, click on the large + sign beside Add-Ins, and select Redis
- Depending on your environment
- Staging: Select Existing Server and click on Add
- Production: Select New Cloud Server and choose one according to your needs. Ask your team leader for guidance if required.
Process server
Once you have pushed and redeployed, a new Process Server will appear on the Cloud66 stack.
- Click on Process Server
- Depending on your environment
- Staging: Click on the green + button (Scale-up this process group)
- Production: Select New Process Server and choose one according to your needs. Ask your team leader for guidance if required. Then do the same as staging