summaryrefslogtreecommitdiff
path: root/lib/tasks/sidekiq.rake
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-01-09 18:21:49 +0200
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-01-09 18:21:49 +0200
commit66ecfa77e5105c8a8151db899e3d3a09dba3024e (patch)
treec8780c4bfcb5135dfc465f2f0d03424501ed3382 /lib/tasks/sidekiq.rake
parent7bfd38eaa95988accfc6bb09759d7688126f5692 (diff)
parent9773ccc4519c4c35f969248c4e0f13689b631760 (diff)
downloadgitlab-ce-66ecfa77e5105c8a8151db899e3d3a09dba3024e.tar.gz
Merge branch 'sidekiq'
Diffstat (limited to 'lib/tasks/sidekiq.rake')
-rw-r--r--lib/tasks/sidekiq.rake23
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/tasks/sidekiq.rake b/lib/tasks/sidekiq.rake
new file mode 100644
index 00000000000..6bbcb3da4bc
--- /dev/null
+++ b/lib/tasks/sidekiq.rake
@@ -0,0 +1,23 @@
+namespace :sidekiq do
+ desc "GITLAB | Stop sidekiq"
+ task :stop do
+ run "bundle exec sidekiqctl stop #{pidfile}"
+ end
+
+ desc "GITLAB | Start sidekiq"
+ task :start do
+ run "nohup bundle exec sidekiq -q post_receive,mailer,system_hook,common,default -e #{rails_env} -P #{pidfile} >> #{root_path}/log/sidekiq.log 2>&1 &"
+ end
+
+ def root_path
+ @root_path ||= File.join(File.expand_path(File.dirname(__FILE__)), "../..")
+ end
+
+ def pidfile
+ "#{root_path}/tmp/pids/sidekiq.pid"
+ end
+
+ def rails_env
+ ENV['RAILS_ENV'] || "production"
+ end
+end