From 98112b5a0353921c4251ee177d1e667fa493ff25 Mon Sep 17 00:00:00 2001 From: Gopesh Tulsyan Date: Thu, 14 Aug 2014 21:38:18 +0530 Subject: [PATCH] Adds delayed jobs recipe for production, and some documentation added for running delayed jobs in local --- INSTALL.md | 6 ++++++ config/deploy.rb | 7 ++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/INSTALL.md b/INSTALL.md index aec33600..2d3c9605 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -60,6 +60,12 @@ myprovider_secret = 'sample data' That is required so that the check in app/views/devise/shared/_openid.html.haml will pass and the image-link to login using the provider will be shown. + +11. Open a separate terminal and go into the directory where the rails app is present, and type the following to start the delayed_jobs worker for sending email notifications. +``` +rake jobs:work +``` + ### Run OSEM in production We recommend to run OSEM in production with [mod_passenger](https://www.phusionpassenger.com/download/#open_source) and the [apache web-server](https://www.apache.org/). There are tons of guides on how to deploy rails apps on various diff --git a/config/deploy.rb b/config/deploy.rb index d514bf75..dfcd0204 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -28,6 +28,10 @@ end desc 'Deploys the current version to the server.' task deploy: :environment do + to :prepare do + queue "cd #{deploy_to}/current && RAILS_ENV=production script/delayed_job stop" + end + deploy do invoke :'git:clone' invoke :'deploy:link_shared_paths' @@ -38,8 +42,9 @@ task deploy: :environment do to :launch do queue "sudo /etc/init.d/apache2 restart" + queue "cd #{deploy_to}/current && RAILS_ENV=production script/delayed_job start" end - + invoke :'deploy:cleanup' end end