-
-
Save jeremyrajan/26003e3a92f3c7a90335 to your computer and use it in GitHub Desktop.
Revisions
-
Trung Lê revised this gist
Jul 10, 2013 . 1 changed file with 10 additions and 8 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,8 +1,10 @@ #!/usr/bin/env bash # Simple move this file into your Rails `script` folder. Also make sure you `chmod +x puma.sh`. # Please modify the CONSTANT variables to fit your configurations. # The script will start with config set by $PUMA_CONFIG_FILE by default PUMA_CONFIG_FILE=config/puma.rb PUMA_PID_FILE=tmp/pids/puma.pid PUMA_SOCKET=tmp/sockets/puma.sock @@ -29,12 +31,12 @@ puma_is_running() { case "$1" in start) echo "Starting puma..." rm -f $PUMA_SOCKET if [ -e $PUMA_CONFIG_FILE ] ; then bundle exec puma --config $PUMA_CONFIG_FILE else bundle exec puma --daemon --bind unix://$PUMA_SOCKET --pidfile $PUMA_PID_FILE fi echo "done" ;; @@ -70,4 +72,4 @@ case "$1" in *) echo "Usage: script/puma.sh {start|stop|restart}" >&2 ;; esac -
Trung Lê revised this gist
Jun 23, 2013 . 1 changed file with 7 additions and 13 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,19 +1,9 @@ #! /bin/sh # Simple move this file into your Rails `script` folder. Also make sure you `chmod +x puma.sh`. # Please modify the CONSTANT variables to fit your configurations. PUMA_CONFIG_FILE=config/puma.rb PUMA_PID_FILE=tmp/pids/puma.pid PUMA_SOCKET=tmp/sockets/puma.sock @@ -40,7 +30,11 @@ case "$1" in start) echo "Starting puma..." rm -f $PUMA_SOCKET if [ -e $PUMA_CONFIG_FILE ] ; then bundle exec puma -C $PUMA_CONFIG_FILE else bundle exec puma fi echo "done" ;; -
Trung Lê revised this gist
Jun 23, 2013 . 1 changed file with 14 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,19 @@ #! /bin/sh # Simple move this file into your Rails `script` folder. Also make sure you `chmod +x puma.sh`. # The script will try to look for the `config/puma.rb` file, so make you have one first: # Below is example `config/puma.rb`: # # environment 'production' # daemonize # # workers 2 # threads 0, 6 # # pidfile "rails_app/tmp/pids/puma.pid" # bind "unix://rails_app/tmp/sockets/puma.sock" PUMA_PID_FILE=tmp/pids/puma.pid PUMA_SOCKET=tmp/sockets/puma.sock -
Trung Lê revised this gist
Jun 23, 2013 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -33,7 +33,7 @@ case "$1" in stop) echo "Stopping puma..." kill -s SIGTERM `cat $PUMA_PID_FILE` rm -f $PUMA_PID_FILE rm -f $PUMA_SOCKET @@ -43,7 +43,7 @@ case "$1" in restart) if puma_is_running ; then echo "Hot-restarting puma..." kill -s SIGUSR2 `cat $PUMA_PID_FILE` echo "Doublechecking the process restart..." sleep 5 -
Trung Lê created this gist
Jun 23, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,65 @@ #! /bin/sh PUMA_PID_FILE=tmp/pids/puma.pid PUMA_SOCKET=tmp/sockets/puma.sock # check if puma process is running puma_is_running() { if [ -S $PUMA_SOCKET ] ; then if [ -e $PUMA_PID_FILE ] ; then if cat $PUMA_PID_FILE | xargs pgrep -P > /dev/null ; then return 0 else echo "No puma process found" fi else echo "No puma pid file found" fi else echo "No puma socket found" fi return 1 } case "$1" in start) echo "Starting puma..." rm -f $PUMA_SOCKET bundle exec puma -C config/puma.rb echo "done" ;; stop) echo "Stopping puma..." bundle exec pumactl -P $PUMA_PID_FILE stop rm -f $PUMA_PID_FILE rm -f $PUMA_SOCKET echo "done" ;; restart) if puma_is_running ; then echo "Hot-restarting puma..." bundle exec pumactl -P $PUMA_PID_FILE restart echo "Doublechecking the process restart..." sleep 5 if puma_is_running ; then echo "done" exit 0 else echo "Puma restart failed :/" fi fi echo "Trying cold reboot" script/puma.sh start ;; *) echo "Usage: script/puma.sh {start|stop|restart}" >&2 ;; esac