summaryrefslogtreecommitdiff
path: root/lib
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
parent7bfd38eaa95988accfc6bb09759d7688126f5692 (diff)
parent9773ccc4519c4c35f969248c4e0f13689b631760 (diff)
downloadgitlab-ce-66ecfa77e5105c8a8151db899e3d3a09dba3024e.tar.gz
Merge branch 'sidekiq'
Diffstat (limited to 'lib')
-rwxr-xr-xlib/hooks/post-receive1
-rw-r--r--lib/tasks/gitlab/check.rake6
-rw-r--r--lib/tasks/resque.rake23
-rw-r--r--lib/tasks/sidekiq.rake23
4 files changed, 27 insertions, 26 deletions
diff --git a/lib/hooks/post-receive b/lib/hooks/post-receive
index ebd9e1a028a..6944d3e3f72 100755
--- a/lib/hooks/post-receive
+++ b/lib/hooks/post-receive
@@ -1,5 +1,6 @@
#!/usr/bin/env bash
+# Version 4.1
# This file was placed here by GitLab. It makes sure that your pushed commits
# will be processed properly.
diff --git a/lib/tasks/gitlab/check.rake b/lib/tasks/gitlab/check.rake
index 252b508609a..db181cb9a96 100644
--- a/lib/tasks/gitlab/check.rake
+++ b/lib/tasks/gitlab/check.rake
@@ -871,7 +871,7 @@ namespace :gitlab do
namespace :resque do
- desc "GITLAB | Check the configuration of Resque"
+ desc "GITLAB | Check the configuration of Sidekiq"
task check: :environment do
warn_user_is_not_gitlab
start_checking "Resque"
@@ -888,7 +888,7 @@ namespace :gitlab do
def check_resque_running
print "Running? ... "
- if run_and_match("ps aux | grep -i resque", /resque-[\d\.]+:.+$/)
+ if run_and_match("ps aux | grep -i sidekiq", /sidekiq-[\d\.]+:.+$/)
puts "yes".green
else
puts "no".red
@@ -899,7 +899,7 @@ namespace :gitlab do
)
for_more_information(
see_installation_guide_section("Install Init Script"),
- "see log/resque.log for possible errors"
+ "see log/sidekiq.log for possible errors"
)
fix_and_rerun
end
diff --git a/lib/tasks/resque.rake b/lib/tasks/resque.rake
deleted file mode 100644
index 0c3b93c5bed..00000000000
--- a/lib/tasks/resque.rake
+++ /dev/null
@@ -1,23 +0,0 @@
-require 'resque/tasks'
-
-namespace :resque do
- task setup: :environment do
- Resque.before_fork = Proc.new { ActiveRecord::Base.establish_connection }
- end
-
- desc "Resque | kill all workers (using -QUIT), god will take care of them"
- task :stop_workers => :environment do
- pids = Array.new
-
- Resque.workers.each do |worker|
- pids << worker.to_s.split(/:/).second
- end
-
- if pids.size > 0
- system("kill -QUIT #{pids.join(' ')}")
- end
- end
-end
-
-desc "Alias for resque:work (To run workers on Heroku)"
-task "jobs:work" => "resque:work"
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