0

i'm using sidekiq in a rails DEVELOPMENT environment with rvm and passenger.

At app's boot, i need to manually start Sidekiq with:

bundle exec sidekiq --environment development -C sidekiq.yml

is ther a way to Autostart it on App start or restart (not server boot) ?

thanks

EffeBi
  • 309
  • 3
  • 11

1 Answers1

1

Use the foreman gem. With foreman, you declare all the processes your app requires to run in a Procfile.

See a sample Procfile definition of an app using puma and sidekiq below:

web:    bundle exec puma -C config/puma.rb
worker: bundle exec sidekiq --environment development -C sidekiq.yml

The foreman start command starts your app.

quajo
  • 26
  • 3
  • is it forman good also for production environment? using passenger (also for development) i don't start app in puma (with rails s) – EffeBi Jul 31 '17 at 14:22
  • Yes. foreman can be used in production. You can incorporate it into your release tool (e.g. Capistrano) and have it run when you deploy to production. You can replace the puma command with the passenger command you use. – quajo Jul 31 '17 at 16:22
  • Take a look at this [answer](https://stackoverflow.com/questions/11592798/use-different-procfile-in-development-and-production) regarding defining different Procfiles based on the environment. – quajo Jul 31 '17 at 16:36