Skip to content

Instantly share code, notes, and snippets.

@antonsoroko
Last active December 7, 2020 16:31
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 antonsoroko/974924e0692aa2171229dafa5f2561b2 to your computer and use it in GitHub Desktop.
Save antonsoroko/974924e0692aa2171229dafa5f2561b2 to your computer and use it in GitHub Desktop.
ardo_app
require 'rubygems'
require 'sinatra'
# Unique identifier for the app's lifecycle.
# Useful for checking that an app doesn't die and come back up.
ID = SecureRandom.uuid
$stdout.sync = true
$stderr.sync = true
get '/' do
"Hello from #{ID}!"
end
get '/env' do
ENV.inspect
end
get '/sigterm' do
"Available sigterms #{`man -k signal | grep list`}"
end
get '/sigterm/:signal' do
pid = Process.pid
signal = params[:signal]
puts "Killing process #{pid} with signal #{signal}"
Process.kill(signal, pid)
end
get '/log/:bytes' do
system "cat /dev/zero | head -c #{params[:bytes].to_i}"
"Just wrote #{params[:bytes]} bytes of zeros to the log"
end
require "./app"
run Sinatra::Application
source "http://rubygems.org"
gem "sinatra"
GEM
remote: http://rubygems.org/
specs:
rack (1.5.1)
rack-protection (1.3.2)
rack
sinatra (1.3.4)
rack (~> 1.4)
rack-protection (~> 1.3)
tilt (~> 1.3, >= 1.3.3)
tilt (1.3.3)
PLATFORMS
ruby
DEPENDENCIES
sinatra
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment