Skip to content

Commit 1c154ee

Browse files
committed
WIP
1 parent ef80a9b commit 1c154ee

File tree

5 files changed

+60
-73
lines changed

5 files changed

+60
-73
lines changed

config/application.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ class Application < Rails::Application
1212
# Initialize configuration defaults for originally generated Rails version.
1313
config.load_defaults 7.2
1414

15-
config.autoload_lib(ignore: %w(assets tasks))
15+
# Please, add to the `ignore` list any other `lib` subdirectories that do
16+
# not contain `.rb` files, or that should not be reloaded or eager loaded.
17+
# Common ones are `templates`, `generators`, or `middleware`, for example.
18+
config.autoload_lib(ignore: %w[assets tasks])
1619

1720
# Configuration for the application, engines, and railties goes here.
1821
#

config/boot.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
1+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
22

33
require "bundler/setup" # Set up gems listed in the Gemfile.

config/environments/development.rb

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33
Rails.application.configure do
44
# Settings specified here will take precedence over those in config/application.rb.
55

6-
# In the development environment your application's code is reloaded any time
7-
# it changes. This slows down response time but is perfect for development
8-
# since you don't have to restart the web server when you make code changes.
6+
# Make code changes take effect immediately without server restart.
97
config.enable_reloading = true
108

119
# Do not eager load code on boot.
@@ -17,47 +15,46 @@
1715
# Enable server timing.
1816
config.server_timing = true
1917

20-
# Enable/disable caching. By default caching is disabled.
21-
# Run rails dev:cache to toggle caching.
18+
# Enable/disable Action Controller caching. By default Action Controller caching is disabled.
19+
# Run rails dev:cache to toggle Action Controller caching.
2220
if Rails.root.join("tmp/caching-dev.txt").exist?
2321
config.action_controller.perform_caching = true
2422
config.action_controller.enable_fragment_cache_logging = true
25-
2623
config.cache_store = :memory_store
27-
config.public_file_server.headers = { "Cache-Control" => "public, max-age=#{2.days.to_i}" }
24+
config.public_file_server.headers = { "cache-control" => "public, max-age=#{2.days.to_i}" }
2825
else
2926
config.action_controller.perform_caching = false
3027

3128
config.cache_store = :null_store
3229
end
3330

31+
# Change to :null_store to avoid any caching.
32+
# config.cache_store = :memory_store
33+
3434
# Store uploaded files on the local file system (see config/storage.yml for options).
3535
config.active_storage.service = :local
3636

3737
# Don't care if the mailer can't send.
3838
config.action_mailer.raise_delivery_errors = false
3939

40-
# Disable caching for Action Mailer templates even if Action Controller
41-
# caching is enabled.
40+
# Make template changes take effect immediately.
4241
config.action_mailer.perform_caching = false
4342

43+
# Set localhost to be used by links generated in mailer templates.
4444
config.action_mailer.default_url_options = { host: "localhost", port: 3000 }
4545

4646
# Print deprecation notices to the Rails logger.
4747
config.active_support.deprecation = :log
4848

49-
# Raise exceptions for disallowed deprecations.
50-
config.active_support.disallowed_deprecation = :raise
51-
52-
# Tell Active Support which deprecation messages to disallow.
53-
config.active_support.disallowed_deprecation_warnings = []
54-
5549
# Raise an error on page load if there are pending migrations.
5650
config.active_record.migration_error = :page_load
5751

5852
# Highlight code that triggered database queries in logs.
5953
config.active_record.verbose_query_logs = true
6054

55+
# Append comments with runtime information tags to SQL queries in logs.
56+
config.active_record.query_log_tags_enabled = true
57+
6158
# Highlight code that enqueued background job in logs.
6259
config.active_job.verbose_enqueue_logs = true
6360

config/environments/production.rb

Lines changed: 34 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -6,49 +6,30 @@
66
# Code is not reloaded between requests.
77
config.enable_reloading = false
88

9-
# Eager load code on boot. This eager loads most of Rails and
10-
# your application in memory, allowing both threaded web servers
11-
# and those relying on copy on write to perform better.
12-
# Rake tasks automatically ignore this option for performance.
9+
# Eager load code on boot for better performance and memory savings (ignored by Rake tasks).
1310
config.eager_load = true
1411

15-
# Full error reports are disabled and caching is turned on.
12+
# Full error reports are disabled.
1613
config.consider_all_requests_local = false
17-
config.action_controller.perform_caching = true
18-
19-
# Ensures that a master key has been made available in ENV["RAILS_MASTER_KEY"], config/master.key, or an environment
20-
# key such as config/credentials/production.key. This key is used to decrypt credentials (and other encrypted files).
21-
# config.require_master_key = true
2214

23-
# Disable serving static files from `public/`, relying on NGINX/Apache to do so instead.
24-
# config.public_file_server.enabled = false
15+
# Turn on fragment caching in view templates.
16+
config.action_controller.perform_caching = true
2517

26-
# Compress CSS using a preprocessor.
27-
# config.assets.css_compressor = :sass
18+
# Cache assets for far-future expiry since they are all digest stamped.
19+
config.public_file_server.headers = { "cache-control" => "public, max-age=#{1.year.to_i}" }
2820

29-
# Compress JS using a preprocessor.
3021
config.assets.js_compressor = :terser
3122

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

3526
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
36-
# config.asset_host = 'http://assets.example.com'
37-
38-
# Specifies the header that your server uses for sending files.
39-
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
40-
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
27+
# config.asset_host = "http://assets.example.com"
4128

4229
# Store uploaded files on the local file system (see config/storage.yml for options).
4330
config.active_storage.service = :local
4431

