puma 3.11.3 → 3.12.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of puma might be problematic. Click here for more details.

Files changed (48) hide show
  1. checksums.yaml +5 -5
  2. data/History.md +40 -0
  3. data/README.md +15 -5
  4. data/docs/architecture.md +1 -1
  5. data/docs/restart.md +1 -1
  6. data/docs/systemd.md +10 -0
  7. data/ext/puma_http11/mini_ssl.c +22 -1
  8. data/ext/puma_http11/org/jruby/puma/MiniSSL.java +6 -0
  9. data/lib/puma/binder.rb +13 -9
  10. data/lib/puma/cli.rb +18 -7
  11. data/lib/puma/client.rb +14 -0
  12. data/lib/puma/cluster.rb +16 -1
  13. data/lib/puma/commonlogger.rb +2 -0
  14. data/lib/puma/configuration.rb +2 -0
  15. data/lib/puma/const.rb +4 -2
  16. data/lib/puma/control_cli.rb +13 -11
  17. data/lib/puma/convenient.rb +2 -0
  18. data/lib/puma/daemon_ext.rb +2 -0
  19. data/lib/puma/delegation.rb +2 -0
  20. data/lib/puma/detect.rb +2 -0
  21. data/lib/puma/dsl.rb +18 -8
  22. data/lib/puma/events.rb +2 -0
  23. data/lib/puma/io_buffer.rb +2 -0
  24. data/lib/puma/java_io_buffer.rb +2 -0
  25. data/lib/puma/jruby_restart.rb +2 -0
  26. data/lib/puma/launcher.rb +5 -2
  27. data/lib/puma/minissl.rb +7 -3
  28. data/lib/puma/null_io.rb +2 -0
  29. data/lib/puma/plugin.rb +2 -0
  30. data/lib/puma/rack/builder.rb +2 -1
  31. data/lib/puma/reactor.rb +134 -0
  32. data/lib/puma/runner.rb +10 -1
  33. data/lib/puma/server.rb +40 -4
  34. data/lib/puma/single.rb +12 -1
  35. data/lib/puma/state_file.rb +2 -0
  36. data/lib/puma/tcp_logger.rb +2 -0
  37. data/lib/puma/thread_pool.rb +46 -5
  38. data/lib/puma/util.rb +1 -0
  39. data/lib/puma.rb +8 -0
  40. data/lib/rack/handler/puma.rb +4 -0
  41. data/tools/jungle/README.md +10 -4
  42. data/tools/jungle/init.d/README.md +2 -0
  43. data/tools/jungle/init.d/puma +2 -2
  44. data/tools/jungle/init.d/run-puma +1 -1
  45. data/tools/jungle/rc.d/README.md +74 -0
  46. data/tools/jungle/rc.d/puma +61 -0
  47. data/tools/jungle/rc.d/puma.conf +10 -0
  48. metadata +11 -8
