railties 7.2.1.1 → 8.0.0.rc1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +122 -278
- data/lib/minitest/rails_plugin.rb +1 -1
- data/lib/rails/application/bootstrap.rb +0 -1
- data/lib/rails/application/configuration.rb +15 -14
- data/lib/rails/application/default_middleware_stack.rb +4 -0
- data/lib/rails/application/finisher.rb +2 -3
- data/lib/rails/application/routes_reloader.rb +11 -1
- data/lib/rails/application.rb +5 -0
- data/lib/rails/code_statistics.rb +128 -86
- data/lib/rails/code_statistics_calculator.rb +78 -76
- data/lib/rails/command/helpers/editor.rb +1 -1
- data/lib/rails/command.rb +0 -6
- data/lib/rails/commands/app/update_command.rb +1 -9
- data/lib/rails/commands/console/irb_console.rb +11 -8
- data/lib/rails/commands/credentials/USAGE +4 -4
- data/lib/rails/commands/credentials/credentials_command.rb +5 -1
- data/lib/rails/commands/dev/dev_command.rb +1 -1
- data/lib/rails/commands/devcontainer/devcontainer_command.rb +2 -1
- data/lib/rails/commands/stats/stats_command.rb +19 -0
- data/lib/rails/console/methods.rb +5 -21
- data/lib/rails/dev_caching.rb +2 -2
- data/lib/rails/engine/configuration.rb +3 -1
- data/lib/rails/engine/lazy_route_set.rb +114 -0
- data/lib/rails/engine.rb +12 -8
- data/lib/rails/gem_version.rb +4 -4
- data/lib/rails/generators/app_base.rb +46 -28
- data/lib/rails/generators/base.rb +0 -4
- data/lib/rails/generators/database.rb +101 -67
- data/lib/rails/generators/erb/authentication/authentication_generator.rb +15 -0
- data/lib/rails/generators/erb/authentication/templates/app/views/passwords/edit.html.erb +9 -0
- data/lib/rails/generators/erb/authentication/templates/app/views/passwords/new.html.erb +8 -0
- data/lib/rails/generators/erb/authentication/templates/app/views/sessions/new.html.erb +11 -0
- data/lib/rails/generators/generated_attribute.rb +16 -11
- data/lib/rails/generators/rails/app/app_generator.rb +20 -32
- data/lib/rails/generators/rails/app/templates/Dockerfile.tt +13 -4
- data/lib/rails/generators/rails/app/templates/Gemfile.tt +25 -10
- data/lib/rails/generators/rails/app/templates/app/assets/stylesheets/application.css.tt +6 -11
- data/lib/rails/generators/rails/app/templates/app/views/layouts/application.html.erb.tt +10 -3
- data/lib/rails/generators/rails/app/templates/bin/dev.tt +1 -0
- data/lib/rails/generators/rails/app/templates/bin/setup.tt +5 -8
- data/lib/rails/generators/rails/app/templates/bin/thrust.tt +4 -0
- data/lib/rails/generators/rails/app/templates/config/databases/mysql.yml.tt +23 -0
- data/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml.tt +23 -0
- data/lib/rails/generators/rails/app/templates/config/databases/sqlite3.yml.tt +40 -0
- data/lib/rails/generators/rails/app/templates/config/databases/trilogy.yml.tt +23 -0
- data/lib/rails/generators/rails/app/templates/config/deploy.yml.tt +128 -0
- data/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt +12 -23
- data/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt +34 -51
- data/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt +5 -19
- data/lib/rails/generators/rails/app/templates/config/initializers/assets.rb.tt +0 -7
- data/lib/rails/generators/rails/app/templates/config/initializers/filter_parameter_logging.rb.tt +1 -1
- data/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_8_0.rb.tt +25 -0
- data/lib/rails/generators/rails/app/templates/config/puma.rb.tt +11 -2
- data/lib/rails/generators/rails/app/templates/config/routes.rb.tt +3 -3
- data/lib/rails/generators/rails/app/templates/docker-entrypoint.tt +4 -3
- data/lib/rails/generators/rails/app/templates/dockerignore.tt +1 -2
- data/lib/rails/generators/rails/app/templates/github/ci.yml.tt +5 -1
- data/lib/rails/generators/rails/app/templates/gitignore.tt +1 -2
- data/lib/rails/generators/rails/app/templates/kamal-secrets.tt +17 -0
- data/lib/rails/generators/rails/app/templates/public/400.html +114 -0
- data/lib/rails/generators/rails/app/templates/public/404.html +113 -66
- data/lib/rails/generators/rails/app/templates/public/406-unsupported-browser.html +113 -65
- data/lib/rails/generators/rails/app/templates/public/422.html +113 -66
- data/lib/rails/generators/rails/app/templates/public/500.html +113 -65
- data/lib/rails/generators/rails/app/templates/public/icon.png +0 -0
- data/lib/rails/generators/rails/app/templates/public/icon.svg +2 -2
- data/lib/rails/generators/rails/authentication/USAGE +6 -0
- data/lib/rails/generators/rails/authentication/authentication_generator.rb +56 -0
- data/lib/rails/generators/rails/authentication/templates/app/controllers/concerns/authentication.rb.tt +55 -0
- data/lib/rails/generators/rails/authentication/templates/app/controllers/passwords_controller.rb.tt +33 -0
- data/lib/rails/generators/rails/authentication/templates/app/controllers/sessions_controller.rb.tt +21 -0
- data/lib/rails/generators/rails/authentication/templates/app/mailers/passwords_mailer.rb.tt +6 -0
- data/lib/rails/generators/rails/authentication/templates/app/models/current.rb.tt +4 -0
- data/lib/rails/generators/rails/authentication/templates/app/models/session.rb.tt +3 -0
- data/lib/rails/generators/rails/authentication/templates/app/models/user.rb.tt +6 -0
- data/lib/rails/generators/rails/authentication/templates/app/views/passwords_mailer/reset.html.erb.tt +4 -0
- data/lib/rails/generators/rails/authentication/templates/app/views/passwords_mailer/reset.text.erb.tt +2 -0
- data/lib/rails/generators/rails/authentication/templates/test/mailers/previews/passwords_mailer_preview.rb.tt +7 -0
- data/lib/rails/generators/rails/credentials/templates/credentials.yml.tt +4 -0
- data/lib/rails/generators/rails/db/system/change/change_generator.rb +1 -1
- data/lib/rails/generators/rails/devcontainer/devcontainer_generator.rb +10 -3
- data/lib/rails/generators/rails/devcontainer/templates/devcontainer/Dockerfile.tt +1 -1
- data/lib/rails/generators/rails/devcontainer/templates/devcontainer/devcontainer.json.tt +1 -1
- data/lib/rails/generators/rails/plugin/plugin_generator.rb +11 -11
- data/lib/rails/generators/rails/plugin/templates/Gemfile.tt +1 -1
- data/lib/rails/generators/rails/plugin/templates/github/ci.yml.tt +1 -1
- data/lib/rails/generators/rails/plugin/templates/test/test_helper.rb.tt +2 -2
- data/lib/rails/generators/rails/scaffold_controller/templates/api_controller.rb.tt +2 -2
- data/lib/rails/generators/rails/scaffold_controller/templates/controller.rb.tt +3 -3
- data/lib/rails/generators/rails/script/USAGE +18 -0
- data/lib/rails/generators/rails/script/script_generator.rb +18 -0
- data/lib/rails/generators/rails/script/templates/script.rb.tt +3 -0
- data/lib/rails/generators/test_unit/authentication/authentication_generator.rb +14 -0
- data/lib/rails/generators/test_unit/authentication/templates/test/fixtures/users.yml.tt +9 -0
- data/lib/rails/generators/test_unit/authentication/templates/test/models/user_test.rb.tt +7 -0
- data/lib/rails/generators.rb +7 -2
- data/lib/rails/info_controller.rb +10 -2
- data/lib/rails/rack/silence_request.rb +33 -0
- data/lib/rails/rack.rb +1 -0
- data/lib/rails/railtie.rb +13 -13
- data/lib/rails/source_annotation_extractor.rb +31 -14
- data/lib/rails/tasks/statistics.rake +13 -28
- data/lib/rails/templates/rails/info/notes.html.erb +65 -0
- data/lib/rails/test_unit/runner.rb +1 -0
- metadata +44 -23
- data/lib/rails/console/app.rb +0 -8
- data/lib/rails/console/helpers.rb +0 -8
- data/lib/rails/generators/rails/app/templates/app/assets/config/manifest.js.tt +0 -2
- data/lib/rails/generators/rails/app/templates/app/channels/application_cable/channel.rb.tt +0 -4
- data/lib/rails/generators/rails/app/templates/app/channels/application_cable/connection.rb.tt +0 -4
- data/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_7_2.rb.tt +0 -70
- data/lib/rails/generators/rails/app/templates/config/initializers/permissions_policy.rb.tt +0 -13
- data/lib/rails/generators/rails/app/templates/test/channels/application_cable/connection_test.rb.tt +0 -13
- data/lib/rails/generators/rails/plugin/templates/rails/dummy_manifest.js.tt +0 -10
- data/lib/rails/generators/rails/plugin/templates/rails/engine_manifest.js.tt +0 -6
- data/lib/rails/generators/rails/plugin/templates/rails/javascripts.js.tt +0 -17
@@ -0,0 +1,128 @@
|
|
1
|
+
# Name of your application. Used to uniquely configure containers.
|
2
|
+
service: <%= app_name %>
|
3
|
+
|
4
|
+
# Name of the container image.
|
5
|
+
image: your-user/<%= app_name %>
|
6
|
+
|
7
|
+
# Deploy to these servers.
|
8
|
+
servers:
|
9
|
+
web:
|
10
|
+
- 192.168.0.1
|
11
|
+
# job:
|
12
|
+
# hosts:
|
13
|
+
# - 192.168.0.1
|
14
|
+
# cmd: bin/jobs
|
15
|
+
|
16
|
+
# Enable SSL auto certification via Let's Encrypt and allow for multiple apps on a single web server.
|
17
|
+
# Remove this section when using multiple web servers and ensure you terminate SSL at your load balancer.
|
18
|
+
#
|
19
|
+
# Note: If using Cloudflare, set encryption mode in SSL/TLS setting to "Full" to enable CF-to-app encryption.
|
20
|
+
proxy:
|
21
|
+
ssl: true
|
22
|
+
host: app.example.com
|
23
|
+
|
24
|
+
# Credentials for your image host.
|
25
|
+
registry:
|
26
|
+
# Specify the registry server, if you're not using Docker Hub
|
27
|
+
# server: registry.digitalocean.com / ghcr.io / ...
|
28
|
+
username: your-user
|
29
|
+
|
30
|
+
# Always use an access token rather than real password when possible.
|
31
|
+
password:
|
32
|
+
- KAMAL_REGISTRY_PASSWORD
|
33
|
+
|
34
|
+
# Inject ENV variables into containers (secrets come from .kamal/secrets).
|
35
|
+
env:
|
36
|
+
secret:
|
37
|
+
- RAILS_MASTER_KEY
|
38
|
+
<% if skip_solid? -%>
|
39
|
+
# clear:
|
40
|
+
# # Set number of cores available to the application on each server (default: 1).
|
41
|
+
# WEB_CONCURRENCY: 2
|
42
|
+
|
43
|
+
# # Match this to any external database server to configure Active Record correctly
|
44
|
+
# DB_HOST: 192.168.0.2
|
45
|
+
|
46
|
+
# # Log everything from Rails
|
47
|
+
# RAILS_LOG_LEVEL: debug
|
48
|
+
<% else -%>
|
49
|
+
clear:
|
50
|
+
# Run the Solid Queue Supervisor inside the web server's Puma process to do jobs.
|
51
|
+
# When you start using multiple servers, you should split out job processing to a dedicated machine.
|
52
|
+
SOLID_QUEUE_IN_PUMA: true
|
53
|
+
|
54
|
+
# Set number of processes dedicated to Solid Queue (default: 1)
|
55
|
+
# JOB_CONCURRENCY: 3
|
56
|
+
|
57
|
+
# Set number of cores available to the application on each server (default: 1).
|
58
|
+
# WEB_CONCURRENCY: 2
|
59
|
+
|
60
|
+
# Match this to any external database server to configure Active Record correctly
|
61
|
+
# Use <%= app_name %>-db for a db accessory server on same machine via local kamal docker network.
|
62
|
+
# DB_HOST: 192.168.0.2
|
63
|
+
|
64
|
+
# Log everything from Rails
|
65
|
+
# RAILS_LOG_LEVEL: debug
|
66
|
+
<% end -%>
|
67
|
+
|
68
|
+
# Aliases are triggered with "bin/kamal <alias>". You can overwrite arguments on invocation:
|
69
|
+
# "bin/kamal logs -r job" will tail logs from the first server in the job section.
|
70
|
+
aliases:
|
71
|
+
console: app exec --interactive --reuse "bin/rails console"
|
72
|
+
shell: app exec --interactive --reuse "bash"
|
73
|
+
logs: app logs -f
|
74
|
+
dbc: app exec --interactive --reuse "bin/rails dbconsole"
|
75
|
+
|
76
|
+
<% unless skip_storage? %>
|
77
|
+
# Use a persistent storage volume for sqlite database files and local Active Storage files.
|
78
|
+
# Recommended to change this to a mounted volume path that is backed up off server.
|
79
|
+
volumes:
|
80
|
+
- "<%= app_name %>_storage:/rails/storage"
|
81
|
+
|
82
|
+
<% end %>
|
83
|
+
# Bridge fingerprinted assets, like JS and CSS, between versions to avoid
|
84
|
+
# hitting 404 on in-flight requests. Combines all files from new and old
|
85
|
+
# version inside the asset_path.
|
86
|
+
asset_path: /rails/public/assets
|
87
|
+
|
88
|
+
# Configure the image builder.
|
89
|
+
builder:
|
90
|
+
arch: amd64
|
91
|
+
|
92
|
+
# # Build image via remote server (useful for faster amd64 builds on arm64 computers)
|
93
|
+
# remote: ssh://docker@docker-builder-server
|
94
|
+
#
|
95
|
+
# # Pass arguments and secrets to the Docker build process
|
96
|
+
# args:
|
97
|
+
# RUBY_VERSION: <%= ENV["RBENV_VERSION"] || ENV["rvm_ruby_string"] || "#{RUBY_ENGINE}-#{RUBY_ENGINE_VERSION}" %>
|
98
|
+
# secrets:
|
99
|
+
# - GITHUB_TOKEN
|
100
|
+
# - RAILS_MASTER_KEY
|
101
|
+
|
102
|
+
# Use a different ssh user than root
|
103
|
+
# ssh:
|
104
|
+
# user: app
|
105
|
+
|
106
|
+
# Use accessory services (secrets come from .kamal/secrets).
|
107
|
+
# accessories:
|
108
|
+
# db:
|
109
|
+
# image: mysql:8.0
|
110
|
+
# host: 192.168.0.2
|
111
|
+
# # Change to 3306 to expose port to the world instead of just local network.
|
112
|
+
# port: "127.0.0.1:3306:3306"
|
113
|
+
# env:
|
114
|
+
# clear:
|
115
|
+
# MYSQL_ROOT_HOST: '%'
|
116
|
+
# secret:
|
117
|
+
# - MYSQL_ROOT_PASSWORD
|
118
|
+
# files:
|
119
|
+
# - config/mysql/production.cnf:/etc/mysql/my.cnf
|
120
|
+
# - db/production.sql:/docker-entrypoint-initdb.d/setup.sql
|
121
|
+
# directories:
|
122
|
+
# - data:/var/lib/mysql
|
123
|
+
# redis:
|
124
|
+
# image: redis:7.0
|
125
|
+
# host: 192.168.0.2
|
126
|
+
# port: 6379
|
127
|
+
# directories:
|
128
|
+
# - data:/data
|
@@ -3,9 +3,7 @@ require "active_support/core_ext/integer/time"
|
|
3
3
|
Rails.application.configure do
|
4
4
|
# Settings specified here will take precedence over those in config/application.rb.
|
5
5
|
|
6
|
-
#
|
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.
|
9
7
|
config.enable_reloading = true
|
10
8
|
|
11
9
|
# Do not eager load code on boot.
|
@@ -17,21 +15,20 @@ Rails.application.configure do
|
|
17
15
|
# Enable server timing.
|
18
16
|
config.server_timing = true
|
19
17
|
|
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.
|
22
20
|
if Rails.root.join("tmp/caching-dev.txt").exist?
|
23
21
|
<%- unless options.api? -%>
|
24
22
|
config.action_controller.perform_caching = true
|
25
23
|
config.action_controller.enable_fragment_cache_logging = true
|
26
|
-
|
27
24
|
<%- end -%>
|
28
|
-
config.
|
29
|
-
config.public_file_server.headers = { "Cache-Control" => "public, max-age=#{2.days.to_i}" }
|
25
|
+
config.public_file_server.headers = { "cache-control" => "public, max-age=#{2.days.to_i}" }
|
30
26
|
else
|
31
27
|
config.action_controller.perform_caching = false
|
32
|
-
|
33
|
-
config.cache_store = :null_store
|
34
28
|
end
|
29
|
+
|
30
|
+
# Change to :null_store to avoid any caching.
|
31
|
+
config.cache_store = :memory_store
|
35
32
|
<%- unless skip_active_storage? -%>
|
36
33
|
|
37
34
|
# Store uploaded files on the local file system (see config/storage.yml for options).
|
@@ -42,22 +39,16 @@ Rails.application.configure do
|
|
42
39
|
# Don't care if the mailer can't send.
|
43
40
|
config.action_mailer.raise_delivery_errors = false
|
44
41
|
|
45
|
-
#
|
46
|
-
# caching is enabled.
|
42
|
+
# Make template changes take effect immediately.
|
47
43
|
config.action_mailer.perform_caching = false
|
48
44
|
|
45
|
+
# Set localhost to be used by links generated in mailer templates.
|
49
46
|
config.action_mailer.default_url_options = { host: "localhost", port: 3000 }
|
50
47
|
<%- end -%>
|
51
48
|
|
52
49
|
# Print deprecation notices to the Rails logger.
|
53
50
|
config.active_support.deprecation = :log
|
54
51
|
|
55
|
-
# Raise exceptions for disallowed deprecations.
|
56
|
-
config.active_support.disallowed_deprecation = :raise
|
57
|
-
|
58
|
-
# Tell Active Support which deprecation messages to disallow.
|
59
|
-
config.active_support.disallowed_deprecation_warnings = []
|
60
|
-
|
61
52
|
<%- unless options.skip_active_record? -%>
|
62
53
|
# Raise an error on page load if there are pending migrations.
|
63
54
|
config.active_record.migration_error = :page_load
|
@@ -65,16 +56,14 @@ Rails.application.configure do
|
|
65
56
|
# Highlight code that triggered database queries in logs.
|
66
57
|
config.active_record.verbose_query_logs = true
|
67
58
|
|
59
|
+
# Append comments with runtime information tags to SQL queries in logs.
|
60
|
+
config.active_record.query_log_tags_enabled = true
|
61
|
+
|
68
62
|
<%- end -%>
|
69
63
|
<%- unless options[:skip_active_job] -%>
|
70
64
|
# Highlight code that enqueued background job in logs.
|
71
65
|
config.active_job.verbose_enqueue_logs = true
|
72
66
|
|
73
|
-
<%- end -%>
|
74
|
-
<%- unless skip_sprockets? -%>
|
75
|
-
# Suppress logger output for asset requests.
|
76
|
-
config.assets.quiet = true
|
77
|
-
|
78
67
|
<%- end -%>
|
79
68
|
# Raises error for missing translations.
|
80
69
|
# config.i18n.raise_on_missing_translations = true
|
@@ -6,55 +6,30 @@ Rails.application.configure do
|
|
6
6
|
# Code is not reloaded between requests.
|
7
7
|
config.enable_reloading = false
|
8
8
|
|
9
|
-
# Eager load code on boot
|
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).
|
13
10
|
config.eager_load = true
|
14
11
|
|
15
|
-
# Full error reports are disabled
|
12
|
+
# Full error reports are disabled.
|
16
13
|
config.consider_all_requests_local = false
|
17
14
|
<%- unless options.api? -%>
|
15
|
+
|
16
|
+
# Turn on fragment caching in view templates.
|
18
17
|
config.action_controller.perform_caching = true
|
19
18
|
<%- end -%>
|
20
19
|
|
21
|
-
#
|
22
|
-
|
23
|
-
# config.require_master_key = true
|
24
|
-
|
25
|
-
# Disable serving static files from `public/`, relying on NGINX/Apache to do so instead.
|
26
|
-
# config.public_file_server.enabled = false
|
27
|
-
|
28
|
-
<%- unless skip_sprockets? -%>
|
29
|
-
# Compress CSS using a preprocessor.
|
30
|
-
# config.assets.css_compressor = :sass
|
20
|
+
# Cache assets for far-future expiry since they are all digest stamped.
|
21
|
+
config.public_file_server.headers = { "cache-control" => "public, max-age=#{1.year.to_i}" }
|
31
22
|
|
32
|
-
# Do not fall back to assets pipeline if a precompiled asset is missed.
|
33
|
-
config.assets.compile = false
|
34
|
-
|
35
|
-
<%- end -%>
|
36
23
|
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
37
24
|
# config.asset_host = "http://assets.example.com"
|
38
25
|
|
39
|
-
# Specifies the header that your server uses for sending files.
|
40
|
-
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for Apache
|
41
|
-
# config.action_dispatch.x_sendfile_header = "X-Accel-Redirect" # for NGINX
|
42
|
-
|
43
26
|
<%- unless skip_active_storage? -%>
|
44
27
|
# Store uploaded files on the local file system (see config/storage.yml for options).
|
45
28
|
config.active_storage.service = :local
|
46
29
|
|
47
|
-
<%- end -%>
|
48
|
-
<%- unless skip_action_cable? -%>
|
49
|
-
# Mount Action Cable outside main process or domain.
|
50
|
-
# config.action_cable.mount_path = nil
|
51
|
-
# config.action_cable.url = "wss://example.com/cable"
|
52
|
-
# config.action_cable.allowed_request_origins = [ "http://example.com", /http:\/\/example.*/ ]
|
53
|
-
|
54
30
|
<%- end -%>
|
55
31
|
# Assume all access to the app is happening through a SSL-terminating reverse proxy.
|
56
|
-
|
57
|
-
# config.assume_ssl = true
|
32
|
+
config.assume_ssl = true
|
58
33
|
|
59
34
|
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
60
35
|
config.force_ssl = true
|
@@ -62,48 +37,55 @@ Rails.application.configure do
|
|
62
37
|
# Skip http-to-https redirect for the default health check endpoint.
|
63
38
|
# config.ssl_options = { redirect: { exclude: ->(request) { request.path == "/up" } } }
|
64
39
|
|
65
|
-
# Log to STDOUT
|
66
|
-
config.logger = ActiveSupport::Logger.new(STDOUT)
|
67
|
-
.tap { |logger| logger.formatter = ::Logger::Formatter.new }
|
68
|
-
.then { |logger| ActiveSupport::TaggedLogging.new(logger) }
|
69
|
-
|
70
|
-
# Prepend all log lines with the following tags.
|
40
|
+
# Log to STDOUT with the current request id as a default log tag.
|
71
41
|
config.log_tags = [ :request_id ]
|
42
|
+
config.logger = ActiveSupport::TaggedLogging.logger(STDOUT)
|
72
43
|
|
73
|
-
# "
|
74
|
-
# information to avoid inadvertent exposure of personally identifiable information (PII). If you
|
75
|
-
# want to log everything, set the level to "debug".
|
44
|
+
# Change to "debug" to log everything (including potentially personally-identifiable information!)
|
76
45
|
config.log_level = ENV.fetch("RAILS_LOG_LEVEL", "info")
|
77
46
|
|
78
|
-
#
|
47
|
+
# Prevent health checks from clogging up the logs.
|
48
|
+
config.silence_healthcheck_path = "/up"
|
49
|
+
|
50
|
+
# Don't log any deprecations.
|
51
|
+
config.active_support.report_deprecations = false
|
52
|
+
|
53
|
+
# Replace the default in-process memory cache store with a durable alternative.
|
79
54
|
# config.cache_store = :mem_cache_store
|
80
55
|
|
81
56
|
<%- unless options[:skip_active_job] -%>
|
82
|
-
#
|
57
|
+
# Replace the default in-process and non-durable queuing backend for Active Job.
|
83
58
|
# config.active_job.queue_adapter = :resque
|
84
|
-
# config.active_job.queue_name_prefix = "<%= app_name %>_production"
|
85
59
|
|
86
60
|
<%- end -%>
|
87
61
|
<%- unless options.skip_action_mailer? -%>
|
88
|
-
# Disable caching for Action Mailer templates even if Action Controller
|
89
|
-
# caching is enabled.
|
90
|
-
config.action_mailer.perform_caching = false
|
91
|
-
|
92
62
|
# Ignore bad email addresses and do not raise email delivery errors.
|
93
63
|
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
|
94
64
|
# config.action_mailer.raise_delivery_errors = false
|
95
65
|
|
66
|
+
# Set host to be used by links generated in mailer templates.
|
67
|
+
config.action_mailer.default_url_options = { host: "example.com" }
|
68
|
+
|
69
|
+
# Specify outgoing SMTP server. Remember to add smtp/* credentials via rails credentials:edit.
|
70
|
+
# config.action_mailer.smtp_settings = {
|
71
|
+
# user_name: Rails.application.credentials.dig(:smtp, :user_name),
|
72
|
+
# password: Rails.application.credentials.dig(:smtp, :password),
|
73
|
+
# address: "smtp.example.com",
|
74
|
+
# port: 587,
|
75
|
+
# authentication: :plain
|
76
|
+
# }
|
77
|
+
|
96
78
|
<%- end -%>
|
97
79
|
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
98
80
|
# the I18n.default_locale when a translation cannot be found).
|
99
81
|
config.i18n.fallbacks = true
|
100
|
-
|
101
|
-
# Don't log any deprecations.
|
102
|
-
config.active_support.report_deprecations = false
|
103
82
|
<%- unless options.skip_active_record? -%>
|
104
83
|
|
105
84
|
# Do not dump schema after migrations.
|
106
85
|
config.active_record.dump_schema_after_migration = false
|
86
|
+
|
87
|
+
# Only use :id for inspections in production.
|
88
|
+
config.active_record.attributes_for_inspect = [ :id ]
|
107
89
|
<%- end -%>
|
108
90
|
|
109
91
|
# Enable DNS rebinding protection and other `Host` header attacks.
|
@@ -111,6 +93,7 @@ Rails.application.configure do
|
|
111
93
|
# "example.com", # Allow requests from example.com
|
112
94
|
# /.*\.example\.com/ # Allow requests from subdomains like `www.example.com`
|
113
95
|
# ]
|
96
|
+
#
|
114
97
|
# Skip DNS rebinding protection for the default health check endpoint.
|
115
98
|
# config.host_authorization = { exclude: ->(request) { request.path == "/up" } }
|
116
99
|
end
|
@@ -1,5 +1,3 @@
|
|
1
|
-
require "active_support/core_ext/integer/time"
|
2
|
-
|
3
1
|
# The test environment is used exclusively to run your application's
|
4
2
|
# test suite. You never need to work with it otherwise. Remember that
|
5
3
|
# your test database is "scratch space" for the test suite and is wiped
|
@@ -17,12 +15,11 @@ Rails.application.configure do
|
|
17
15
|
# loading is working properly before deploying your code.
|
18
16
|
config.eager_load = ENV["CI"].present?
|
19
17
|
|
20
|
-
# Configure public file server for tests with
|
21
|
-
config.public_file_server.headers = { "
|
18
|
+
# Configure public file server for tests with cache-control for performance.
|
19
|
+
config.public_file_server.headers = { "cache-control" => "public, max-age=3600" }
|
22
20
|
|
23
|
-
# Show full error reports
|
21
|
+
# Show full error reports.
|
24
22
|
config.consider_all_requests_local = true
|
25
|
-
config.action_controller.perform_caching = false
|
26
23
|
config.cache_store = :null_store
|
27
24
|
|
28
25
|
# Render exception templates for rescuable exceptions and raise for other exceptions.
|
@@ -37,29 +34,18 @@ Rails.application.configure do
|
|
37
34
|
|
38
35
|
<%- end -%>
|
39
36
|
<%- unless options.skip_action_mailer? -%>
|
40
|
-
# Disable caching for Action Mailer templates even if Action Controller
|
41
|
-
# caching is enabled.
|
42
|
-
config.action_mailer.perform_caching = false
|
43
|
-
|
44
37
|
# Tell Action Mailer not to deliver emails to the real world.
|
45
38
|
# The :test delivery method accumulates sent emails in the
|
46
39
|
# ActionMailer::Base.deliveries array.
|
47
40
|
config.action_mailer.delivery_method = :test
|
48
41
|
|
49
|
-
#
|
50
|
-
|
51
|
-
config.action_mailer.default_url_options = { host: "www.example.com" }
|
42
|
+
# Set host to be used by links generated in mailer templates.
|
43
|
+
config.action_mailer.default_url_options = { host: "example.com" }
|
52
44
|
|
53
45
|
<%- end -%>
|
54
46
|
# Print deprecation notices to the stderr.
|
55
47
|
config.active_support.deprecation = :stderr
|
56
48
|
|
57
|
-
# Raise exceptions for disallowed deprecations.
|
58
|
-
config.active_support.disallowed_deprecation = :raise
|
59
|
-
|
60
|
-
# Tell Active Support which deprecation messages to disallow.
|
61
|
-
config.active_support.disallowed_deprecation_warnings = []
|
62
|
-
|
63
49
|
# Raises error for missing translations.
|
64
50
|
# config.i18n.raise_on_missing_translations = true
|
65
51
|
|
@@ -5,10 +5,3 @@ Rails.application.config.assets.version = "1.0"
|
|
5
5
|
|
6
6
|
# Add additional assets to the asset load path.
|
7
7
|
# Rails.application.config.assets.paths << Emoji.images_path
|
8
|
-
<% if options[:asset_pipeline] == "sprockets" -%>
|
9
|
-
|
10
|
-
# Precompile additional assets.
|
11
|
-
# application.js, application.css, and all non-JS/CSS in the app/assets
|
12
|
-
# folder are already added.
|
13
|
-
# Rails.application.config.assets.precompile += %w[ admin.js admin.css ]
|
14
|
-
<% end -%>
|
data/lib/rails/generators/rails/app/templates/config/initializers/filter_parameter_logging.rb.tt
CHANGED
@@ -4,5 +4,5 @@
|
|
4
4
|
# Use this to limit dissemination of sensitive information.
|
5
5
|
# See the ActiveSupport::ParameterFilter documentation for supported notations and behaviors.
|
6
6
|
Rails.application.config.filter_parameters += [
|
7
|
-
:passw, :email, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn
|
7
|
+
:passw, :email, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn, :cvv, :cvc
|
8
8
|
]
|
data/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_8_0.rb.tt
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
#
|
3
|
+
# This file eases your Rails 8.0 framework defaults upgrade.
|
4
|
+
#
|
5
|
+
# Uncomment each configuration one by one to switch to the new default.
|
6
|
+
# Once your application is ready to run with all new defaults, you can remove
|
7
|
+
# this file and set the `config.load_defaults` to `8.0`.
|
8
|
+
#
|
9
|
+
# Read the Guide for Upgrading Ruby on Rails for more info on each option.
|
10
|
+
# https://guides.rubyonrails.org/upgrading_ruby_on_rails.html
|
11
|
+
|
12
|
+
###
|
13
|
+
# Specifies whether `to_time` methods preserve the UTC offset of their receivers or preserves the timezone.
|
14
|
+
# If set to `:zone`, `to_time` methods will use the timezone of their receivers.
|
15
|
+
# If set to `:offset`, `to_time` methods will use the UTC offset.
|
16
|
+
# If `false`, `to_time` methods will convert to the local system UTC offset instead.
|
17
|
+
#++
|
18
|
+
# Rails.application.config.active_support.to_time_preserves_timezone = :zone
|
19
|
+
|
20
|
+
###
|
21
|
+
# When both `If-Modified-Since` and `If-None-Match` are provided by the client
|
22
|
+
# only consider `If-None-Match` as specified by RFC 7232 Section 6.
|
23
|
+
# If set to `false` both conditions need to be satisfied.
|
24
|
+
#++
|
25
|
+
# Rails.application.config.action_dispatch.strict_freshness = true
|
@@ -1,13 +1,17 @@
|
|
1
1
|
# This configuration file will be evaluated by Puma. The top-level methods that
|
2
2
|
# are invoked here are part of Puma's configuration DSL. For more information
|
3
3
|
# about methods provided by the DSL, see https://puma.io/puma/Puma/DSL.html.
|
4
|
-
|
4
|
+
#
|
5
5
|
# Puma starts a configurable number of processes (workers) and each process
|
6
6
|
# serves each request in a thread from an internal thread pool.
|
7
7
|
#
|
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
|
+
#
|
8
12
|
# The ideal number of threads per worker depends both on how much time the
|
9
13
|
# application spends waiting for IO operations and on how much you wish to
|
10
|
-
#
|
14
|
+
# prioritize throughput over latency.
|
11
15
|
#
|
12
16
|
# As a rule of thumb, increasing the number of threads will increase how much
|
13
17
|
# traffic a given process can handle (throughput), but due to CRuby's
|
@@ -29,6 +33,11 @@ port ENV.fetch("PORT", 3000)
|
|
29
33
|
# Allow puma to be restarted by `bin/rails restart` command.
|
30
34
|
plugin :tmp_restart
|
31
35
|
|
36
|
+
<% unless skip_solid? -%>
|
37
|
+
# Run the Solid Queue supervisor inside of Puma for single-server deployments
|
38
|
+
plugin :solid_queue if ENV["SOLID_QUEUE_IN_PUMA"]
|
39
|
+
|
40
|
+
<% end -%>
|
32
41
|
# Specify the PID file. Defaults to tmp/pids/server.pid in development.
|
33
42
|
# In other environments, only set the PID file if requested.
|
34
43
|
pidfile ENV["PIDFILE"] if ENV["PIDFILE"]
|
@@ -6,9 +6,9 @@ Rails.application.routes.draw do
|
|
6
6
|
get "up" => "rails/health#show", as: :rails_health_check
|
7
7
|
|
8
8
|
<%- unless options.api? -%>
|
9
|
-
# Render dynamic PWA files from app/views/pwa/*
|
10
|
-
get "
|
11
|
-
get "
|
9
|
+
# Render dynamic PWA files from app/views/pwa/* (remember to link manifest in application.html.erb)
|
10
|
+
# get "manifest" => "rails/pwa#manifest", as: :pwa_manifest
|
11
|
+
# get "service-worker" => "rails/pwa#service_worker", as: :pwa_service_worker
|
12
12
|
|
13
13
|
<%- end -%>
|
14
14
|
# Defines the root path route ("/")
|
@@ -1,13 +1,14 @@
|
|
1
1
|
#!/bin/bash -e
|
2
2
|
|
3
3
|
# Enable jemalloc for reduced memory usage and latency.
|
4
|
-
if [ -z "${LD_PRELOAD+x}" ]
|
5
|
-
|
4
|
+
if [ -z "${LD_PRELOAD+x}" ]; then
|
5
|
+
LD_PRELOAD=$(find /usr/lib -name libjemalloc.so.2 -print -quit)
|
6
|
+
export LD_PRELOAD
|
6
7
|
fi
|
7
8
|
|
8
9
|
<% unless skip_active_record? -%>
|
9
10
|
# If running the rails server then create or migrate existing database
|
10
|
-
if [ "${1}" == "./bin/rails" ] && [ "${
|
11
|
+
if [ "${@: -2:1}" == "./bin/rails" ] && [ "${@: -1:1}" == "server" ]; then
|
11
12
|
./bin/rails db:prepare
|
12
13
|
fi
|
13
14
|
|
@@ -24,7 +24,7 @@ jobs:
|
|
24
24
|
run: bin/brakeman --no-pager
|
25
25
|
|
26
26
|
<% end -%>
|
27
|
-
<%- if options[:javascript] == "importmap" -%>
|
27
|
+
<%- if options[:javascript] == "importmap" && !options[:api] -%>
|
28
28
|
scan_js:
|
29
29
|
runs-on: ubuntu-latest
|
30
30
|
|
@@ -126,7 +126,11 @@ jobs:
|
|
126
126
|
DATABASE_URL: postgres://postgres:postgres@localhost:5432
|
127
127
|
<%- end -%>
|
128
128
|
# REDIS_URL: redis://localhost:6379/0
|
129
|
+
<%- if options[:api] -%>
|
130
|
+
run: bin/rails db:test:prepare test
|
131
|
+
<%- else -%>
|
129
132
|
run: bin/rails db:test:prepare test test:system
|
133
|
+
<%- end -%>
|
130
134
|
|
131
135
|
- name: Keep screenshots from failed system tests
|
132
136
|
uses: actions/upload-artifact@v4
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# Secrets defined here are available for reference under registry/password, env/secret, builder/secrets,
|
2
|
+
# and accessories/*/env/secret in config/deploy.yml. All secrets should be pulled from either
|
3
|
+
# password manager, ENV, or a file. DO NOT ENTER RAW CREDENTIALS HERE! This file needs to be safe for git.
|
4
|
+
|
5
|
+
# Example of extracting secrets from 1password (or another compatible pw manager)
|
6
|
+
# SECRETS=$(kamal secrets fetch --adapter 1password --account your-account --from Vault/Item KAMAL_REGISTRY_PASSWORD RAILS_MASTER_KEY)
|
7
|
+
# KAMAL_REGISTRY_PASSWORD=$(kamal secrets extract KAMAL_REGISTRY_PASSWORD ${SECRETS})
|
8
|
+
# RAILS_MASTER_KEY=$(kamal secrets extract RAILS_MASTER_KEY ${SECRETS})
|
9
|
+
|
10
|
+
# Use a GITHUB_TOKEN if private repositories are needed for the image
|
11
|
+
# GITHUB_TOKEN=$(gh config get -h github.com oauth_token)
|
12
|
+
|
13
|
+
# Grab the registry password from ENV
|
14
|
+
KAMAL_REGISTRY_PASSWORD=$KAMAL_REGISTRY_PASSWORD
|
15
|
+
|
16
|
+
# Improve security by using a password manager. Never check config/master.key into git!
|
17
|
+
RAILS_MASTER_KEY=$(cat config/master.key)
|