summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJacob Vosmaer <contact@jacobvosmaer.nl>2013-10-09 16:45:32 +0200
committerJacob Vosmaer <contact@jacobvosmaer.nl>2013-10-15 22:48:57 +0200
commit6a7d63aa47d583a21b87b623a010d8b98abb8777 (patch)
tree682fd8e0bb7314a82339da69be6442cb1e037971 /lib
parent7c4db532ff246a9831a5decaaf031affeb1eb21d (diff)
downloadgitlab-ce-6a7d63aa47d583a21b87b623a010d8b98abb8777.tar.gz
Move unicorn and sidekiq commands into bash script
Diffstat (limited to 'lib')
-rwxr-xr-xlib/support/init.d/gitlab13
-rw-r--r--lib/tasks/sidekiq.rake27
2 files changed, 13 insertions, 27 deletions
diff --git a/lib/support/init.d/gitlab b/lib/support/init.d/gitlab
index f157d71b14f..26ca50c22fa 100755
--- a/lib/support/init.d/gitlab
+++ b/lib/support/init.d/gitlab
@@ -22,7 +22,6 @@ RAILS_ENV="production"
# /bin/sh variables such as PATH, EDITOR or SHELL.
app_root="/home/git/gitlab"
app_user="git"
-unicorn_conf="$app_root/config/unicorn.rb"
pid_path="$app_root/tmp/pids"
socket_path="$app_root/tmp/sockets"
web_server_pid_path="$pid_path/unicorn.pid"
@@ -129,7 +128,7 @@ start() {
# Remove old socket if it exists
rm -f "$socket_path"/gitlab.socket 2>/dev/null
# Start the webserver
- bundle exec unicorn_rails -D -c "$unicorn_conf" -E "$RAILS_ENV"
+ RAILS_ENV=$RAILS_ENV script/web start
fi
# If sidekiq is already running, don't start it again.
@@ -137,7 +136,7 @@ start() {
echo "The Sidekiq job dispatcher is already running with pid $spid, not restarting"
else
echo "Starting the GitLab Sidekiq event dispatcher..."
- RAILS_ENV=$RAILS_ENV bundle exec rake sidekiq:start
+ RAILS_ENV=$RAILS_ENV script/background_jobs start
# We are sleeping a bit here because sidekiq is slow at writing it's pid
sleep 2
fi
@@ -151,7 +150,7 @@ stop() {
exit_if_not_running
# If the Unicorn web server is running, tell it to stop;
if [ "$web_status" = "0" ]; then
- kill -QUIT "$wpid"
+ RAILS_ENV=$RAILS_ENV script/web stop
echo "Stopping the GitLab Unicorn web server..."
stopping=true
else
@@ -160,7 +159,7 @@ stop() {
# And do the same thing for the Sidekiq.
if [ "$sidekiq_status" = "0" ]; then
printf "Stopping Sidekiq job dispatcher."
- RAILS_ENV=$RAILS_ENV bundle exec rake sidekiq:stop
+ RAILS_ENV=$RAILS_ENV script/background_jobs stop
stopping=true
else
echo "The Sidekiq was not running, must have run out of breath."
@@ -215,10 +214,10 @@ reload(){
exit 1
fi
printf "Reloading GitLab Unicorn configuration... "
- kill -USR2 "$wpid"
+ RAILS_ENV=$RAILS_ENV script/web reload
echo "Done."
echo "Restarting GitLab Sidekiq since it isn't capable of reloading its config..."
- RAILS_ENV=$RAILS_ENV bundle exec rake sidekiq:restart
+ RAILS_ENV=$RAILS_ENV script/background_jobs restart
# Waiting 2 seconds for sidekiq to write it.
sleep 2
status
diff --git a/lib/tasks/sidekiq.rake b/lib/tasks/sidekiq.rake
index ba79b6e035d..23d41f8ed24 100644
--- a/lib/tasks/sidekiq.rake
+++ b/lib/tasks/sidekiq.rake
@@ -1,32 +1,19 @@
namespace :sidekiq do
desc "GITLAB | Stop sidekiq"
task :stop do
- system "bundle exec sidekiqctl stop #{pidfile}"
+ system "script/background_jobs stop"
end
- desc "GITLAB | Start sidekiq"
- task :start => :restart
+ desc "GITLAB | Start sidekiq" do
+ system "script/background_jobs start"
+ end
- desc 'GitLab | Restart sidekiq'
- task :restart do
- if File.exist?(pidfile)
- puts 'Shutting down existing sidekiq process.'
- Rake::Task['sidekiq:stop'].invoke
- puts 'Starting new sidekiq process.'
- end
- system "bundle exec sidekiq -q post_receive,mailer,system_hook,project_web_hook,gitlab_shell,common,default -e #{Rails.env} -P #{pidfile} -d -L #{log_file} >> #{log_file} 2>&1"
+ desc 'GitLab | Restart sidekiq' do
+ system "script/background_jobs restart"
end
desc "GITLAB | Start sidekiq with launchd on Mac OS X"
task :launchd do
- system "bundle exec sidekiq -q post_receive,mailer,system_hook,project_web_hook,gitlab_shell,common,default -e #{Rails.env} -P #{pidfile} >> #{log_file} 2>&1"
- end
-
- def pidfile
- Rails.root.join("tmp", "pids", "sidekiq.pid")
- end
-
- def log_file
- Rails.root.join("log", "sidekiq.log")
+ system "script/background_jobs start_no_deamonize"
end
end