45-
# Mount Action Cable outside main process or domain.
46-
# config.action_cable.mount_path = nil
47-
# config.action_cable.url = "wss://example.com/cable"
48-
# config.action_cable.allowed_request_origins = [ "http://example.com", /http:\/\/example.*/ ]
49-
5032
# Assume all access to the app is happening through a SSL-terminating reverse proxy.
51-
# Can be used together with config.force_ssl for Strict-Transport-Security and secure cookies.
5233
# config.assume_ssl = true
5334

5435
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
@@ -57,25 +38,24 @@
5738
# Skip http-to-https redirect for the default health check endpoint.
5839
# config.ssl_options = { redirect: { exclude: ->(request) { request.path == "/up" } } }
5940

60-
# Log to STDOUT by default
61-
config.logger = ActiveSupport::Logger.new(STDOUT)
62-
.tap { |logger| logger.formatter = ::Logger::Formatter.new }
63-
.then { |logger| ActiveSupport::TaggedLogging.new(logger) }
64-
65-
# Prepend all log lines with the following tags.
41+
# Log to STDOUT with the current request id as a default log tag.
6642
config.log_tags = [ :request_id ]
43+
config.logger = ActiveSupport::TaggedLogging.logger(STDOUT)
6744

68-
# "info" includes generic and useful information about system operation, but avoids logging too much
69-
# information to avoid inadvertent exposure of personally identifiable information (PII). If you
70-
# want to log everything, set the level to "debug".
45+
# Change to "debug" to log everything (including potentially personally-identifiable information!)
7146
config.log_level = ENV.fetch("RAILS_LOG_LEVEL", "info")
7247

73-
# Use a different cache store in production.
48+
# Prevent health checks from clogging up the logs.
49+
config.silence_healthcheck_path = "/up"
50+
51+
# Don't log any deprecations.
52+
config.active_support.report_deprecations = false
53+
54+
# Replace the default in-process memory cache store with a durable alternative.
7455
# config.cache_store = :mem_cache_store
7556

76-
# Use a real queuing backend for Active Job (and separate queues per environment).
57+
# Replace the default in-process and non-durable queuing backend for Active Job.
7758
# config.active_job.queue_adapter = :resque
78-
# config.active_job.queue_name_prefix = "planner_production"
7959

8060
# Disable caching for Action Mailer templates even if Action Controller
8161
# caching is enabled.
@@ -85,13 +65,25 @@
8565
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
8666
# config.action_mailer.raise_delivery_errors = false
8767

68+
# Set host to be used by links generated in mailer templates.
69+
config.action_mailer.default_url_options = { host: 'codebar.io' }
70+
71+
# Specify outgoing SMTP server. Remember to add smtp/* credentials via rails credentials:edit.
72+
config.action_mailer.smtp_settings = {
73+
port: '587',
74+
address: 'smtp.sendgrid.net',
75+
user_name: ENV['SENDGRID_USERNAME'],
76+
password: ENV['SENDGRID_PASSWORD'],
77+
domain: 'heroku.com',
78+
authentication: :plain,
79+
enable_starttls_auto: true
80+
}
81+
ActionMailer::Base.delivery_method = :smtp
82+
8883
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
8984
# the I18n.default_locale when a translation cannot be found).
9085
config.i18n.fallbacks = true
9186

92-
# Don't log any deprecations.
93-
config.active_support.report_deprecations = false
94-
9587
# Do not dump schema after migrations.
9688
config.active_record.dump_schema_after_migration = false
9789

@@ -103,19 +95,7 @@
10395
# "example.com", # Allow requests from example.com
10496
# /.*\.example\.com/ # Allow requests from subdomains like `www.example.com`
10597
# ]
106-
98+
#
10799
# Skip DNS rebinding protection for the default health check endpoint.
108100
# config.host_authorization = { exclude: ->(request) { request.path == "/up" } }
109-
110-
config.action_mailer.smtp_settings = {
111-
port: '587',
112-
address: 'smtp.sendgrid.net',
113-
user_name: ENV['SENDGRID_USERNAME'],
114-
password: ENV['SENDGRID_PASSWORD'],
115-
domain: 'heroku.com',
116-
authentication: :plain,
117-
enable_starttls_auto: true
118-
}
119-
ActionMailer::Base.delivery_method = :smtp
120-
config.action_mailer.default_url_options = { host: 'codebar.io' }
121101
end

config/puma.rb

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
# This configuration file will be evaluated by Puma. The top-level methods that
22
# are invoked here are part of Puma's configuration DSL. For more information
33
# about methods provided by the DSL, see https://puma.io/puma/Puma/DSL.html.
4-
4+
#
55
# Puma starts a configurable number of processes (workers) and each process
66
# serves each request in a thread from an internal thread pool.
77
#
8+
# You can control the number of workers using ENV["WEB_CONCURRENCY"]. You
9+
# should only set this value when you want to run 2 or more workers. The
10+
# default is already 1.
11+
#
812
# The ideal number of threads per worker depends both on how much time the
913
# application spends waiting for IO operations and on how much you wish to
10-
# to prioritize throughput over latency.
14+
# prioritize throughput over latency.
1115
#
1216
# As a rule of thumb, increasing the number of threads will increase how much
1317
# traffic a given process can handle (throughput), but due to CRuby's
@@ -29,6 +33,9 @@
2933
# Allow puma to be restarted by `bin/rails restart` command.
3034
plugin :tmp_restart
3135

36+
# Run the Solid Queue supervisor inside of Puma for single-server deployments
37+
plugin :solid_queue if ENV["SOLID_QUEUE_IN_PUMA"]
38+
3239
# Specify the PID file. Defaults to tmp/pids/server.pid in development.
3340
# In other environments, only set the PID file if requested.
3441
pidfile ENV["PIDFILE"] if ENV["PIDFILE"]

0 commit comments

Comments
 (0)