Report this

What is the reason for this report?

How to use sidekiq and redis in digital ocean?

Posted on June 19, 2014

I have a rails app and i would like to use sidekiq for background processing. I have few doubts regarding usage of sidekiq in digital ocean.

1, How can i start ssidekiq in digital ocean ruby on rails droplet? 2, I have read the document explaining the installation of redis in ubuntu, but how can i start redis in the same droplet whenever i restart? 3, Can i start sidekiq from the procfile in rails? If yes, how should i add the start command (e.g., worker: bundle exec sidekiq in heroku). How should i start in digital ocean? 4, If the task is assigned to redis queue and what happens if the redis is restarted? 5, Similarly what happens when sidekiq is restarted when a task is being processed?

Please help me.



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hi!

There are many ways that you can accomplish all of this. If you’d like to start sidekiq from a procfile, I’d suggest you take a look at Foreman. It allows you to run a procfile simply with: <pre> foreman start </pre> You can install it with: <pre> gem install foreman </pre> Check it out:

https://github.com/ddollar/foreman http://blog.daviddollar.org/2011/05/06/introducing-foreman.html

You could start Redis that way as well, but it probably makes more sense to just have it startup at boot using the init system. If you install it using the following tutorial, init scripts will be included and Redis will automatically start on boot. You can then control it with: <pre> sudo service redis_6379 start sudo service redis_6379 stop </pre> The number depends on the port you set during the installation. 6379 is the default port setting.

https://www.digitalocean.com/community/tutorials/how-to-install-and-use-redis

Thank you and i would like to know few more thing. If i start of the sidekiq and the app from the procfile, then if i were supposed to push some code changes then the app should be restarted so, what happens for the process that is currently running in the sidekiq? Can i able to run sidekiq separately in the same droplet so that the restarting the app would not affect sidekiq?

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.