summaryrefslogtreecommitdiff
path: root/lib/tasks/sidekiq.rake
blob: 6bbcb3da4bc4d9f286acaab05937709c2302eab7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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