Commit 2341cefd6fa2811a1af41f2068554738d7eebfc4
1 parent
cb4b504b
Exists in
spb-stable
and in
2 other branches
Move from script to bin directory.
Showing
14 changed files
with
149 additions
and
155 deletions
Show diff stats
README.md
... | ... | @@ -108,7 +108,7 @@ Start it with [Foreman](https://github.com/ddollar/foreman) |
108 | 108 | or start each component separately |
109 | 109 | |
110 | 110 | bundle exec rails s |
111 | - script/background_jobs start | |
111 | + bin/background_jobs start | |
112 | 112 | |
113 | 113 | And surf to [localhost:3000](http://localhost:3000/) and login with root / 5iveL!fe |
114 | 114 | ... | ... |
... | ... | @@ -0,0 +1,80 @@ |
1 | +#!/usr/bin/env bash | |
2 | + | |
3 | +cd $(dirname $0)/.. | |
4 | +app_root=$(pwd) | |
5 | +sidekiq_pidfile="$app_root/tmp/pids/sidekiq.pid" | |
6 | +sidekiq_logfile="$app_root/log/sidekiq.log" | |
7 | +gitlab_user=$(ls -l config.ru | awk '{print $3}') | |
8 | + | |
9 | +function warn | |
10 | +{ | |
11 | + echo "$@" 1>&2 | |
12 | +} | |
13 | + | |
14 | +function stop | |
15 | +{ | |
16 | + bundle exec sidekiqctl stop $sidekiq_pidfile >> $sidekiq_logfile 2>&1 | |
17 | +} | |
18 | + | |
19 | +function killall | |
20 | +{ | |
21 | + pkill -u $gitlab_user -f sidekiq | |
22 | +} | |
23 | + | |
24 | +function restart | |
25 | +{ | |
26 | + if [ -f $sidekiq_pidfile ]; then | |
27 | + stop | |
28 | + fi | |
29 | + killall | |
30 | + start_sidekiq -d -L $sidekiq_logfile | |
31 | +} | |
32 | + | |
33 | +function start_no_deamonize | |
34 | +{ | |
35 | + start_sidekiq | |
36 | +} | |
37 | + | |
38 | +function start_sidekiq | |
39 | +{ | |
40 | + bundle exec sidekiq -q post_receive -q mailer -q system_hook -q project_web_hook -q gitlab_shell -q common -q default -e $RAILS_ENV -P $sidekiq_pidfile $@ >> $sidekiq_logfile 2>&1 | |
41 | +} | |
42 | + | |
43 | +function load_ok | |
44 | +{ | |
45 | + sidekiq_pid=$(cat $sidekiq_pidfile) | |
46 | + if [[ -z $sidekiq_pid ]] ; then | |
47 | + warn "Could not find a PID in $sidekiq_pidfile" | |
48 | + exit 0 | |
49 | + fi | |
50 | + | |
51 | + if (ps -p $sidekiq_pid -o args | grep '\([0-9]\+\) of \1 busy' 1>&2) ; then | |
52 | + warn "Too many busy Sidekiq workers" | |
53 | + exit 1 | |
54 | + fi | |
55 | + | |
56 | + exit 0 | |
57 | +} | |
58 | + | |
59 | +case "$1" in | |
60 | + stop) | |
61 | + stop | |
62 | + ;; | |
63 | + start) | |
64 | + restart | |
65 | + ;; | |
66 | + start_no_deamonize) | |
67 | + start_no_deamonize | |
68 | + ;; | |
69 | + restart) | |
70 | + restart | |
71 | + ;; | |
72 | + killall) | |
73 | + killall | |
74 | + ;; | |
75 | + load_ok) | |
76 | + load_ok | |
77 | + ;; | |
78 | + *) | |
79 | + echo "Usage: RAILS_ENV=your_env $0 {stop|start|start_no_deamonize|restart|killall|load_ok}" | |
80 | +esac | ... | ... |
... | ... | @@ -0,0 +1,49 @@ |
1 | +#!/usr/bin/env bash | |
2 | + | |
3 | +cd $(dirname $0)/.. | |
4 | +app_root=$(pwd) | |
5 | + | |
6 | +unicorn_pidfile="$app_root/tmp/pids/unicorn.pid" | |
7 | +unicorn_config="$app_root/config/unicorn.rb" | |
8 | + | |
9 | +function get_unicorn_pid | |
10 | +{ | |
11 | + local pid=$(cat $unicorn_pidfile) | |
12 | + if [ -z $pid ] ; then | |
13 | + echo "Could not find a PID in $unicorn_pidfile" | |
14 | + exit 1 | |
15 | + fi | |
16 | + unicorn_pid=$pid | |
17 | +} | |
18 | + | |
19 | +function start | |
20 | +{ | |
21 | + bundle exec unicorn_rails -D -c $unicorn_config -E $RAILS_ENV | |
22 | +} | |
23 | + | |
24 | +function stop | |
25 | +{ | |
26 | + get_unicorn_pid | |
27 | + kill -QUIT $unicorn_pid | |
28 | +} | |
29 | + | |
30 | +function reload | |
31 | +{ | |
32 | + get_unicorn_pid | |
33 | + kill -USR2 $unicorn_pid | |
34 | +} | |
35 | + | |
36 | +case "$1" in | |
37 | + start) | |
38 | + start | |
39 | + ;; | |
40 | + stop) | |
41 | + stop | |
42 | + ;; | |
43 | + reload) | |
44 | + reload | |
45 | + ;; | |
46 | + *) | |
47 | + echo "Usage: RAILS_ENV=your_env $0 {start|stop|reload}" | |
48 | + ;; | |
49 | +esac | ... | ... |
doc/update/upgrader.md
... | ... | @@ -19,10 +19,10 @@ __GitLab Upgrader is available only for GitLab version 6.4.2 or higher__ |
19 | 19 | ### 2. Run gitlab upgrade tool |
20 | 20 | |
21 | 21 | cd /home/git/gitlab |
22 | - sudo -u git -H ruby script/upgrade.rb | |
22 | + sudo -u git -H ruby bin/upgrade.rb | |
23 | 23 | |
24 | 24 | # to perform a non-interactive install (no user input required) you can add -y |
25 | - # sudo -u git -H ruby script/upgrade.rb -y | |
25 | + # sudo -u git -H ruby bin/upgrade.rb -y | |
26 | 26 | |
27 | 27 | ### 3. Start application |
28 | 28 | |
... | ... | @@ -48,6 +48,6 @@ You've read through the entire guide, and probably did all the steps manually. H |
48 | 48 | |
49 | 49 | ```bash |
50 | 50 | cd /home/git/gitlab; sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production; \ |
51 | - sudo service gitlab stop; sudo -u git -H ruby script/upgrade.rb -y; sudo service gitlab start; \ | |
51 | + sudo service gitlab stop; sudo -u git -H ruby bin/upgrade.rb -y; sudo service gitlab start; \ | |
52 | 52 | sudo service nginx restart; sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production |
53 | 53 | ``` | ... | ... |
lib/support/init.d/gitlab
... | ... | @@ -167,14 +167,14 @@ start_gitlab() { |
167 | 167 | # Remove old socket if it exists |
168 | 168 | rm -f "$socket_path"/gitlab.socket 2>/dev/null |
169 | 169 | # Start the web server |
170 | - RAILS_ENV=$RAILS_ENV script/web start | |
170 | + RAILS_ENV=$RAILS_ENV bin/web start | |
171 | 171 | fi |
172 | 172 | |
173 | 173 | # If sidekiq is already running, don't start it again. |
174 | 174 | if [ "$sidekiq_status" = "0" ]; then |
175 | 175 | echo "The Sidekiq job dispatcher is already running with pid $spid, not restarting" |
176 | 176 | else |
177 | - RAILS_ENV=$RAILS_ENV script/background_jobs start & | |
177 | + RAILS_ENV=$RAILS_ENV bin/background_jobs start & | |
178 | 178 | fi |
179 | 179 | |
180 | 180 | # Wait for the pids to be planted |
... | ... | @@ -197,11 +197,11 @@ stop_gitlab() { |
197 | 197 | |
198 | 198 | # If the Unicorn web server is running, tell it to stop; |
199 | 199 | if [ "$web_status" = "0" ]; then |
200 | - RAILS_ENV=$RAILS_ENV script/web stop | |
200 | + RAILS_ENV=$RAILS_ENV bin/web stop | |
201 | 201 | fi |
202 | 202 | # And do the same thing for the Sidekiq. |
203 | 203 | if [ "$sidekiq_status" = "0" ]; then |
204 | - RAILS_ENV=$RAILS_ENV script/background_jobs stop | |
204 | + RAILS_ENV=$RAILS_ENV bin/background_jobs stop | |
205 | 205 | fi |
206 | 206 | |
207 | 207 | # If something needs to be stopped, lets wait for it to stop. Never use SIGKILL in a script. |
... | ... | @@ -253,10 +253,10 @@ reload_gitlab(){ |
253 | 253 | exit 1 |
254 | 254 | fi |
255 | 255 | printf "Reloading GitLab Unicorn configuration... " |
256 | - RAILS_ENV=$RAILS_ENV script/web reload | |
256 | + RAILS_ENV=$RAILS_ENV bin/web reload | |
257 | 257 | echo "Done." |
258 | 258 | echo "Restarting GitLab Sidekiq since it isn't capable of reloading its config..." |
259 | - RAILS_ENV=$RAILS_ENV script/background_jobs restart | |
259 | + RAILS_ENV=$RAILS_ENV bin/background_jobs restart | |
260 | 260 | |
261 | 261 | wait_for_pids |
262 | 262 | print_status | ... | ... |
lib/tasks/gitlab/check.rake
... | ... | @@ -637,7 +637,7 @@ namespace :gitlab do |
637 | 637 | else |
638 | 638 | puts "no".red |
639 | 639 | try_fixing_it( |
640 | - sudo_gitlab("RAILS_ENV=production script/background_jobs start") | |
640 | + sudo_gitlab("RAILS_ENV=production bin/background_jobs start") | |
641 | 641 | ) |
642 | 642 | for_more_information( |
643 | 643 | see_installation_guide_section("Install Init Script"), | ... | ... |
lib/tasks/sidekiq.rake
1 | 1 | namespace :sidekiq do |
2 | 2 | desc "GITLAB | Stop sidekiq" |
3 | 3 | task :stop do |
4 | - system *%W(script/background_jobs stop) | |
4 | + system *%W(bin/background_jobs stop) | |
5 | 5 | end |
6 | 6 | |
7 | 7 | desc "GITLAB | Start sidekiq" |
8 | 8 | task :start do |
9 | - system *%W(script/background_jobs start) | |
9 | + system *%W(bin/background_jobs start) | |
10 | 10 | end |
11 | 11 | |
12 | 12 | desc 'GitLab | Restart sidekiq' |
13 | 13 | task :restart do |
14 | - system *%W(script/background_jobs restart) | |
14 | + system *%W(bin/background_jobs restart) | |
15 | 15 | end |
16 | 16 | |
17 | 17 | desc "GITLAB | Start sidekiq with launchd on Mac OS X" |
18 | 18 | task :launchd do |
19 | - system *%W(script/background_jobs start_no_deamonize) | |
19 | + system *%W(bin/background_jobs start_no_deamonize) | |
20 | 20 | end |
21 | 21 | end | ... | ... |
script/background_jobs
... | ... | @@ -1,80 +0,0 @@ |
1 | -#!/usr/bin/env bash | |
2 | - | |
3 | -cd $(dirname $0)/.. | |
4 | -app_root=$(pwd) | |
5 | -sidekiq_pidfile="$app_root/tmp/pids/sidekiq.pid" | |
6 | -sidekiq_logfile="$app_root/log/sidekiq.log" | |
7 | -gitlab_user=$(ls -l config.ru | awk '{print $3}') | |
8 | - | |
9 | -function warn | |
10 | -{ | |
11 | - echo "$@" 1>&2 | |
12 | -} | |
13 | - | |
14 | -function stop | |
15 | -{ | |
16 | - bundle exec sidekiqctl stop $sidekiq_pidfile >> $sidekiq_logfile 2>&1 | |
17 | -} | |
18 | - | |
19 | -function killall | |
20 | -{ | |
21 | - pkill -u $gitlab_user -f sidekiq | |
22 | -} | |
23 | - | |
24 | -function restart | |
25 | -{ | |
26 | - if [ -f $sidekiq_pidfile ]; then | |
27 | - stop | |
28 | - fi | |
29 | - killall | |
30 | - start_sidekiq -d -L $sidekiq_logfile | |
31 | -} | |
32 | - | |
33 | -function start_no_deamonize | |
34 | -{ | |
35 | - start_sidekiq | |
36 | -} | |
37 | - | |
38 | -function start_sidekiq | |
39 | -{ | |
40 | - bundle exec sidekiq -q post_receive -q mailer -q system_hook -q project_web_hook -q gitlab_shell -q common -q default -e $RAILS_ENV -P $sidekiq_pidfile $@ >> $sidekiq_logfile 2>&1 | |
41 | -} | |
42 | - | |
43 | -function load_ok | |
44 | -{ | |
45 | - sidekiq_pid=$(cat $sidekiq_pidfile) | |
46 | - if [[ -z $sidekiq_pid ]] ; then | |
47 | - warn "Could not find a PID in $sidekiq_pidfile" | |
48 | - exit 0 | |
49 | - fi | |
50 | - | |
51 | - if (ps -p $sidekiq_pid -o args | grep '\([0-9]\+\) of \1 busy' 1>&2) ; then | |
52 | - warn "Too many busy Sidekiq workers" | |
53 | - exit 1 | |
54 | - fi | |
55 | - | |
56 | - exit 0 | |
57 | -} | |
58 | - | |
59 | -case "$1" in | |
60 | - stop) | |
61 | - stop | |
62 | - ;; | |
63 | - start) | |
64 | - restart | |
65 | - ;; | |
66 | - start_no_deamonize) | |
67 | - start_no_deamonize | |
68 | - ;; | |
69 | - restart) | |
70 | - restart | |
71 | - ;; | |
72 | - killall) | |
73 | - killall | |
74 | - ;; | |
75 | - load_ok) | |
76 | - load_ok | |
77 | - ;; | |
78 | - *) | |
79 | - echo "Usage: RAILS_ENV=your_env $0 {stop|start|start_no_deamonize|restart|killall|load_ok}" | |
80 | -esac |
script/check
script/rails
... | ... | @@ -1,6 +0,0 @@ |
1 | -#!/usr/bin/env ruby | |
2 | -# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application. | |
3 | - | |
4 | -APP_PATH = File.expand_path('../../config/application', __FILE__) | |
5 | -require File.expand_path('../../config/boot', __FILE__) | |
6 | -require 'rails/commands' |
script/upgrade.rb
script/web
... | ... | @@ -1,49 +0,0 @@ |
1 | -#!/usr/bin/env bash | |
2 | - | |
3 | -cd $(dirname $0)/.. | |
4 | -app_root=$(pwd) | |
5 | - | |
6 | -unicorn_pidfile="$app_root/tmp/pids/unicorn.pid" | |
7 | -unicorn_config="$app_root/config/unicorn.rb" | |
8 | - | |
9 | -function get_unicorn_pid | |
10 | -{ | |
11 | - local pid=$(cat $unicorn_pidfile) | |
12 | - if [ -z $pid ] ; then | |
13 | - echo "Could not find a PID in $unicorn_pidfile" | |
14 | - exit 1 | |
15 | - fi | |
16 | - unicorn_pid=$pid | |
17 | -} | |
18 | - | |
19 | -function start | |
20 | -{ | |
21 | - bundle exec unicorn_rails -D -c $unicorn_config -E $RAILS_ENV | |
22 | -} | |
23 | - | |
24 | -function stop | |
25 | -{ | |
26 | - get_unicorn_pid | |
27 | - kill -QUIT $unicorn_pid | |
28 | -} | |
29 | - | |
30 | -function reload | |
31 | -{ | |
32 | - get_unicorn_pid | |
33 | - kill -USR2 $unicorn_pid | |
34 | -} | |
35 | - | |
36 | -case "$1" in | |
37 | - start) | |
38 | - start | |
39 | - ;; | |
40 | - stop) | |
41 | - stop | |
42 | - ;; | |
43 | - reload) | |
44 | - reload | |
45 | - ;; | |
46 | - *) | |
47 | - echo "Usage: RAILS_ENV=your_env $0 {start|stop|reload}" | |
48 | - ;; | |
49 | -esac |