Skip to content

Commit

Permalink
Use puma instead of unicorn
Browse files Browse the repository at this point in the history
  • Loading branch information
dzaporozhets committed Apr 5, 2013
1 parent ce9989e commit 33433b6
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions init.d/gitlab
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# GITLAB
# Maintainer: @randx
# App Version: 5.0
# App Version: 5.1

### BEGIN INIT INFO
# Provides: gitlab
Expand All @@ -16,18 +16,18 @@


APP_ROOT="/home/git/gitlab"
DAEMON_OPTS="-c $APP_ROOT/config/unicorn.rb -E production"
DAEMON_OPTS="-C $APP_ROOT/config/puma.rb -E production"
PID_PATH="$APP_ROOT/tmp/pids"
UNICORN_PID="$PID_PATH/unicorn.pid"
WEB_SERVER_PID="$PID_PATH/puma.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="unicorn"
NAME="gitlab"
DESC="Gitlab service"

check_pid(){
if [ -f $UNICORN_PID ]; then
PID=`cat $UNICORN_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
Expand All @@ -45,7 +45,7 @@ start() {
exit 1
else
if [ `whoami` = root ]; then
sudo -u git -H bash -l -c "nohup bundle exec unicorn_rails $DAEMON_OPTS > /dev/null 2>&1 &"
sudo -u git -H bash -l -c "RAILS_ENV=production bundle exec puma $DAEMON_OPTS"
sudo -u git -H bash -l -c "mkdir -p $PID_PATH && $START_SIDEKIQ > /dev/null 2>&1 &"
echo "$DESC started"
fi
Expand All @@ -57,9 +57,9 @@ stop() {
check_pid
if [ "$PID" -ne 0 -a "$STATUS" -ne 0 ]; then
## Program is running, stop it.
kill -QUIT `cat $UNICORN_PID`
kill -QUIT `cat $WEB_SERVER_PID`
sudo -u git -H bash -l -c "mkdir -p $PID_PATH && $STOP_SIDEKIQ > /dev/null 2>&1 &"
rm "$UNICORN_PID" >> /dev/null
rm "$WEB_SERVER_PID" >> /dev/null
echo "$DESC stopped"
else
## Program is not running, exit with error.
Expand All @@ -73,7 +73,7 @@ restart() {
check_pid
if [ "$PID" -ne 0 -a "$STATUS" -ne 0 ]; then
echo "Restarting $DESC..."
kill -USR2 `cat $UNICORN_PID`
kill -USR2 `cat $WEB_SERVER_PID`
sudo -u git -H bash -l -c "mkdir -p $PID_PATH && $STOP_SIDEKIQ > /dev/null 2>&1 &"
if [ `whoami` = root ]; then
sudo -u git -H bash -l -c "mkdir -p $PID_PATH && $START_SIDEKIQ > /dev/null 2>&1 &"
Expand Down

0 comments on commit 33433b6

Please sign in to comment.