Skip to content

Commit

Permalink
rails8: 修正漏れ
Browse files Browse the repository at this point in the history
  • Loading branch information
koi-chan committed Nov 21, 2024
1 parent 6afba4f commit 99d75e2
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
2 changes: 1 addition & 1 deletion config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
module LogArchiver
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 7.2
config.load_defaults 8.0

# Please, add to the `ignore` list any other `lib` subdirectories that do
# not contain `.rb` files, or that should not be reloaded or eager loaded.
Expand Down
9 changes: 8 additions & 1 deletion config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@
# Turn on fragment caching in view templates.
config.action_controller.perform_caching = true

# Compress CSS using a preprocessor.
config.assets.js_compressor = :terser
config.assets.terser = { output: { ascii_only: false } }

# Do not fall back to assets pipeline if a precompiled asset is missed.
config.assets.compile = false

# Cache assets for far-future expiry since they are all digest stamped.
config.public_file_server.headers = { "cache-control" => "public, max-age=#{1.year.to_i}" }

Expand Down Expand Up @@ -70,7 +77,7 @@

# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation cannot be found).
config.i18n.fallbacks = true
#config.i18n.fallbacks = true
config.i18n.fallbacks = [I18n.default_locale]

# Do not dump schema after migrations.
Expand Down
16 changes: 16 additions & 0 deletions config/puma.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,18 @@
#
# The default is set to 3 threads as it's deemed a decent compromise between
# throughput and latency for the average Rails application.

# 参考: http://nekorails.hatenablog.com/entry/2018/10/12/101011

# Rails のルートパス
rails_root = File.expand_path('../../', __FILE__)
directory rails_root

# Puma can serve each request in a thread from an internal thread pool.
# The `threads` method setting takes two numbers: a minimum and maximum.
# Any libraries that use thread pools should be configured to match
# the maximum value specified for Puma. Default is set to 5 threads for minimum
# and maximum; this matches the default thread size of Active Record.
#
# Any libraries that use a connection pool or another resource pool should
# be configured to provide at least as many connections as the number of
Expand All @@ -28,6 +40,10 @@
min_threads_count = ENV.fetch("RAILS_MIN_THREADS") { max_threads_count }
threads min_threads_count, max_threads_count

# Specifies the `worker_timeout` threshold that Puma will use to wait before
# terminating a worker in development environments.
worker_timeout 3600 if ENV.fetch("RAILS_ENV", "development") == "development"

# Specifies the `port` that Puma will listen on to receive requests; default is 3000.
if ENV.fetch("RAILS_ENV", "development") == "development"
bind "tcp://0.0.0.0:3000"
Expand Down

0 comments on commit 99d75e2

Please sign in to comment.