puma-heroku 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +13 -13
- data/Rakefile +0 -9
- data/lib/puma/plugin/heroku.rb +11 -14
- data/puma-heroku.gemspec +3 -3
- metadata +19 -16
- data/.travis.yml +0 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 216d3ac5271277c9fd8fdbd5609a1821bf1ca092310bfbeda0c93ceed20747ef
|
4
|
+
data.tar.gz: 1f87bd9dadc93c0f27dce7c2a235d9c2d4eeca405739ed0952401e3eda43440e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eba79fb8ca09ddc005480a21a277308b31368f54fada4459c247fe5dbe6140e6610efa4fe8aa13753be8e2c8ddc4ff1ed7f635e53581b88c48f8bdaf52e0cebf
|
7
|
+
data.tar.gz: 5500a25ba768c628cd85b6548d9003e6f2dda68174f9761779b2170a0eff0e77d36c0a27dad8a6eb80c9ddb51160b02fe417eed56ab1441be80c2ee8c31d720f
|
data/README.md
CHANGED
@@ -1,8 +1,9 @@
|
|
1
|
-
#
|
1
|
+
# puma-heroku
|
2
2
|
|
3
|
-
|
3
|
+
A Puma plugin with best-practices configuration and handy configuration
|
4
|
+
variables for Heroku deployments.
|
4
5
|
|
5
|
-
|
6
|
+
You can read Heroku's documentation on the topic [here](https://devcenter.heroku.com/articles/deploying-rails-applications-with-the-puma-web-server). Most of the ideas there apply to all ruby apps running on Puma. Important Note: In that article, Heroku uses a different (rails-specific) environment variable for configuring threads. This plugin uses the generic `MAX_THREADS`, but will use `RAILS_MAX_THREADS` if available.
|
6
7
|
|
7
8
|
## Installation
|
8
9
|
|
@@ -19,23 +20,22 @@ And then execute:
|
|
19
20
|
Or install it yourself as:
|
20
21
|
|
21
22
|
$ gem install puma-heroku
|
23
|
+
|
24
|
+
Then add to your puma config.rb:
|
22
25
|
|
23
|
-
|
24
|
-
|
25
|
-
TODO: Write usage instructions here
|
26
|
-
|
27
|
-
## Development
|
26
|
+
# config/puma.rb
|
27
|
+
plugin 'heroku'
|
28
28
|
|
29
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
29
|
|
31
|
-
|
30
|
+
## Usage
|
32
31
|
|
33
|
-
|
32
|
+
Read about how to configure puma to use this plugin here: https://github.com/puma/puma#plugins
|
34
33
|
|
35
|
-
|
34
|
+
There are two variables this plugin reads from the environment which control its behavior.
|
36
35
|
|
36
|
+
* `WEB_CONCURRENCY` — How many workers to run. This will be ignored on JRuby and Windows, where only 1 worker will be run.
|
37
|
+
* `MAX_THREADS` — The number of threads to run per worker. Note that this also sets the minimum number of threads to the same value, which is a recommended approach, especially in a single-app environment such as Heroku. If you are using Rails, you may want to use `RAILS_MAX_THREADS` instead, which is also supported.
|
37
38
|
|
38
39
|
## License
|
39
40
|
|
40
41
|
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
41
|
-
|
data/Rakefile
CHANGED
data/lib/puma/plugin/heroku.rb
CHANGED
@@ -1,26 +1,23 @@
|
|
1
1
|
Puma::Plugin.create do
|
2
2
|
def config(c)
|
3
|
-
|
4
|
-
threads_count = Integer(ENV['MAX_THREADS'] || 5)
|
3
|
+
workers_count = Integer(ENV['WEB_CONCURRENCY'] || 1)
|
4
|
+
threads_count = Integer(ENV['RAILS_MAX_THREADS'] || ENV['MAX_THREADS'] || 5)
|
5
5
|
c.threads threads_count, threads_count
|
6
6
|
|
7
|
-
c.preload_app!
|
8
|
-
|
9
7
|
c.port ENV['PORT'] || 3000
|
10
|
-
c.environment ENV['RACK_ENV'] || 'development'
|
8
|
+
c.environment ENV['RACK_ENV'] || ENV['RAILS_ENV'] || 'development'
|
11
9
|
|
12
|
-
if workers_supported?
|
13
|
-
c.
|
10
|
+
if workers_supported? && workers_count > 1
|
11
|
+
c.preload_app!
|
12
|
+
c.workers workers_count
|
14
13
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
ActiveRecord::Base.establish_connection
|
20
|
-
end
|
14
|
+
# Not necessary in Rails 5.2+, see https://github.com/rails/rails/pull/29807
|
15
|
+
if defined?(::ActiveRecord) && defined?(::ActiveRecord::Base) && Gem::Version.new(Rails.version) < Gem::Version.new('5.2.0')
|
16
|
+
c.before_fork { ActiveRecord::Base.connection_pool.disconnect! }
|
17
|
+
c.on_worker_boot { ActiveRecord::Base.establish_connection }
|
21
18
|
end
|
22
19
|
end
|
23
20
|
end
|
24
21
|
|
25
|
-
VERSION = "1.
|
22
|
+
VERSION = "1.1.0"
|
26
23
|
end
|
data/puma-heroku.gemspec
CHANGED
@@ -21,8 +21,8 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
22
22
|
spec.require_paths = ["lib"]
|
23
23
|
|
24
|
-
spec.add_runtime_dependency "puma", "
|
24
|
+
spec.add_runtime_dependency "puma", ">= 3.0", "< 5.0"
|
25
25
|
|
26
|
-
spec.add_development_dependency "bundler"
|
27
|
-
spec.add_development_dependency "rake"
|
26
|
+
spec.add_development_dependency "bundler"
|
27
|
+
spec.add_development_dependency "rake"
|
28
28
|
end
|
metadata
CHANGED
@@ -1,57 +1,63 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: puma-heroku
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Evan Phoenix
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-09-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: puma
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '3.0'
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '5.0'
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
|
-
- - "
|
27
|
+
- - ">="
|
25
28
|
- !ruby/object:Gem::Version
|
26
29
|
version: '3.0'
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '5.0'
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: bundler
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
30
36
|
requirements:
|
31
|
-
- - "
|
37
|
+
- - ">="
|
32
38
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
39
|
+
version: '0'
|
34
40
|
type: :development
|
35
41
|
prerelease: false
|
36
42
|
version_requirements: !ruby/object:Gem::Requirement
|
37
43
|
requirements:
|
38
|
-
- - "
|
44
|
+
- - ">="
|
39
45
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
46
|
+
version: '0'
|
41
47
|
- !ruby/object:Gem::Dependency
|
42
48
|
name: rake
|
43
49
|
requirement: !ruby/object:Gem::Requirement
|
44
50
|
requirements:
|
45
|
-
- - "
|
51
|
+
- - ">="
|
46
52
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
53
|
+
version: '0'
|
48
54
|
type: :development
|
49
55
|
prerelease: false
|
50
56
|
version_requirements: !ruby/object:Gem::Requirement
|
51
57
|
requirements:
|
52
|
-
- - "
|
58
|
+
- - ">="
|
53
59
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
60
|
+
version: '0'
|
55
61
|
description: A Puma plugin that contains the default Heroku config
|
56
62
|
email:
|
57
63
|
- evan@phx.io
|
@@ -60,7 +66,6 @@ extensions: []
|
|
60
66
|
extra_rdoc_files: []
|
61
67
|
files:
|
62
68
|
- ".gitignore"
|
63
|
-
- ".travis.yml"
|
64
69
|
- Gemfile
|
65
70
|
- LICENSE.txt
|
66
71
|
- README.md
|
@@ -86,10 +91,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
86
91
|
- !ruby/object:Gem::Version
|
87
92
|
version: '0'
|
88
93
|
requirements: []
|
89
|
-
|
90
|
-
rubygems_version: 2.5.1
|
94
|
+
rubygems_version: 3.0.3
|
91
95
|
signing_key:
|
92
96
|
specification_version: 4
|
93
97
|
summary: Puma integration for Heroku
|
94
98
|
test_files: []
|
95
|
-
has_rdoc:
|
data/.travis.yml
DELETED