-
-
Save s2t2/ba336ff5ca7a2cbfdf4ac18d2f627425 to your computer and use it in GitHub Desktop.
Nginx, Sinatra, and Puma.
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
#!/usr/bin/env ruby | |
require 'sinatra' | |
configure { | |
set :server, :puma | |
} | |
class Pumatra < Sinatra::Base | |
get '/' do | |
return 'It works!' | |
end | |
run! if app_file == $0 | |
end |
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
bundle install --path vendor/bundle | |
mkdir -p tmp/puma | |
bundle exec puma --config config/puma.rb |
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
#!/usr/bin/env ruby | |
require './app' | |
run Pumatra |
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 :rubygems | |
gem "puma" | |
gem "sinatra" |
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
upstream app { | |
server unix:///appdir/tmp/puma/socket; | |
} | |
server { | |
listen 80; | |
server_name app.com; | |
root /appdir/public; | |
access_log /appdir/log/nginx.access.log; | |
error_log /appdir/log/nginx.error.log info; | |
location / { | |
try_files $uri @puma; | |
} | |
location @puma { | |
include proxy_params; | |
proxy_pass http://app; | |
} | |
} |
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
root = "#{Dir.getwd}" | |
bind "unix://#{root}/tmp/puma/socket" | |
pidfile "#{root}/tmp/puma/pid" | |
state_path "#{root}/tmp/puma/state" | |
rackup "#{root}/config.ru" | |
threads 4, 8 | |
activate_control_app |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment