Last active
August 29, 2015 13:56
-
-
Save schneems/9276057 to your computer and use it in GitHub Desktop.
This file contains 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 characters
require 'rack' | |
require 'rack/server' | |
class HelloWorld | |
def response | |
[200, {}, ['Hello World']] | |
end | |
end | |
class HelloWorldApp | |
def self.call(env) | |
HelloWorld.new.response | |
end | |
end | |
run HelloWorldApp |
This file contains 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 characters
source "https://rubygems.org" | |
gem 'puma' | |
gem 'rack' | |
This file contains 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 characters
function cyclepuma { | |
sleep 5 | |
cluster_pid=$1 | |
echo "cluster pid: $cluster_pid" | |
while $(kill -s 0 $cluster_pid); do | |
curl "http://localhost:9292" | |
sleep 5 | |
echo "decrement" | |
kill -s TTOU $cluster_pid # decrement | |
sleep 5 | |
echo "increment" | |
kill -s TTIN $cluster_pid # increment | |
done | |
echo "puma is dead" | |
} | |
echo "== starting puma in background" | |
puma app.ru -t 1:1 -w 5 --preload --debug & | |
pumapid=$! | |
echo "preparing to kill puma" | |
cyclepuma $pumapid | |
kill -9 $pumapid |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment