railties 7.2.3 → 8.0.5
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 +168 -256
- data/lib/minitest/rails_plugin.rb +8 -1
- data/lib/rails/application/bootstrap.rb +0 -1
- data/lib/rails/application/configuration.rb +17 -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 +17 -3
- data/lib/rails/application.rb +10 -1
- data/lib/rails/application_controller.rb +2 -0
- data/lib/rails/backtrace_cleaner.rb +2 -2
- 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 +5 -9
- data/lib/rails/commands/console/irb_console.rb +3 -6
- 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 +111 -0
- data/lib/rails/engine.rb +10 -6
- data/lib/rails/gem_version.rb +3 -3
- data/lib/rails/generators/actions.rb +3 -3
- data/lib/rails/generators/app_base.rb +76 -56
- data/lib/rails/generators/base.rb +0 -4
- data/lib/rails/generators/bundle_helper.rb +34 -0
- 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 +30 -30
- data/lib/rails/generators/rails/app/templates/Dockerfile.tt +23 -6
- data/lib/rails/generators/rails/app/templates/Gemfile.tt +27 -12
- 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 +24 -1
- 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 +50 -0
- data/lib/rails/generators/rails/app/templates/config/databases/trilogy.yml.tt +30 -5
- 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 +31 -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 +30 -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 +7 -2
- data/lib/rails/generators/rails/app/templates/github/ci.yml.tt +12 -6
- 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/app/templates/ruby-version.tt +1 -1
- data/lib/rails/generators/rails/authentication/USAGE +6 -0
- data/lib/rails/generators/rails/authentication/authentication_generator.rb +60 -0
- data/lib/rails/generators/rails/authentication/templates/app/channels/application_cable/connection.rb.tt +16 -0
- data/lib/rails/generators/rails/authentication/templates/app/controllers/concerns/authentication.rb.tt +52 -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/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 +12 -2
- data/lib/rails/generators/rails/devcontainer/templates/devcontainer/Dockerfile.tt +1 -1
- data/lib/rails/generators/rails/devcontainer/templates/devcontainer/devcontainer.json.tt +5 -5
- data/lib/rails/generators/rails/plugin/plugin_generator.rb +7 -9
- data/lib/rails/generators/rails/plugin/templates/Gemfile.tt +1 -1
- data/lib/rails/generators/rails/plugin/templates/github/ci.yml.tt +3 -3
- 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 +18 -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/mailers/previews/passwords_mailer_preview.rb.tt +7 -0
- data/lib/rails/generators/test_unit/authentication/templates/test/models/user_test.rb.tt +7 -0
- data/lib/rails/generators.rb +1 -0
- data/lib/rails/health_controller.rb +2 -0
- data/lib/rails/info.rb +2 -1
- data/lib/rails/info_controller.rb +10 -4
- data/lib/rails/rack/silence_request.rb +33 -0
- data/lib/rails/rack.rb +1 -0
- data/lib/rails/source_annotation_extractor.rb +37 -16
- data/lib/rails/tasks/statistics.rake +13 -28
- data/lib/rails/templates/rails/info/notes.html.erb +65 -0
- data/lib/rails/templates/rails/mailers/email.html.erb +1 -1
- data/lib/rails/test_unit/line_filtering.rb +24 -3
- data/lib/rails/test_unit/reporter.rb +8 -4
- data/lib/rails/test_unit/runner.rb +1 -0
- metadata +46 -37
- 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
|
@@ -5,20 +5,40 @@ source "https://rubygems.org"
|
|
|
5
5
|
<% end -%>
|
|
6
6
|
<% unless options.minimal? -%>
|
|
7
7
|
|
|
8
|
-
# Use Kredis to get higher-level data types in Redis [https://github.com/rails/kredis]
|
|
9
|
-
# gem "kredis"
|
|
10
|
-
|
|
11
8
|
# Use Active Model has_secure_password [https://guides.rubyonrails.org/active_model_basics.html#securepassword]
|
|
12
9
|
# gem "bcrypt", "~> 3.1.7"
|
|
13
10
|
<% end -%>
|
|
14
11
|
|
|
15
12
|
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
|
|
16
|
-
gem "tzinfo-data", platforms: %i[
|
|
13
|
+
gem "tzinfo-data", platforms: %i[ windows jruby ]
|
|
14
|
+
<% unless options.skip_solid? -%>
|
|
15
|
+
|
|
16
|
+
<% if options.skip_action_cable? -%>
|
|
17
|
+
# Use the database-backed adapters for Rails.cache and Active Job
|
|
18
|
+
<% else -%>
|
|
19
|
+
# Use the database-backed adapters for Rails.cache, Active Job, and Action Cable
|
|
20
|
+
<% end -%>
|
|
21
|
+
gem "solid_cache"
|
|
22
|
+
gem "solid_queue"
|
|
23
|
+
<% unless options.skip_action_cable? -%>
|
|
24
|
+
gem "solid_cable"
|
|
25
|
+
<% end -%>
|
|
26
|
+
<% end -%>
|
|
17
27
|
<% if depend_on_bootsnap? -%>
|
|
18
28
|
|
|
19
29
|
# Reduces boot times through caching; required in config/boot.rb
|
|
20
30
|
gem "bootsnap", require: false
|
|
21
31
|
<% end -%>
|
|
32
|
+
<% unless options.skip_kamal? -%>
|
|
33
|
+
|
|
34
|
+
# Deploy this application anywhere as a Docker container [https://kamal-deploy.org]
|
|
35
|
+
gem "kamal", require: false
|
|
36
|
+
<% end -%>
|
|
37
|
+
<% unless options.skip_thruster? -%>
|
|
38
|
+
|
|
39
|
+
# Add HTTP asset caching/compression and X-Sendfile acceleration to Puma [https://github.com/basecamp/thruster/]
|
|
40
|
+
gem "thruster", require: false
|
|
41
|
+
<% end -%>
|
|
22
42
|
<% unless skip_active_storage? -%>
|
|
23
43
|
|
|
24
44
|
# Use Active Storage variants [https://guides.rubyonrails.org/active_storage_overview.html#transforming-images]
|
|
@@ -33,7 +53,7 @@ gem "bootsnap", require: false
|
|
|
33
53
|
|
|
34
54
|
group :development, :test do
|
|
35
55
|
# See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
|
|
36
|
-
gem "debug", platforms: %i[ mri
|
|
56
|
+
gem "debug", platforms: %i[ mri windows ], require: "debug/prelude"
|
|
37
57
|
<%- unless options.skip_brakeman? -%>
|
|
38
58
|
|
|
39
59
|
# Static analysis for security vulnerabilities [https://brakemanscanner.org/]
|
|
@@ -46,20 +66,15 @@ group :development, :test do
|
|
|
46
66
|
<%- end -%>
|
|
47
67
|
end
|
|
48
68
|
<% end -%>
|
|
49
|
-
|
|
50
69
|
<%- unless options.api? || options.skip_dev_gems? -%>
|
|
70
|
+
|
|
51
71
|
group :development do
|
|
52
72
|
# Use console on exceptions pages [https://github.com/rails/web-console]
|
|
53
73
|
gem "web-console"
|
|
54
|
-
<%- if RUBY_VERSION < "3.2" -%>
|
|
55
|
-
|
|
56
|
-
# Highlight the fine-grained location where an error occurred [https://github.com/ruby/error_highlight]
|
|
57
|
-
gem "error_highlight", ">= 0.4.0", platforms: [ :ruby ]
|
|
58
|
-
<%- end -%>
|
|
59
74
|
end
|
|
60
75
|
<%- end -%>
|
|
61
|
-
|
|
62
76
|
<%- if depends_on_system_test? -%>
|
|
77
|
+
|
|
63
78
|
group :test do
|
|
64
79
|
# Use system testing [https://guides.rubyonrails.org/testing.html#system-testing]
|
|
65
80
|
gem "capybara"
|
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* This is a manifest file that'll be compiled into application.css
|
|
3
|
-
* listed below.
|
|
2
|
+
* This is a manifest file that'll be compiled into application.css.
|
|
4
3
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* With Propshaft, assets are served efficiently without preprocessing steps. You can still include
|
|
5
|
+
* application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
|
|
6
|
+
* cascading order, meaning styles declared later in the document or manifest will override earlier ones,
|
|
7
|
+
* depending on specificity.
|
|
7
8
|
*
|
|
8
|
-
*
|
|
9
|
-
* compiled file so the styles you add here take precedence over styles defined in any other CSS
|
|
10
|
-
* files in this directory. Styles in this file should be added after the last require_* statement.
|
|
11
|
-
* It is generally better to create a new file per style scope.
|
|
12
|
-
*
|
|
13
|
-
*= require_tree .
|
|
14
|
-
*= require_self
|
|
9
|
+
* Consider organizing styles into separate files for maintainability.
|
|
15
10
|
*/
|
|
@@ -4,19 +4,26 @@
|
|
|
4
4
|
<title><%%= content_for(:title) || "<%= app_name.titleize %>" %></title>
|
|
5
5
|
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
6
6
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
|
7
|
+
<meta name="mobile-web-app-capable" content="yes">
|
|
7
8
|
<%%= csrf_meta_tags %>
|
|
8
9
|
<%%= csp_meta_tag %>
|
|
9
10
|
|
|
10
11
|
<%%= yield :head %>
|
|
11
12
|
|
|
12
|
-
|
|
13
|
+
<%%# Enable PWA manifest for installable apps (make sure to enable in config/routes.rb too!) %>
|
|
14
|
+
<%%#= tag.link rel: "manifest", href: pwa_manifest_path(format: :json) %>
|
|
15
|
+
|
|
13
16
|
<link rel="icon" href="/icon.png" type="image/png">
|
|
14
17
|
<link rel="icon" href="/icon.svg" type="image/svg+xml">
|
|
15
18
|
<link rel="apple-touch-icon" href="/icon.png">
|
|
19
|
+
|
|
20
|
+
<%- style_link_target = options[:skip_asset_pipeline] ? "\"application\"" : ":app" -%>
|
|
16
21
|
<%- if options[:skip_hotwire] || options[:skip_javascript] -%>
|
|
17
|
-
|
|
22
|
+
<%%# Includes all stylesheet files in app/assets/stylesheets %>
|
|
23
|
+
<%%= stylesheet_link_tag <%= style_link_target %> %>
|
|
18
24
|
<%- else -%>
|
|
19
|
-
|
|
25
|
+
<%%# Includes all stylesheet files in app/assets/stylesheets %>
|
|
26
|
+
<%%= stylesheet_link_tag <%= style_link_target %>, "data-turbo-track": "reload" %>
|
|
20
27
|
<%- end -%>
|
|
21
28
|
</head>
|
|
22
29
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
exec "./bin/rails", "server", *ARGV
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
require "fileutils"
|
|
2
2
|
|
|
3
3
|
APP_ROOT = File.expand_path("..", __dir__)
|
|
4
|
-
APP_NAME = "<%= app_name.dasherize %>"
|
|
5
4
|
|
|
6
5
|
def system!(*args)
|
|
7
6
|
system(*args, exception: true)
|
|
@@ -13,7 +12,6 @@ FileUtils.chdir APP_ROOT do
|
|
|
13
12
|
# Add necessary setup steps to this file.
|
|
14
13
|
|
|
15
14
|
puts "== Installing dependencies =="
|
|
16
|
-
system! "gem install bundler --conservative"
|
|
17
15
|
system("bundle check") || system!("bundle install")
|
|
18
16
|
<% if using_node? -%>
|
|
19
17
|
|
|
@@ -38,10 +36,9 @@ FileUtils.chdir APP_ROOT do
|
|
|
38
36
|
puts "\n== Removing old logs and tempfiles =="
|
|
39
37
|
system! "bin/rails log:clear tmp:clear"
|
|
40
38
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
# system "curl -Is https://#{APP_NAME}.test/up | head -n 1"
|
|
39
|
+
unless ARGV.include?("--skip-server")
|
|
40
|
+
puts "\n== Starting development server =="
|
|
41
|
+
STDOUT.flush # flush the output before exec(2) so that it displays
|
|
42
|
+
exec "bin/dev"
|
|
43
|
+
end
|
|
47
44
|
end
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# MySQL. Versions 5.
|
|
1
|
+
# MySQL. Versions 5.6.4 and up are supported.
|
|
2
2
|
#
|
|
3
3
|
# Install the MySQL driver
|
|
4
4
|
# gem install mysql2
|
|
@@ -52,8 +52,31 @@ test:
|
|
|
52
52
|
# Read https://guides.rubyonrails.org/configuring.html#configuring-a-database
|
|
53
53
|
# for a full overview on how database connection configuration can be specified.
|
|
54
54
|
#
|
|
55
|
+
<%- if options.skip_solid? -%>
|
|
55
56
|
production:
|
|
56
57
|
<<: *default
|
|
57
58
|
database: <%= app_name %>_production
|
|
58
59
|
username: <%= app_name %>
|
|
59
60
|
password: <%%= ENV["<%= app_name.upcase %>_DATABASE_PASSWORD"] %>
|
|
61
|
+
<%- else -%>
|
|
62
|
+
production:
|
|
63
|
+
primary: &primary_production
|
|
64
|
+
<<: *default
|
|
65
|
+
database: <%= app_name %>_production
|
|
66
|
+
username: <%= app_name %>
|
|
67
|
+
password: <%%= ENV["<%= app_name.upcase %>_DATABASE_PASSWORD"] %>
|
|
68
|
+
cache:
|
|
69
|
+
<<: *primary_production
|
|
70
|
+
database: <%= app_name %>_production_cache
|
|
71
|
+
migrations_paths: db/cache_migrate
|
|
72
|
+
queue:
|
|
73
|
+
<<: *primary_production
|
|
74
|
+
database: <%= app_name %>_production_queue
|
|
75
|
+
migrations_paths: db/queue_migrate
|
|
76
|
+
<%- unless options.skip_action_cable? -%>
|
|
77
|
+
cable:
|
|
78
|
+
<<: *primary_production
|
|
79
|
+
database: <%= app_name %>_production_cable
|
|
80
|
+
migrations_paths: db/cable_migrate
|
|
81
|
+
<%- end -%>
|
|
82
|
+
<%- end -%>
|
|
@@ -84,8 +84,31 @@ test:
|
|
|
84
84
|
# Read https://guides.rubyonrails.org/configuring.html#configuring-a-database
|
|
85
85
|
# for a full overview on how database connection configuration can be specified.
|
|
86
86
|
#
|
|
87
|
+
<%- if options.skip_solid? -%>
|
|
87
88
|
production:
|
|
88
89
|
<<: *default
|
|
89
90
|
database: <%= app_name %>_production
|
|
90
91
|
username: <%= app_name %>
|
|
91
92
|
password: <%%= ENV["<%= app_name.upcase %>_DATABASE_PASSWORD"] %>
|
|
93
|
+
<%- else -%>
|
|
94
|
+
production:
|
|
95
|
+
primary: &primary_production
|
|
96
|
+
<<: *default
|
|
97
|
+
database: <%= app_name %>_production
|
|
98
|
+
username: <%= app_name %>
|
|
99
|
+
password: <%%= ENV["<%= app_name.upcase %>_DATABASE_PASSWORD"] %>
|
|
100
|
+
cache:
|
|
101
|
+
<<: *primary_production
|
|
102
|
+
database: <%= app_name %>_production_cache
|
|
103
|
+
migrations_paths: db/cache_migrate
|
|
104
|
+
queue:
|
|
105
|
+
<<: *primary_production
|
|
106
|
+
database: <%= app_name %>_production_queue
|
|
107
|
+
migrations_paths: db/queue_migrate
|
|
108
|
+
<%- unless options.skip_action_cable? -%>
|
|
109
|
+
cable:
|
|
110
|
+
<<: *primary_production
|
|
111
|
+
database: <%= app_name %>_production_cable
|
|
112
|
+
migrations_paths: db/cable_migrate
|
|
113
|
+
<%- end -%>
|
|
114
|
+
<%- end -%>
|
|
@@ -21,12 +21,62 @@ test:
|
|
|
21
21
|
database: storage/test.sqlite3
|
|
22
22
|
|
|
23
23
|
|
|
24
|
+
<%- if options.skip_kamal? -%>
|
|
24
25
|
# SQLite3 write its data on the local filesystem, as such it requires
|
|
25
26
|
# persistent disks. If you are deploying to a managed service, you should
|
|
26
27
|
# make sure it provides disk persistence, as many don't.
|
|
27
28
|
#
|
|
28
29
|
# Similarly, if you deploy your application as a Docker container, you must
|
|
29
30
|
# ensure the database is located in a persisted volume.
|
|
31
|
+
<%- if options.skip_solid? -%>
|
|
30
32
|
production:
|
|
31
33
|
<<: *default
|
|
32
34
|
# database: path/to/persistent/storage/production.sqlite3
|
|
35
|
+
<%- else -%>
|
|
36
|
+
production:
|
|
37
|
+
primary:
|
|
38
|
+
<<: *default
|
|
39
|
+
# database: path/to/persistent/storage/production.sqlite3
|
|
40
|
+
cache:
|
|
41
|
+
<<: *default
|
|
42
|
+
# database: path/to/persistent/storage/production_cache.sqlite3
|
|
43
|
+
migrations_paths: db/cache_migrate
|
|
44
|
+
queue:
|
|
45
|
+
<<: *default
|
|
46
|
+
# database: path/to/persistent/storage/production_queue.sqlite3
|
|
47
|
+
migrations_paths: db/queue_migrate
|
|
48
|
+
<%- unless options.skip_action_cable? -%>
|
|
49
|
+
cable:
|
|
50
|
+
<<: *default
|
|
51
|
+
# database: path/to/persistent/storage/production_cable.sqlite3
|
|
52
|
+
migrations_paths: db/cable_migrate
|
|
53
|
+
<%- end -%>
|
|
54
|
+
<%- end -%>
|
|
55
|
+
<%- else -%>
|
|
56
|
+
# Store production database in the storage/ directory, which by default
|
|
57
|
+
# is mounted as a persistent Docker volume in config/deploy.yml.
|
|
58
|
+
<%- if options.skip_solid? -%>
|
|
59
|
+
production:
|
|
60
|
+
<<: *default
|
|
61
|
+
database: storage/production.sqlite3
|
|
62
|
+
<%- else -%>
|
|
63
|
+
production:
|
|
64
|
+
primary:
|
|
65
|
+
<<: *default
|
|
66
|
+
database: storage/production.sqlite3
|
|
67
|
+
cache:
|
|
68
|
+
<<: *default
|
|
69
|
+
database: storage/production_cache.sqlite3
|
|
70
|
+
migrations_paths: db/cache_migrate
|
|
71
|
+
queue:
|
|
72
|
+
<<: *default
|
|
73
|
+
database: storage/production_queue.sqlite3
|
|
74
|
+
migrations_paths: db/queue_migrate
|
|
75
|
+
<%- unless options.skip_action_cable? -%>
|
|
76
|
+
cable:
|
|
77
|
+
<<: *default
|
|
78
|
+
database: storage/production_cable.sqlite3
|
|
79
|
+
migrations_paths: db/cable_migrate
|
|
80
|
+
<%- end -%>
|
|
81
|
+
<%- end -%>
|
|
82
|
+
<%- end -%>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# MySQL. Versions 5.
|
|
1
|
+
# MySQL. Versions 5.6.4 and up are supported.
|
|
2
2
|
#
|
|
3
3
|
# Install the MySQL driver
|
|
4
4
|
# gem install trilogy
|
|
@@ -15,14 +15,13 @@ default: &default
|
|
|
15
15
|
pool: <%%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
|
|
16
16
|
username: root
|
|
17
17
|
password:
|
|
18
|
-
<% if database.socket -%>
|
|
19
|
-
socket: <%= database.socket %>
|
|
20
|
-
<% else -%>
|
|
21
18
|
host: <%%= ENV.fetch("DB_HOST") { "<%= database.host %>" } %>
|
|
22
|
-
<% end -%>
|
|
23
19
|
|
|
24
20
|
development:
|
|
25
21
|
<<: *default
|
|
22
|
+
<% if database.socket -%>
|
|
23
|
+
socket: <%= database.socket %>
|
|
24
|
+
<% end -%>
|
|
26
25
|
database: <%= app_name %>_development
|
|
27
26
|
|
|
28
27
|
# Warning: The database defined as "test" will be erased and
|
|
@@ -30,6 +29,9 @@ development:
|
|
|
30
29
|
# Do not set this db to the same as development or production.
|
|
31
30
|
test:
|
|
32
31
|
<<: *default
|
|
32
|
+
<% if database.socket -%>
|
|
33
|
+
socket: <%= database.socket %>
|
|
34
|
+
<% end -%>
|
|
33
35
|
database: <%= app_name %>_test
|
|
34
36
|
|
|
35
37
|
# As with config/credentials.yml, you never want to store sensitive information,
|
|
@@ -52,8 +54,31 @@ test:
|
|
|
52
54
|
# Read https://guides.rubyonrails.org/configuring.html#configuring-a-database
|
|
53
55
|
# for a full overview on how database connection configuration can be specified.
|
|
54
56
|
#
|
|
57
|
+
<%- if options.skip_solid? -%>
|
|
55
58
|
production:
|
|
56
59
|
<<: *default
|
|
57
60
|
database: <%= app_name %>_production
|
|
58
61
|
username: <%= app_name %>
|
|
59
62
|
password: <%%= ENV["<%= app_name.upcase %>_DATABASE_PASSWORD"] %>
|
|
63
|
+
<%- else -%>
|
|
64
|
+
production:
|
|
65
|
+
primary: &primary_production
|
|
66
|
+
<<: *default
|
|
67
|
+
database: <%= app_name %>_production
|
|
68
|
+
username: <%= app_name %>
|
|
69
|
+
password: <%%= ENV["<%= app_name.upcase %>_DATABASE_PASSWORD"] %>
|
|
70
|
+
cache:
|
|
71
|
+
<<: *primary_production
|
|
72
|
+
database: <%= app_name %>_production_cache
|
|
73
|
+
migrations_paths: db/cache_migrate
|
|
74
|
+
queue:
|
|
75
|
+
<<: *primary_production
|
|
76
|
+
database: <%= app_name %>_production_queue
|
|
77
|
+
migrations_paths: db/queue_migrate
|
|
78
|
+
<%- unless options.skip_action_cable? -%>
|
|
79
|
+
cable:
|
|
80
|
+
<<: *primary_production
|
|
81
|
+
database: <%= app_name %>_production_cable
|
|
82
|
+
migrations_paths: db/cable_migrate
|
|
83
|
+
<%- end -%>
|
|
84
|
+
<%- end -%>
|
|
@@ -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
|