Is there a way Rails 3.0.x can default to using Thin?
As of Rails 3.2rc2, thin is now run by default on invoking rails server
when gem 'thin'
is in your Gemfile! Thanks to this pull request: https://github.com/rack/rack/commit/b487f02b13f42c5933aa42193ed4e1c0b90382d7
Works great for me.
How to set Thin as default in Rails 3
I sent a pull request on the Github repository of rack and it was accepted:
https://github.com/rack/rack/commit/b487f02b13f42c5933aa42193ed4e1c0b90382d7
In a near future, we will be able to use Thin just by adding gem 'thin'
to our Gemfile and starting app with rails s
.
Note that this may be a temporary measure, however.
I chose Thin because Mongrel was not maintained currently and no other server seemed to suit as an alternative to Mongrel.
How can I have a clean output with thin and ssl?
When launching Thin with the command:
rails server thin
The possible options are propagated from Rack to thin in Rack::Server#start:
server.run wrapped_app, options
But in Rack::Handler::Thin#run, we can see that the handler doesn't use those options:
module Rack
module Handler
class Thin
def self.run(app, options={})
app = Rack::Chunked.new(Rack::ContentLength.new(app))
server = ::Thin::Server.new(options[:Host] || '0.0.0.0',
options[:Port] || 8080,
app)
yield server if block_given?
server.start
end
end
end
end
When using Thin in ssl mode via the command line:
thin start --ssl
Options are parsed in Thin::Runner#parser and then used in Controllers::Controller#start
I would suggest to monkey patch Rack::Handler::Thin#run with a content similar to Controllers::Controller#start.
The result would be something like this:
module Rack
module Handler
class Thin
def self.run(app, options={})
app = Rack::Chunked.new(Rack::ContentLength.new(app))
server = ::Thin::Server.new(options[:Host] || '0.0.0.0',
options[:Port] || 8080,
app)
server.ssl = true
server.ssl_options = { :private_key_file => PATH_TO_KEY_FILE, :cert_chain_file => PATH_TO_CERT_FILE }
yield server if block_given?
server.start
end
end
end
end
Logging stacktraces when running a Rails app on Thin
what's the simplest and best way to set up email notifications on error in a Rails app?
The exception_notification
gem.
Rails - How do I configure thin's port and environment?
Just specify it as such.
rails server -e production -p 4000
Source: http://guides.rubyonrails.org/command_line.html#rails-server
How to start thin on the default port?
This indicates the port might be already in use.
Also, try running it with administrator privileges
sudo thin start -p 80
(Thanks to Tom Crinson for his blog article.)
Override Prompt when starting new rail blog
The warnings you see while using rails server
is normal. Notice they're just warnings so there shouldn't be anything stopping you from going any further.
If you use the thin server then the correct command should be thin start
. If you're using rails 3.2rc2 then according to this, rails server
will work if gem 'thin'
is in your Gemfile
.
Why would I want to use unicorn or thin instead of WEBrick for development purposes?
It is important to develop as closely as possible to the production environment. It helps ensure that an application will work as expected when deployed into production, instead of stumbling upon bugs at runtime.
This issue is alleviated with the use of Continuous Testing on a Build server that replicates the production environment. Even though you are not actively developing on an identical environment, the Continuous Testing gives you coverage that the application is functioning in the expected way.
As to speed, the performance hit running a Rails app in development mode will negate any benefit the various web servers brings.
Related Topics
Hash Ordering Preserved Between Iterations If Not Modified
I Have a Gem Installed But Require 'Gemname' Does Not Work. Why
How to Write Columns Header to a CSV File with Ruby
Get Absolute (Base) Url in Sinatra
Why Does Accessing a Ssl Site with Mechanize on Windows Fail, But on MAC Work
Write CSV in Ruby 1.9 and CSV::Writer
How to Cache a Calculated Column in Rails
How to Remove Ruby from Ubuntu
How to Randomly Iterate Through a Large Range
Empty Attribute with Ruby Haml
In Ruby, How to Check If Method "Foo=()" Is Defined
Hot Deploy on Heroku with No Downtime
Convert an Array of Integers into an Array of Strings in Ruby