annotate config/puma.rb @ 196:af292e3d34c9

Another place to disable session store
author nanaya <me@nanaya.pro>
date Mon, 24 Feb 2020 00:20:17 +0900
parents d5a0d66ee457
children 89f6c0016bab
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
89
d5a0d66ee457 Finish updating to rails 5
nanaya <me@myconan.net>
parents:
diff changeset
1 # Puma can serve each request in a thread from an internal thread pool.
d5a0d66ee457 Finish updating to rails 5
nanaya <me@myconan.net>
parents:
diff changeset
2 # The `threads` method setting takes two numbers a minimum and maximum.
d5a0d66ee457 Finish updating to rails 5
nanaya <me@myconan.net>
parents:
diff changeset
3 # Any libraries that use thread pools should be configured to match
d5a0d66ee457 Finish updating to rails 5
nanaya <me@myconan.net>
parents:
diff changeset
4 # the maximum value specified for Puma. Default is set to 5 threads for minimum
d5a0d66ee457 Finish updating to rails 5
nanaya <me@myconan.net>
parents:
diff changeset
5 # and maximum, this matches the default thread size of Active Record.
d5a0d66ee457 Finish updating to rails 5
nanaya <me@myconan.net>
parents:
diff changeset
6 #
d5a0d66ee457 Finish updating to rails 5
nanaya <me@myconan.net>
parents:
diff changeset
7 threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }.to_i
d5a0d66ee457 Finish updating to rails 5
nanaya <me@myconan.net>
parents:
diff changeset
8 threads threads_count, threads_count
d5a0d66ee457 Finish updating to rails 5
nanaya <me@myconan.net>
parents:
diff changeset
9
d5a0d66ee457 Finish updating to rails 5
nanaya <me@myconan.net>
parents:
diff changeset
10 # Specifies the `port` that Puma will listen on to receive requests, default is 3000.
d5a0d66ee457 Finish updating to rails 5
nanaya <me@myconan.net>
parents:
diff changeset
11 #
d5a0d66ee457 Finish updating to rails 5
nanaya <me@myconan.net>
parents:
diff changeset
12 port ENV.fetch("PORT") { 3000 }
d5a0d66ee457 Finish updating to rails 5
nanaya <me@myconan.net>
parents:
diff changeset
13
d5a0d66ee457 Finish updating to rails 5
nanaya <me@myconan.net>
parents:
diff changeset
14 # Specifies the `environment` that Puma will run in.
d5a0d66ee457 Finish updating to rails 5
nanaya <me@myconan.net>
parents:
diff changeset
15 #
d5a0d66ee457 Finish updating to rails 5
nanaya <me@myconan.net>
parents:
diff changeset
16 environment ENV.fetch("RAILS_ENV") { "development" }
d5a0d66ee457 Finish updating to rails 5
nanaya <me@myconan.net>
parents:
diff changeset
17
d5a0d66ee457 Finish updating to rails 5
nanaya <me@myconan.net>
parents:
diff changeset
18 # Specifies the number of `workers` to boot in clustered mode.
d5a0d66ee457 Finish updating to rails 5
nanaya <me@myconan.net>
parents:
diff changeset
19 # Workers are forked webserver processes. If using threads and workers together
d5a0d66ee457 Finish updating to rails 5
nanaya <me@myconan.net>
parents:
diff changeset
20 # the concurrency of the application would be max `threads` * `workers`.
d5a0d66ee457 Finish updating to rails 5
nanaya <me@myconan.net>
parents:
diff changeset
21 # Workers do not work on JRuby or Windows (both of which do not support
d5a0d66ee457 Finish updating to rails 5
nanaya <me@myconan.net>
parents:
diff changeset
22 # processes).
d5a0d66ee457 Finish updating to rails 5
nanaya <me@myconan.net>
parents:
diff changeset
23 #
d5a0d66ee457 Finish updating to rails 5
nanaya <me@myconan.net>
parents:
diff changeset
24 # workers ENV.fetch("WEB_CONCURRENCY") { 2 }
d5a0d66ee457 Finish updating to rails 5
nanaya <me@myconan.net>
parents:
diff changeset
25
d5a0d66ee457 Finish updating to rails 5
nanaya <me@myconan.net>
parents:
diff changeset
26 # Use the `preload_app!` method when specifying a `workers` number.
d5a0d66ee457 Finish updating to rails 5
nanaya <me@myconan.net>
parents:
diff changeset
27 # This directive tells Puma to first boot the application and load code
d5a0d66ee457 Finish updating to rails 5
nanaya <me@myconan.net>
parents:
diff changeset
28 # before forking the application. This takes advantage of Copy On Write
d5a0d66ee457 Finish updating to rails 5
nanaya <me@myconan.net>
parents:
diff changeset
29 # process behavior so workers use less memory. If you use this option
d5a0d66ee457 Finish updating to rails 5
nanaya <me@myconan.net>
parents:
diff changeset
30 # you need to make sure to reconnect any threads in the `on_worker_boot`
d5a0d66ee457 Finish updating to rails 5
nanaya <me@myconan.net>
parents:
diff changeset
31 # block.
d5a0d66ee457 Finish updating to rails 5
nanaya <me@myconan.net>
parents:
diff changeset
32 #
d5a0d66ee457 Finish updating to rails 5
nanaya <me@myconan.net>
parents:
diff changeset
33 # preload_app!
d5a0d66ee457 Finish updating to rails 5
nanaya <me@myconan.net>
parents:
diff changeset
34
d5a0d66ee457 Finish updating to rails 5
nanaya <me@myconan.net>
parents:
diff changeset
35 # The code in the `on_worker_boot` will be called if you are using
d5a0d66ee457 Finish updating to rails 5
nanaya <me@myconan.net>
parents:
diff changeset
36 # clustered mode by specifying a number of `workers`. After each worker
d5a0d66ee457 Finish updating to rails 5
nanaya <me@myconan.net>
parents:
diff changeset
37 # process is booted this block will be run, if you are using `preload_app!`
d5a0d66ee457 Finish updating to rails 5
nanaya <me@myconan.net>
parents:
diff changeset
38 # option you will want to use this block to reconnect to any threads
d5a0d66ee457 Finish updating to rails 5
nanaya <me@myconan.net>
parents:
diff changeset
39 # or connections that may have been created at application boot, Ruby
d5a0d66ee457 Finish updating to rails 5
nanaya <me@myconan.net>
parents:
diff changeset
40 # cannot share connections between processes.
d5a0d66ee457 Finish updating to rails 5
nanaya <me@myconan.net>
parents:
diff changeset
41 #
d5a0d66ee457 Finish updating to rails 5
nanaya <me@myconan.net>
parents:
diff changeset
42 # on_worker_boot do
d5a0d66ee457 Finish updating to rails 5
nanaya <me@myconan.net>
parents:
diff changeset
43 # ActiveRecord::Base.establish_connection if defined?(ActiveRecord)
d5a0d66ee457 Finish updating to rails 5
nanaya <me@myconan.net>
parents:
diff changeset
44 # end
d5a0d66ee457 Finish updating to rails 5
nanaya <me@myconan.net>
parents:
diff changeset
45
d5a0d66ee457 Finish updating to rails 5
nanaya <me@myconan.net>
parents:
diff changeset
46 # Allow puma to be restarted by `rails restart` command.
d5a0d66ee457 Finish updating to rails 5
nanaya <me@myconan.net>
parents:
diff changeset
47 plugin :tmp_restart