@@ -0,0 +1,74 @@
1
+ # Puma as a service using rc.d
2
+
3
+ Manage multilpe Puma servers as services on one box using FreeBSD's rc.d service.
4
+
5
+ ## Dependencies
6
+
7
+ * `jq` - a command-line json parser is needed to parse the json in the config file
8
+
9
+ ## Installation
10
+
11
+ # Copy the puma script to the rc.d directory (make sure everyone has read/execute perms)
12
+ sudo cp puma /usr/local/etc/rc.d/
13
+
14
+ # Create an empty configuration file
15
+ sudo touch /usr/local/etc/puma.conf
16
+
17
+ # Enable the puma service
18
+ sudo echo 'puma_enable="YES"' >> /etc/rc.conf
19
+
20
+ ## Managing the jungle
21
+
22
+ Puma apps are referenced in /usr/local/etc/puma.conf by default.
23
+
24
+ Start the jungle running:
25
+
26
+ `service puma start`
27
+
28
+ This script will run at boot time.
29
+
30
+
31
+ You can also stop the jungle (stops ALL puma instances) by running:
32
+
33
+ `service puma stop`
34
+
35
+
36
+ To restart the jungle:
37
+
38
+ `service puma restart`
39
+
40
+ ## Conventions
41
+
42
+ * The script expects:
43
+ * a config file to exist under `config/puma.rb` in your app. E.g.: `/home/apps/my-app/config/puma.rb`.
44
+
45
+ You can always change those defaults by editing the scripts.
46
+
47
+ ## Here's what a minimal app's config file should have
48
+
49
+ ```
50
+ {
51
+ "servers" : [
52
+ {
53
+ "dir": "/path/to/rails/project",
54
+ "user": "deploy-user",
55
+ "ruby_version": "ruby.version",
56
+ "ruby_env": "rbenv"
57
+ }
58
+ ]
59
+ }
60
+ ```
61
+
62
+ ## Before starting...
63
+
64
+ You need to customise `puma.conf` to:
65
+
66
+ * Set the right user your app should be running on unless you want root to execute it!
67
+ * Set the directory of the app
68
+ * Set the ruby version to execute
69
+ * Set the ruby environment (currently set to rbenv, since that is the only ruby environment currently supported)
70
+ * Add additional server instances following the scheme in the example
71
+
72
+ ## Notes:
73
+
74
+ Only rbenv is currently supported.
@@ -0,0 +1,61 @@
1
+ #!/bin/sh
2
+ #
3
+
4
+ # PROVIDE: puma
5
+
6
+ . /etc/rc.subr
7
+
8
+ name="puma"
9
+ start_cmd="puma_start"
10
+ stop_cmd="puma_stop"
11
+ restart_cmd="puma_restart"
12
+ rcvar=puma_enable
13
+ required_files=/usr/local/etc/puma.conf
14
+
15
+ puma_start()
16
+ {
17
+ server_count=$(/usr/local/bin/jq ".servers[] .ruby_env" /usr/local/etc/puma.conf | wc -l)
18
+ i=0
19
+ while [ "$i" -lt "$server_count" ]; do
20
+ rb_env=$(/usr/local/bin/jq -r ".servers[$i].ruby_env" /usr/local/etc/puma.conf)
21
+ dir=$(/usr/local/bin/jq -r ".servers[$i].dir" /usr/local/etc/puma.conf)
22
+ user=$(/usr/local/bin/jq -r ".servers[$i].user" /usr/local/etc/puma.conf)
23
+ rb_ver=$(/usr/local/bin/jq -r ".servers[$i].ruby_version" /usr/local/etc/puma.conf)
24
+ case $rb_env in
25
+ "rbenv")
26
+ su - $user -c "cd $dir && rbenv shell $rb_ver && bundle exec puma -C $dir/config/puma.rb -d"
27
+ ;;
28
+ *)
29
+ ;;
30
+ esac
31
+ i=$(( i + 1 ))
32
+ done
33
+ }
34
+
35
+ puma_stop()
36
+ {
37
+ pkill ruby
38
+ }
39
+
40
+ puma_restart()
41
+ {
42
+ server_count=$(/usr/local/bin/jq ".servers[] .ruby_env" /usr/local/etc/puma.conf | wc -l)
43
+ i=0
44
+ while [ "$i" -lt "$server_count" ]; do
45
+ rb_env=$(/usr/local/bin/jq -r ".servers[$i].ruby_env" /usr/local/etc/puma.conf)
46
+ dir=$(/usr/local/bin/jq -r ".servers[$i].dir" /usr/local/etc/puma.conf)
47
+ user=$(/usr/local/bin/jq -r ".servers[$i].user" /usr/local/etc/puma.conf)
48
+ rb_ver=$(/usr/local/bin/jq -r ".servers[$i].ruby_version" /usr/local/etc/puma.conf)
49
+ case $rb_env in
50
+ "rbenv")
51
+ su - $user -c "cd $dir && pkill ruby && rbenv shell $ruby_version && bundle exec puma -C $dir/config/puma.rb -d"
52
+ ;;
53
+ *)
54
+ ;;
55
+ esac
56
+ i=$(( i + 1 ))
57
+ done
58
+ }
59
+
60
+ load_rc_config $name
61
+ run_rc_command "$1"
@@ -0,0 +1,10 @@
1
+ {
2
+ "servers" : [
3
+ {
4
+ "dir": "/path/to/rails/project",
5
+ "user": "deploy-user",
6
+ "ruby_version": "ruby.version",
7
+ "ruby_env": "rbenv"
8
+ }
9
+ ]
10
+ }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puma
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.11.3
4
+ version: 3.12.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Evan Phoenix
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-06 00:00:00.000000000 Z
11
+ date: 2019-03-19 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Puma is a simple, fast, threaded, and highly concurrent HTTP 1.1 server
14
14
  for Ruby/Rack applications. Puma is intended for use in both development and production
@@ -96,6 +96,9 @@ files:
96
96
  - tools/jungle/init.d/README.md
97
97
  - tools/jungle/init.d/puma
98
98
  - tools/jungle/init.d/run-puma
99
+ - tools/jungle/rc.d/README.md
100
+ - tools/jungle/rc.d/puma
101
+ - tools/jungle/rc.d/puma.conf
99
102
  - tools/jungle/upstart/README.md
100
103
  - tools/jungle/upstart/puma-manager.conf
101
104
  - tools/jungle/upstart/puma.conf
@@ -105,7 +108,7 @@ licenses:
105
108
  - BSD-3-Clause
106
109
  metadata:
107
110
  msys2_mingw_dependencies: openssl
108
- post_install_message:
111
+ post_install_message:
109
112
  rdoc_options: []
110
113
  require_paths:
111
114
  - lib
@@ -113,16 +116,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
113
116
  requirements:
114
117
  - - ">="
115
118
  - !ruby/object:Gem::Version
116
- version: 1.9.3
119
+ version: '2.2'
117
120
  required_rubygems_version: !ruby/object:Gem::Requirement
118
121
  requirements:
119
122
  - - ">="
120
123
  - !ruby/object:Gem::Version
121
124
  version: '0'
122
125
  requirements: []
123
- rubyforge_project:
124
- rubygems_version: 2.6.14
125
- signing_key:
126
+ rubyforge_project:
127
+ rubygems_version: 2.7.6
128
+ signing_key:
126
129
  specification_version: 4
127
130
  summary: Puma is a simple, fast, threaded, and highly concurrent HTTP 1.1 server for
128
131
  Ruby/Rack applications