1
0
Fork 0
mirror of https://github.com/puma/puma.git synced 2022-11-09 13:48:40 -05:00
Commit graph

25 commits

Author SHA1 Message Date
Richard Schneeman
328687d8de [Close #1255] Prefer user supplied defaults (#1277)
To build a "binds" we need a host IP (via Host) and a port. We were running into a problem where a Host was being explicitly set via user but the Port was being defaulted to by Rails. When this happened the Host was used, but Puma would accidentally use it's own default port 9292 instead of Rail's port of 3000.

The fix was to use the "default" port passed in from a framework (if available) when no explicitly set Port is provided.
2017-05-01 09:54:53 -07:00
schneems
85dfe8edcf Implement user_supplied_options behavior.
When options are passed to the Puma rack handler it is unknown if the options were set via a framework as a default or via a user. Puma currently has 3 different sources of configuration, the user via command line, the config files, and defaults. 

Rails 5.1+ will record the values actually specified by the user versus the values specified by the frameworks. It passes these values to the Rack handler and now it's up to Puma to do something with that information.

When only framework defaults are passed it will set

```
options[:user_supplied_options] = []
```

When one or more options are specified by the user such as `:Port` then those keys will be in the array. In that example it will look like this


```
options[:user_supplied_options] = [:Port]
```

This change is 100% backwards compatible. If the framework is older and does not pass this information then the `user_supplied_options` will not be set, in that case we assume all values are user supplied.

Internally we accomplish this separation by replacing `LeveledOptions` which was a generic way of specifying options with different priorities with a more explicit `UserFileDefaultOptions` this assumes only 3 levels of options and it will use them in the order supplied (user config wins over file based config wins over defaults).

Now instead of using 1 dsl to set all values, we use 3. A user dsl, a file dsl and a Configuration.new` will return all 3 DSLs to the block. It's up to the person using the block to use the correct dsl corresponding to the source of data they are getting.
2017-03-09 11:38:26 -06:00
schneems
24f12579bf Use config file before default port with handler 2017-03-09 11:38:26 -06:00
schneems
cda9317e71 Split out config into explicit user and file parts 2017-03-09 11:38:26 -06:00
schneems
6dde986e10 Separate Config method so we can test output
The RackHandler for Puma has configuration options that I want to test without booting up a server. By separating out into a new method we can do this easily.
2017-03-09 11:38:26 -06:00
Théophile Helleboid - chtitux
e083224d46 Allow rack handler to accept ssl host (#1129)
It then allow rails to start puma and pass the TLS/SSL configuration:
~~~
bin/rails server puma -b "ssl://0.0.0.0?key=/path/to/example.key&cert=/path/to/example.crt"
~~~
2016-12-12 12:59:12 -07:00
Francesco Rodriguez
e7546465d0 Rack handler uses Rack::CommonLogger.
No need to require Puma::CommonLogger.
2016-09-07 21:13:47 +02:00
Evan Phoenix
f600a36812 Move proper requires into rack handler run. Fixes #1076 2016-09-06 13:21:08 -07:00
Prathamesh Sonpatki
c4006b93fa Allow overriding options of Configuration object
- Currently it's not possible to override the default options for
  Puma::Configuration with user provided options.
- I came across this issue while working on fixing server restart for
  Rails.
- Rails can send it's own restart command to Puma and Puma should store
  it in it's configuration object. So that Puma::Launcher can use it.
- After this patch it will be possible as user provided options will be
  taken into account in Configuration object.
2016-03-30 10:56:25 +05:30
Evan Phoenix
90e6e3e011 Treat path-like hosts as unix sockets. Fixes #824 2016-02-25 13:42:29 -08:00
Evan Phoenix
03ed48ca90 Don't log requests by default. Fixes #852 2016-02-25 13:09:02 -08:00
Evan Phoenix
f788af0c8f Continue API cleanup, preparing for 3.0 2016-02-06 19:00:29 -08:00
schneems
36711207e8 Fix Puma with rails server
The "default" thread in the handler was interpreted as canonical and took precedence over the `config/puma.rb` file. Fixed by using defaults already present in `configuration.rb` which is used by the Launcher.

We only advertise `Puma.cli_config` when puma is set via the cli. Not sure why but if `cli.rb` hasn't been loaded then we don't need to run that code.

Moving requires to Launcher so it can be called as a standalone file (otherwise we get require errors).
2016-02-04 16:55:10 -06:00
schneems
8a19a22135 1.8.7 hash 2016-02-04 16:55:10 -06:00
schneems
d6df5cec22 Switch puma rack handler to use Launcher 2016-02-04 16:55:10 -06:00
Andrey Koleshko
fdf69be30b Allow to run puma in silent mode 2015-12-03 05:21:17 +03:00
burningTyger
f6ef2c4a70 fixing for typo mentioned in #803 2015-10-20 14:55:42 +02:00
jc00ke
492001c987 Mongrel::HttpServer hack no longer needed 2014-12-09 22:50:03 -08:00
Larry Marburger
54a357470b Remove unnecessary thread pool size conversions 2013-07-16 20:08:30 -04:00
Evan Phoenix
2280b68d98 Various methods to get newrelic to start. Fixes #128 2012-10-19 23:03:55 -07:00
Darío Javier Cravero
5c6facdec3 Added the ability to set RACK_ENV when Puma is called from a Rack app and not through the CLI 2012-07-05 22:07:45 +01:00
slavic
a022c41972 Add interruption support to Rack Handler 2012-03-26 00:20:11 +03:00
Evan Phoenix
a645b64940 Exclude a logger by default in handler mode. Fixes #22 2011-12-19 14:17:25 -08:00
Evan Phoenix
80eb913b1b Add output when used via rackup 2011-11-22 15:06:51 -08:00
Konstantin Haase
7c41cf7bb7 add Rack handler for Puma 2011-10-04 14:23:51 -07:00