Reputation: 23
I am using delayed_job in rails application development and in development environment i use bin/delayed_job start
But how to do the same in production environment?
Upvotes: 2
Views: 2409
Reputation: 23
In case someone else gets stuck with -bash: bin/delayed_job: Permission denied error as Disha did in comments above, for Centos it is enough to set delayed_job in bin/ folder in your project's directory to executable.
Upvotes: 0
Reputation: 2784
RAILS_ENV=production bin/delayed_job start
This should make the delayed jobs run in production env
Upvotes: 2
Reputation: 16506
To start:
cd /home/user/app;
bundle exec /usr/bin/env RAILS_ENV=production /home/user/app/script/delayed_job start
To stop:
cd /home/user/app;
bundle exec /usr/bin/env RAILS_ENV=production /home/user/app/script/delayed_job stop
Refer to official documentation at github.
RAILS_ENV=production script/delayed_job start
RAILS_ENV=production script/delayed_job stop
# Runs two workers in separate processes.
RAILS_ENV=production script/delayed_job -n 2 start
RAILS_ENV=production script/delayed_job stop
# Set the --queue or --queues option to work from a particular queue.
RAILS_ENV=production script/delayed_job --queue=tracking start
RAILS_ENV=production script/delayed_job --queues=mailers,tasks start
# Use the --pool option to specify a worker pool. You can use this option multiple times to start different numbers of workers for different queues.
# The following command will start 1 worker for the tracking queue,
# 2 workers for the mailers and tasks queues, and 2 workers for any jobs:
RAILS_ENV=production script/delayed_job --pool=tracking --pool=mailers,tasks:2 --pool=*:2 start
# Runs all available jobs and then exits
RAILS_ENV=production script/delayed_job start --exit-on-complete
# or to run in the foreground
RAILS_ENV=production script/delayed_job run --exit-on-complete
Upvotes: 1