diff options
author | Sytse Sijbrandij <sytse@dosire.com> | 2013-08-19 21:54:12 +0200 |
---|---|---|
committer | Sytse Sijbrandij <sytse@dosire.com> | 2013-08-19 21:54:12 +0200 |
commit | 7c55c73d6318004242b192c7c6ce17cc57e45760 (patch) | |
tree | 9af292d8dce331f1e9c735cadbcd294a02db866b /lib | |
parent | 6ec73fc9a64938566d2e6d1a804990fa0f8849f0 (diff) | |
download | gitlab-ce-7c55c73d6318004242b192c7c6ce17cc57e45760.tar.gz |
Fix confusing situation where install guide told you to install init.d script for puma.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/support/init.d/gitlab | 18 | ||||
-rw-r--r-- | lib/support/init.d/gitlab_unicorn | 138 |
2 files changed, 8 insertions, 148 deletions
diff --git a/lib/support/init.d/gitlab b/lib/support/init.d/gitlab index 2db37ed1c7d..29c9d98965d 100644 --- a/lib/support/init.d/gitlab +++ b/lib/support/init.d/gitlab @@ -2,7 +2,7 @@ # GITLAB # Maintainer: @randx -# App Version: 5.2 +# App Version: 6.0 ### BEGIN INIT INFO # Provides: gitlab @@ -17,11 +17,10 @@ APP_ROOT="/home/git/gitlab" APP_USER="git" -DAEMON_OPTS="-C $APP_ROOT/config/puma.rb" +DAEMON_OPTS="-c $APP_ROOT/config/unicorn.rb -E production" PID_PATH="$APP_ROOT/tmp/pids" SOCKET_PATH="$APP_ROOT/tmp/sockets" -SOCKET_FILE="$SOCKET_PATH/gitlab.socket" -WEB_SERVER_PID="$PID_PATH/puma.pid" +WEB_SERVER_PID="$PID_PATH/unicorn.pid" SIDEKIQ_PID="$PID_PATH/sidekiq.pid" STOP_SIDEKIQ="RAILS_ENV=production bundle exec rake sidekiq:stop" START_SIDEKIQ="RAILS_ENV=production bundle exec rake sidekiq:start" @@ -52,8 +51,8 @@ start() { exit 1 else if [ `whoami` = root ]; then - ! [ -e $SOCKET_FILE ] || execute "rm $SOCKET_FILE" - execute "RAILS_ENV=production bundle exec puma $DAEMON_OPTS" + execute "rm -f $SOCKET_PATH/gitlab.socket" + execute "RAILS_ENV=production bundle exec unicorn_rails $DAEMON_OPTS > /dev/null 2>&1 &" execute "mkdir -p $PID_PATH && $START_SIDEKIQ > /dev/null 2>&1 &" echo "$DESC started" fi @@ -66,13 +65,12 @@ stop() { if [ "$PID" -ne 0 -a "$STATUS" -ne 0 ]; then ## Program is running, stop it. kill -QUIT `cat $WEB_SERVER_PID` - ! [ -e $SOCKET_FILE ] || execute "rm $SOCKET_FILE" execute "mkdir -p $PID_PATH && $STOP_SIDEKIQ > /dev/null 2>&1 &" rm "$WEB_SERVER_PID" >> /dev/null echo "$DESC stopped" else ## Program is not running, exit with error. - echo "Error! $DESC is not started!" + echo "Error! $DESC not started!" exit 1 fi } @@ -83,7 +81,7 @@ restart() { if [ "$PID" -ne 0 -a "$STATUS" -ne 0 ]; then echo "Restarting $DESC..." kill -USR2 `cat $WEB_SERVER_PID` - execute "mkdir -p $PID_PATH && $STOP_SIDEKIQ > /dev/null 2>&1" + execute "mkdir -p $PID_PATH && $STOP_SIDEKIQ > /dev/null 2>&1 &" if [ `whoami` = root ]; then execute "mkdir -p $PID_PATH && $START_SIDEKIQ > /dev/null 2>&1 &" fi @@ -98,7 +96,7 @@ status() { cd $APP_ROOT check_pid if [ "$PID" -ne 0 -a "$STATUS" -ne 0 ]; then - echo "$DESC / Puma with PID $PID is running." + echo "$DESC / Unicorn with PID $PID is running." echo "$DESC / Sidekiq with PID $SPID is running." else echo "$DESC is not running." diff --git a/lib/support/init.d/gitlab_unicorn b/lib/support/init.d/gitlab_unicorn deleted file mode 100644 index 219776c8684..00000000000 --- a/lib/support/init.d/gitlab_unicorn +++ /dev/null @@ -1,138 +0,0 @@ -#! /bin/bash - -# GITLAB -# Maintainer: @randx -# App Version: 6.0 - -### BEGIN INIT INFO -# Provides: gitlab -# Required-Start: $local_fs $remote_fs $network $syslog redis-server -# Required-Stop: $local_fs $remote_fs $network $syslog -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Short-Description: GitLab git repository management -# Description: GitLab git repository management -### END INIT INFO - - -APP_ROOT="/home/git/gitlab" -APP_USER="git" -DAEMON_OPTS="-c $APP_ROOT/config/unicorn.rb -E production" -PID_PATH="$APP_ROOT/tmp/pids" -SOCKET_PATH="$APP_ROOT/tmp/sockets" -WEB_SERVER_PID="$PID_PATH/unicorn.pid" -SIDEKIQ_PID="$PID_PATH/sidekiq.pid" -STOP_SIDEKIQ="RAILS_ENV=production bundle exec rake sidekiq:stop" -START_SIDEKIQ="RAILS_ENV=production bundle exec rake sidekiq:start" -NAME="gitlab" -DESC="GitLab service" - -check_pid(){ - if [ -f $WEB_SERVER_PID ]; then - PID=`cat $WEB_SERVER_PID` - SPID=`cat $SIDEKIQ_PID` - STATUS=`ps aux | grep $PID | grep -v grep | wc -l` - else - STATUS=0 - PID=0 - fi -} - -execute() { - sudo -u $APP_USER -H bash -l -c "$1" -} - -start() { - cd $APP_ROOT - check_pid - if [ "$PID" -ne 0 -a "$STATUS" -ne 0 ]; then - # Program is running, exit with error code 1. - echo "Error! $DESC $NAME is currently running!" - exit 1 - else - if [ `whoami` = root ]; then - execute "rm -f $SOCKET_PATH/gitlab.socket" - execute "RAILS_ENV=production bundle exec unicorn_rails $DAEMON_OPTS > /dev/null 2>&1 &" - execute "mkdir -p $PID_PATH && $START_SIDEKIQ > /dev/null 2>&1 &" - echo "$DESC started" - fi - fi -} - -stop() { - cd $APP_ROOT - check_pid - if [ "$PID" -ne 0 -a "$STATUS" -ne 0 ]; then - ## Program is running, stop it. - kill -QUIT `cat $WEB_SERVER_PID` - execute "mkdir -p $PID_PATH && $STOP_SIDEKIQ > /dev/null 2>&1 &" - rm "$WEB_SERVER_PID" >> /dev/null - echo "$DESC stopped" - else - ## Program is not running, exit with error. - echo "Error! $DESC not started!" - exit 1 - fi -} - -restart() { - cd $APP_ROOT - check_pid - if [ "$PID" -ne 0 -a "$STATUS" -ne 0 ]; then - echo "Restarting $DESC..." - kill -USR2 `cat $WEB_SERVER_PID` - execute "mkdir -p $PID_PATH && $STOP_SIDEKIQ > /dev/null 2>&1 &" - if [ `whoami` = root ]; then - execute "mkdir -p $PID_PATH && $START_SIDEKIQ > /dev/null 2>&1 &" - fi - echo "$DESC restarted." - else - echo "Error, $NAME not running!" - exit 1 - fi -} - -status() { - cd $APP_ROOT - check_pid - if [ "$PID" -ne 0 -a "$STATUS" -ne 0 ]; then - echo "$DESC / Puma with PID $PID is running." - echo "$DESC / Sidekiq with PID $SPID is running." - else - echo "$DESC is not running." - exit 1 - fi -} - -## Check to see if we are running as root first. -## Found at http://www.cyberciti.biz/tips/shell-root-user-check-script.html -if [ "$(id -u)" != "0" ]; then - echo "This script must be run as root" - exit 1 -fi - -case "$1" in - start) - start - ;; - stop) - stop - ;; - restart) - restart - ;; - reload|force-reload) - echo -n "Reloading $NAME configuration: " - kill -HUP `cat $PID` - echo "done." - ;; - status) - status - ;; - *) - echo "Usage: sudo service gitlab {start|stop|restart|reload}" >&2 - exit 1 - ;; -esac - -exit 0 |