Skip to content

Instantly share code, notes, and snippets.

@schneems
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save schneems/9276057 to your computer and use it in GitHub Desktop.
Save schneems/9276057 to your computer and use it in GitHub Desktop.
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
source "https://rubygems.org"
gem 'puma'
gem 'rack'
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