Skip to content

Instantly share code, notes, and snippets.

@b10s
Created March 28, 2018 04:35
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save b10s/c3c5351854f866376461610d1d49463d to your computer and use it in GitHub Desktop.
require "sinatra/base"
public_app = Sinatra.new {
ip = ENV['CF_INSTANCE_IP']
#ip = '10.48.28.53'
p "public ip `#{ip}'"
set :bind, ip
get('/*') do
{ :public => 'public' }
end
}
private_app = Sinatra.new {
ip = ENV['CF_INSTANCE_INTERNAL_IP']
#ip = '127.0.0.1'
p "private ip `#{ip}'"
set :bind, ip
get('/*') do
{ :private => 'private' }
end
}
Thread.new do
Thread.current.abort_on_exception = true
private_app.run!
end
public_app.run!
<<-OUTPUT_LOG
2018-03-28T13:29:21.21+0900 [CELL/0] OUT Creating container
2018-03-28T13:29:21.56+0900 [CELL/0] OUT Successfully created container
2018-03-28T13:29:22.12+0900 [API/0] OUT Creating droplet for app with guid 64f44e0a-1fc2-4444-babf-1c5e24a3d611
2018-03-28T13:29:22.16+0900 [CELL/0] OUT Starting health monitoring of container
2018-03-28T13:29:22.87+0900 [APP/PROC/WEB/0] OUT "public ip `100.73.61.131'"
2018-03-28T13:29:22.87+0900 [APP/PROC/WEB/0] OUT "private ip `10.76.101.254'"
2018-03-28T13:29:22.95+0900 [APP/PROC/WEB/0] ERR == Sinatra (v2.0.1) has taken the stage on 8080 for production with backup from Puma== Sinatra (v2.0.1) has taken the stage on 8080 for production with backup from Puma
2018-03-28T13:29:22.95+0900 [APP/PROC/WEB/0] OUT Puma starting in single mode...
2018-03-28T13:29:22.95+0900 [APP/PROC/WEB/0] OUT * Version 3.11.3 (ruby 2.4.3-p205), codename: Love Song
2018-03-28T13:29:22.95+0900 [APP/PROC/WEB/0] OUT Puma starting in single mode...
2018-03-28T13:29:22.95+0900 [APP/PROC/WEB/0] OUT * Min threads: 0, max threads: 16* Version 3.11.3 (ruby 2.4.3-p205), codename: Love Song
2018-03-28T13:29:22.95+0900 [APP/PROC/WEB/0] OUT * Min threads: 0, max threads: 16
2018-03-28T13:29:22.95+0900 [APP/PROC/WEB/0] OUT * Environment: production
2018-03-28T13:29:22.95+0900 [APP/PROC/WEB/0] OUT * Environment: production
2018-03-28T13:29:22.95+0900 [APP/PROC/WEB/0] OUT * Listening on tcp://100.73.61.131:8080
2018-03-28T13:29:22.95+0900 [APP/PROC/WEB/0] ERR /home/vcap/deps/0/vendor_bundle/ruby/2.4.0/gems/puma-3.11.3/lib/puma/single.rb:18:in `stop': undefined method `stop' for nil:NilClass (NoMethodError)
2018-03-28T13:29:22.95+0900 [APP/PROC/WEB/0] ERR from /home/vcap/deps/0/vendor_bundle/ruby/2.4.0/gems/puma-3.11.3/lib/puma/launcher.rb:146:in `stop'
2018-03-28T13:29:22.95+0900 [APP/PROC/WEB/0] ERR from /home/vcap/deps/0/vendor_bundle/ruby/2.4.0/gems/sinatra-2.0.1/lib/sinatra/base.rb:1438:in `quit!'
2018-03-28T13:29:22.95+0900 [APP/PROC/WEB/0] ERR from /home/vcap/deps/0/vendor_bundle/ruby/2.4.0/gems/sinatra-2.0.1/lib/sinatra/base.rb:1544:in `block in setup_traps'
2018-03-28T13:29:22.95+0900 [APP/PROC/WEB/0] ERR /home/vcap/deps/0/vendor_bundle/ruby/2.4.0/gems/puma-3.11.3/lib/puma/single.rb:18:in `stop': undefined method `stop' for nil:NilClass (NoMethodError)
2018-03-28T13:29:22.95+0900 [APP/PROC/WEB/0] ERR from /home/vcap/deps/0/vendor_bundle/ruby/2.4.0/gems/puma-3.11.3/lib/puma/launcher.rb:146:in `stop'
2018-03-28T13:29:22.95+0900 [APP/PROC/WEB/0] ERR from /home/vcap/deps/0/vendor_bundle/ruby/2.4.0/gems/sinatra-2.0.1/lib/sinatra/base.rb:1438:in `quit!'
2018-03-28T13:29:22.95+0900 [APP/PROC/WEB/0] ERR from /home/vcap/deps/0/vendor_bundle/ruby/2.4.0/gems/sinatra-2.0.1/lib/sinatra/base.rb:1544:in `block in setup_traps'
2018-03-28T13:29:22.95+0900 [APP/PROC/WEB/0] ERR /home/vcap/deps/0/vendor_bundle/ruby/2.4.0/gems/puma-3.11.3/lib/puma/single.rb:18:in `stop': undefined method `stop' for nil:NilClass (NoMethodError)
2018-03-28T13:29:22.95+0900 [APP/PROC/WEB/0] ERR from /home/vcap/deps/0/vendor_bundle/ruby/2.4.0/gems/puma-3.11.3/lib/puma/launcher.rb:146:in `stop'
2018-03-28T13:29:22.95+0900 [APP/PROC/WEB/0] ERR from /home/vcap/deps/0/vendor_bundle/ruby/2.4.0/gems/sinatra-2.0.1/lib/sinatra/base.rb:1438:in `quit!'
2018-03-28T13:29:22.95+0900 [APP/PROC/WEB/0] ERR from /home/vcap/deps/0/vendor_bundle/ruby/2.4.0/gems/sinatra-2.0.1/lib/sinatra/base.rb:1463:in `ensure in run!'
2018-03-28T13:29:22.95+0900 [APP/PROC/WEB/0] ERR from /home/vcap/deps/0/vendor_bundle/ruby/2.4.0/gems/sinatra-2.0.1/lib/sinatra/base.rb:1463:in `run!'
2018-03-28T13:29:22.95+0900 [APP/PROC/WEB/0] ERR from test.rb:28:in `<main>'
2018-03-28T13:29:22.96+0900 [APP/PROC/WEB/0] OUT Exit status 1
2018-03-28T13:29:22.97+0900 [CELL/0] OUT Stopping instance 0a6654ed-bc34-4253-461f-bc2e
2018-03-28T13:29:22.97+0900 [CELL/0] OUT Destroying container
2018-03-28T13:29:23.52+0900 [CELL/0] OUT Successfully destroyed container
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment