Skip to content

Add Kamal by default to Rails 8#51798

Merged
dhh merged 18 commits intomainfrom
kamal-by-default
May 14, 2024
Merged

Add Kamal by default to Rails 8#51798
dhh merged 18 commits intomainfrom
kamal-by-default

Conversation

@dhh
Copy link
Member

@dhh dhh commented May 12, 2024

Rails should have a default answer to deploying applications out of the box to cloud or bare metal. Kamal is that answer. We'll configure it automatically as far as we can, but allow an opt-out with --skip-kamal.

@rails-bot rails-bot bot added the railties label May 12, 2024
@dhh dhh added this to the 8.0.0 milestone May 12, 2024
@dhh
Copy link
Member Author

dhh commented May 12, 2024

cc @djmb

@dhh
Copy link
Member Author

dhh commented May 13, 2024

Unrelated flaky build failures.

@dhh
Copy link
Member Author

dhh commented May 13, 2024

The flaky tests that keep tripping intermittently:

image

@dhh dhh merged commit bee3fa4 into main May 14, 2024
@dhh dhh deleted the kamal-by-default branch May 14, 2024 00:32
@dhh
Copy link
Member Author

dhh commented May 14, 2024

Closes #50441

dhh added a commit that referenced this pull request May 14, 2024
@laptopmutia
Copy link

laptopmutia commented May 14, 2024

some people really work like a beast!

thanks for your hardwork

@plattenschieber
Copy link

Should we also adapt the base kamal deploy config to reflect the new default config?

The diff
diff --git a/config/deploy.yml b/config/deploy.yml
index de5a4d4..2602c66 100644
--- a/config/deploy.yml
+++ b/config/deploy.yml
@@ -1,23 +1,18 @@
# Name of your application. Used to uniquely configure containers.
-service: application
+service: my-app

# Name of the container image.
-image: your-user/application
+image: user/my-app

# Deploy to these servers.
servers:
-  web:
-    - 192.168.0.1
-  # job:
-  #   hosts:
-  #     - 192.168.0.1
-  #   cmd: bin/solid_queue work
+  - 192.168.0.1

# Credentials for your image host.
registry:
 # Specify the registry server, if you're not using Docker Hub
 # server: registry.digitalocean.com / ghcr.io / ...
-  username: your-user
+  username: my-user

 # Always use an access token rather than real password when possible.
 password:
@@ -25,43 +20,25 @@ registry:

# Inject ENV variables into containers (secrets come from .env).
# Remember to run `kamal env push` after making changes!
-env:
-  secret:
-    - RAILS_MASTER_KEY
-  # clear:
-  #   DB_HOST: 192.168.0.2
-
-
-# Use a persistent storage volume for sqlite database files and local Active Storage files.
-# Recommended to change this to a mounted volume path that is backed up off server.
-volumes:
-  - "application_storage:/rails/storage"
-
-
-# Bridge fingerprinted assets, like JS and CSS, between versions to avoid
-# hitting 404 on in-flight requests. Combines all files from new and old
-# version inside the asset_path.
-asset_path: /rails/public/assets
+# env:
+#   clear:
+#     DB_HOST: 192.168.0.2
+#   secret:
+#     - RAILS_MASTER_KEY

# Use a different ssh user than root
# ssh:
#   user: app

-# Configure builder setup (defaults to multi-arch images).
+# Configure builder setup.
# builder:
-#   # Build same-arch image locally (use for x86->x86)
-#   multiarch: false
-#
-#   # Build diff-arch image via remote server
-#   remote:
-#     arch: amd64
-#     host: ssh://app@192.168.0.1
-#
#   args:
-#     RUBY_VERSION: 3.3.1
+#     RUBY_VERSION: 3.2.0
#   secrets:
#     - GITHUB_TOKEN
-#     - RAILS_MASTER_KEY
+#   remote:
+#     arch: amd64
+#     host: ssh://app@192.168.0.1

# Use accessory services (secrets come from .env).
# accessories:
@@ -85,3 +62,40 @@ asset_path: /rails/public/assets
#     port: 6379
#     directories:
#       - data:/data
+
+# Configure custom arguments for Traefik. Be sure to reboot traefik when you modify it.
+# traefik:
+#   args:
+#     accesslog: true
+#     accesslog.format: json
+
+# Configure a custom healthcheck (default is /up on port 3000)
+# healthcheck:
+#   path: /healthz
+#   port: 4000
+
+# Bridge fingerprinted assets, like JS and CSS, between versions to avoid
+# hitting 404 on in-flight requests. Combines all files from new and old
+# version inside the asset_path.
+#
+# If your app is using the Sprockets gem, ensure it sets `config.assets.manifest`.
+# See https://github.com/basecamp/kamal/issues/626 for details
+#
+# asset_path: /rails/public/assets
+
+# Configure rolling deploys by setting a wait time between batches of restarts.
+# boot:
+#   limit: 10 # Can also specify as a percentage of total hosts, such as "25%"
+#   wait: 2
+
+# Configure the role used to determine the primary_host. This host takes
+# deploy locks, runs health checks during the deploy, and follow logs, etc.
+#
+# Caution: there's no support for role renaming yet, so be careful to cleanup
+#          the previous role on the deployed hosts.
+# primary_role: web
+
+# Controls if we abort when see a role with no hosts. Disabling this may be
+# useful for more complex deploy configurations.
+#
+# allow_empty_roles: false

@dhh
Copy link
Member Author

dhh commented May 28, 2024

No, the base Kamal can't be Rails specific. Lots of Kamal users in other environments than Rails.

xjunior pushed a commit to xjunior/rails that referenced this pull request Jun 9, 2024
Set2005 pushed a commit to Set2005/fix-association-initialize-order that referenced this pull request Jul 8, 2024
dhh added a commit that referenced this pull request Aug 6, 2024
* Allow docker entrypoint script to have other preceeding commands in CMD and still run db:prepare if we are starting the server

* Add Thruster by default

* Include new binstub

* Temporarily expose only 80 (via 3000)

* Just expose 80 for now, Kamal will need to handle 443

* Correct typo in activerecord changelog [ci skip]

Correct typo in activerecord changelog for -#50662

* Defer route drawing to the first request, or when url_helpers called.

Executes the first routes reload in middleware, or when the route set
url_helpers is called. Previously, this was executed unconditionally on
boot, which can slow down boot time unnecessarily for larger apps with
lots of routes.

* Support `touch_all` in batches

* Do not trigger devcontainer tests on pull requests

We need to review the code before executing this workflow, so only trigger when someone merge to this repository.

* Refactor `ActiveRecord::SignedId` to not rely on relation delegation

Ref: #50396
Ref: #51776

`ActiveRecord::Relation` automatically delegates missing methods
to the model class wrapped in a `scoping { }` block.

This is to support scoping in user defined class methods. The problem
however is that it's very error prone for the framework, because we
can mistakenly call model methods from inside `Relation` and not
realized we're applying a global scope.

In the best case scenario it's just a waste of performance, but
it can also lead to bugs like #51775

I'm planning to restrict this automatic delegation to methods defined
in childs of `ActiveRecord::Base` only: #50396
but for this to work we must first refactor any Rails code that rely on it.

* Refactor `ActiveRecord::TokenFor` to not rely on relation delegation

Ref: #50396
Ref: #51776

`ActiveRecord::Relation` automatically delegates missing methods
to the model class wrapped in a `scoping { }` block.

This is to support scoping in user defined class methods. The problem
however is that it's very error prone for the framework, because we
can mistakenly call model methods from inside `Relation` and not
realized we're applying a global scope.

In the best case scenario it's just a waste of performance, but
it can also lead to bugs like #51775

I'm planning to restrict this automatic delegation to methods defined
in childs of `ActiveRecord::Base` only: #50396
but for this to work we must first refactor any Rails code that rely on it.

* Fix: batch test assertion order

Co-authored-by: Chedli Bourguiba <chaadow@users.noreply.github.com>

* Move `ActiveRecord::Base.delete` in `Relation`

Ref: #50396

* Move `ActiveRecord::Base.destroy` in `Relation`

Ref: #50396

* Move `ActiveRecord::Base.insert` in `Relation`

Ref: #50396

As well as related methods.

* Use `foreign_key` option for destroy_async test models

This pull request replaces the deprecated `query_constraints:` option with `foreign_key` for destroy_async test models.
Follow up #51571

- This commit addresses these two warnings below:

```
% bin/test test/activejob/destroy_association_async_test.rb
Using sqlite3
DEPRECATION WARNING: Setting `query_constraints:` option on `Cpk::BookDestroyAsync.has_many :chapters` is deprecated. To maintain current behavior, use the `foreign_key` option instead. (called from new at /Users/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/reflection.rb:19)
/Users/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/reflection.rb:19:in `new'
  /Users/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/reflection.rb:19:in `create'
  /Users/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/associations/builder/association.rb:50:in `create_reflection'
  /Users/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/associations/builder/association.rb:32:in `build'
  /Users/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/associations.rb:1531:in `has_many'
  /Users/yahonda/src/github.com/rails/rails/activerecord/test/models/cpk/book_destroy_async.rb:7:in `<class:BookDestroyAsync>'
  /Users/yahonda/src/github.com/rails/rails/activerecord/test/models/cpk/book_destroy_async.rb:4:in `<module:Cpk>'
  /Users/yahonda/src/github.com/rails/rails/activerecord/test/models/cpk/book_destroy_async.rb:3:in `<top (required)>'
  /Users/yahonda/.rbenv/versions/3.3.1/lib/ruby/3.3.0/bundled_gems.rb:74:in `require'
  /Users/yahonda/.rbenv/versions/3.3.1/lib/ruby/3.3.0/bundled_gems.rb:74:in `block (2 levels) in replace_require'
  /Users/yahonda/src/github.com/rails/rails/activerecord/test/activejob/destroy_association_async_test.rb:27:in `<top (required)>'
  /Users/yahonda/.rbenv/versions/3.3.1/lib/ruby/3.3.0/bundled_gems.rb:74:in `require'
  /Users/yahonda/.rbenv/versions/3.3.1/lib/ruby/3.3.0/bundled_gems.rb:74:in `block (2 levels) in replace_require'
  /Users/yahonda/src/github.com/rails/rails/railties/lib/rails/test_unit/runner.rb:61:in `block in load_tests'
  /Users/yahonda/src/github.com/rails/rails/railties/lib/rails/test_unit/runner.rb:60:in `each'
  /Users/yahonda/src/github.com/rails/rails/railties/lib/rails/test_unit/runner.rb:60:in `load_tests'
  /Users/yahonda/src/github.com/rails/rails/railties/lib/rails/test_unit/runner.rb:52:in `run'
  /Users/yahonda/src/github.com/rails/rails/activerecord/test/support/tools.rb:37:in `<top (required)>'
  bin/test:11:in `require_relative'
  bin/test:11:in `<main>'
DEPRECATION WARNING: Setting `query_constraints:` option on `Cpk::ChapterDestroyAsync.belongs_to :book` is deprecated. To maintain current behavior, use the `foreign_key` option instead. (called from new at /Users/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/reflection.rb:19)
/Users/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/reflection.rb:19:in `new'
  /Users/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/reflection.rb:19:in `create'
  /Users/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/associations/builder/association.rb:50:in `create_reflection'
  /Users/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/associations/builder/association.rb:32:in `build'
  /Users/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/associations.rb:1910:in `belongs_to'
  /Users/yahonda/src/github.com/rails/rails/activerecord/test/models/cpk/chapter_destroy_async.rb:8:in `<class:ChapterDestroyAsync>'
  /Users/yahonda/src/github.com/rails/rails/activerecord/test/models/cpk/chapter_destroy_async.rb:4:in `<module:Cpk>'
  /Users/yahonda/src/github.com/rails/rails/activerecord/test/models/cpk/chapter_destroy_async.rb:3:in `<top (required)>'
  /Users/yahonda/.rbenv/versions/3.3.1/lib/ruby/3.3.0/bundled_gems.rb:74:in `require'
  /Users/yahonda/.rbenv/versions/3.3.1/lib/ruby/3.3.0/bundled_gems.rb:74:in `block (2 levels) in replace_require'
  /Users/yahonda/src/github.com/rails/rails/activerecord/test/activejob/destroy_association_async_test.rb:28:in `<top (required)>'
  /Users/yahonda/.rbenv/versions/3.3.1/lib/ruby/3.3.0/bundled_gems.rb:74:in `require'
  /Users/yahonda/.rbenv/versions/3.3.1/lib/ruby/3.3.0/bundled_gems.rb:74:in `block (2 levels) in replace_require'
  /Users/yahonda/src/github.com/rails/rails/railties/lib/rails/test_unit/runner.rb:61:in `block in load_tests'
  /Users/yahonda/src/github.com/rails/rails/railties/lib/rails/test_unit/runner.rb:60:in `each'
  /Users/yahonda/src/github.com/rails/rails/railties/lib/rails/test_unit/runner.rb:60:in `load_tests'
  /Users/yahonda/src/github.com/rails/rails/railties/lib/rails/test_unit/runner.rb:52:in `run'
  /Users/yahonda/src/github.com/rails/rails/activerecord/test/support/tools.rb:37:in `<top (required)>'
  bin/test:11:in `require_relative'
  bin/test:11:in `<main>'
Run options: --seed 24461

....................

Finished in 0.199597s, 100.2019 runs/s, 370.7471 assertions/s.
20 runs, 74 assertions, 0 failures, 0 errors, 0 skips
%
```

* Suppress RuboCop output when there are no offenses in code generation

Follow up #51782.

> But it's overkill for the default case where people use the default style guide,
> and it introduces both delay and console output as a cost.

When there are no offenses with the coding style generated by code generation,
outputting RuboCop results to the console was redundant.
Since RuboCop has `--format=quiet` option that suppresses console output
when there are no offenses, this PR adds that option:
https://docs.rubocop.org/rubocop/1.63/formatters.html#quiet-formatter

While this PR doesn't resolve any added execution speed by RuboCop,
the frequency of using the generator is not high within the development flow.
Therefore, depending on the execution speed, it might be possible to uncomment #51782,
but this PR respects the defaults in #51782 and doesn't address that.

* Enable Lint/Debugger

This will prevent issues like be0cb4e, which would have resulted in:

```
guides/rails_guides/generator.rb:16:1: W: Lint/Debugger: Remove debugger entry point require "debug".
require "debug"
^^^^^^^^^^^^^^^
```

Disabled the cop in actionpack tests for screenshot_helper and page_dump_helper:

```
actionpack/test/controller/integration_test.rb:1369:9: W: Lint/Debugger: Remove debugger entry point save_and_open_page.
        save_and_open_page
        ^^^^^^^^^^^^^^^^^^
actionpack/test/controller/integration_test.rb:1381:11: W: Lint/Debugger: Remove debugger entry point save_and_open_page.
          save_and_open_page
          ^^^^^^^^^^^^^^^^^^
actionpack/test/controller/integration_test.rb:1391:39: W: Lint/Debugger: Remove debugger entry point save_and_open_page.
      assert_raise(InvalidResponse) { save_and_open_page }
                                      ^^^^^^^^^^^^^^^^^^
```

```
actionpack/lib/action_dispatch/system_testing/test_helpers/screenshot_helper.rb:111:13: W: Lint/Debugger: Remove debugger entry point page.save_page(absolute_html_path).
            page.save_page(absolute_html_path)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
actionpack/lib/action_dispatch/system_testing/test_helpers/screenshot_helper.rb:115:13: W: Lint/Debugger: Remove debugger entry point page.save_screenshot(absolute_image
_path).
            page.save_screenshot(absolute_image_path)
```

The DebuggerRequires option was first available in rubocop v1.63.0, in rubocop/rubocop#12766.

* Support `duration` in `ActiveSupport::XmlMini`

* Development of Rails 8.0 starts now

:tada:

* Reapply "Rails 8 will target Ruby 3.3+ only for new apps"

This reverts commit 64ab211.

* Clean CHANGELOG for 8.0

* Fix rubocop

See rubocop/rubocop#12898 for the issue.

* Add name to DevContainer compose file

Currently when you generate a project the compose.yaml generated
file does not include the top-level name property. Not having this
top-level name property makes all containers / volumes started by
devcontainer to be prepended with the folder name, which is
`devcontainer` in the case of the .devcontainer/compose.yml` file.

This is ok if you run only one project with devcontainer but starts
to get problem if you run multiple projects. If you have one project
that runs on postgresql 15 and a new one that runs on postgresql 16 it
will fail to boot the postgresql container because both devcontainers is
using the same volume: `devcontainer_postgres-data`.

This commit fixes this by setting the top-lavel name property with
the project name, which will make the containers and volumes to be
prepended with the project name and not with `devcontainer`.

* Remove support for oracle, sqlserver and JRuby specific database adapters from the new and db:system:change commands. The supported options are sqlite3, mysql, postgresql and trilogy.

* Refactoring Database generators

Extract all the DB information (gems, dockerfile packages, devcontainer etc.) into an object. This let's us remove the growing number of case statements in this code.

* This will be released in 7.2

* Merge pull request #51766 from Shopify/revert-actionable-errors-retry

Revert "Merge pull request #50941 from andrewn617/actionable-cli"

* Point user to devcontainer for containerized dev environment

* Add Highlights section in the Rails 7.1 release notes

* Fix `ActiveRecord::Relation#touch_all` with custom attribute aliased as attribute for update

* Remove jruby and oracle related gems from Gemfile

We are only know goign to support mysql2, trilogy, postgresql and sqlite3
adapters in Rails.

* Add Kamal by default to Rails 8 (#51798)

* Add Kamal by default

* Excess CR

* Add Thruster for testing

* Update comment to reflect shrunken responsibilities

* Use latest Thruster

---------

Co-authored-by: Sampat Badhe <sampatbadhe@gmail.com>
Co-authored-by: Gannon McGibbon <gannon.mcgibbon@gmail.com>
Co-authored-by: fatkodima <fatkodima123@gmail.com>
Co-authored-by: Rafael Mendonça França <rafael@rubyonrails.org>
Co-authored-by: Jean Boussier <jean.boussier@gmail.com>
Co-authored-by: Akhil G Krishnan <akhilgkrishnan4u@gmail.com>
Co-authored-by: Chedli Bourguiba <chaadow@users.noreply.github.com>
Co-authored-by: Yasuo Honda <yasuo.honda@gmail.com>
Co-authored-by: Koichi ITO <koic.ito@gmail.com>
Co-authored-by: zzak <zzakscott@gmail.com>
Co-authored-by: heka1024 <heka1024@gmail.com>
Co-authored-by: Cadu Ribeiro <mail@cadu.dev>
Co-authored-by: Andrew Novoselac <andrew.novoselac@shopify.com>
DanielaVelasquez pushed a commit to DanielaVelasquez/rails that referenced this pull request Oct 3, 2024
DanielaVelasquez pushed a commit to DanielaVelasquez/rails that referenced this pull request Oct 3, 2024
* Allow docker entrypoint script to have other preceeding commands in CMD and still run db:prepare if we are starting the server

* Add Thruster by default

* Include new binstub

* Temporarily expose only 80 (via 3000)

* Just expose 80 for now, Kamal will need to handle 443

* Correct typo in activerecord changelog [ci skip]

Correct typo in activerecord changelog for -rails#50662

* Defer route drawing to the first request, or when url_helpers called.

Executes the first routes reload in middleware, or when the route set
url_helpers is called. Previously, this was executed unconditionally on
boot, which can slow down boot time unnecessarily for larger apps with
lots of routes.

* Support `touch_all` in batches

* Do not trigger devcontainer tests on pull requests

We need to review the code before executing this workflow, so only trigger when someone merge to this repository.

* Refactor `ActiveRecord::SignedId` to not rely on relation delegation

Ref: rails#50396
Ref: rails#51776

`ActiveRecord::Relation` automatically delegates missing methods
to the model class wrapped in a `scoping { }` block.

This is to support scoping in user defined class methods. The problem
however is that it's very error prone for the framework, because we
can mistakenly call model methods from inside `Relation` and not
realized we're applying a global scope.

In the best case scenario it's just a waste of performance, but
it can also lead to bugs like rails#51775

I'm planning to restrict this automatic delegation to methods defined
in childs of `ActiveRecord::Base` only: rails#50396
but for this to work we must first refactor any Rails code that rely on it.

* Refactor `ActiveRecord::TokenFor` to not rely on relation delegation

Ref: rails#50396
Ref: rails#51776

`ActiveRecord::Relation` automatically delegates missing methods
to the model class wrapped in a `scoping { }` block.

This is to support scoping in user defined class methods. The problem
however is that it's very error prone for the framework, because we
can mistakenly call model methods from inside `Relation` and not
realized we're applying a global scope.

In the best case scenario it's just a waste of performance, but
it can also lead to bugs like rails#51775

I'm planning to restrict this automatic delegation to methods defined
in childs of `ActiveRecord::Base` only: rails#50396
but for this to work we must first refactor any Rails code that rely on it.

* Fix: batch test assertion order

Co-authored-by: Chedli Bourguiba <chaadow@users.noreply.github.com>

* Move `ActiveRecord::Base.delete` in `Relation`

Ref: rails#50396

* Move `ActiveRecord::Base.destroy` in `Relation`

Ref: rails#50396

* Move `ActiveRecord::Base.insert` in `Relation`

Ref: rails#50396

As well as related methods.

* Use `foreign_key` option for destroy_async test models

This pull request replaces the deprecated `query_constraints:` option with `foreign_key` for destroy_async test models.
Follow up rails#51571

- This commit addresses these two warnings below:

```
% bin/test test/activejob/destroy_association_async_test.rb
Using sqlite3
DEPRECATION WARNING: Setting `query_constraints:` option on `Cpk::BookDestroyAsync.has_many :chapters` is deprecated. To maintain current behavior, use the `foreign_key` option instead. (called from new at /Users/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/reflection.rb:19)
/Users/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/reflection.rb:19:in `new'
  /Users/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/reflection.rb:19:in `create'
  /Users/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/associations/builder/association.rb:50:in `create_reflection'
  /Users/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/associations/builder/association.rb:32:in `build'
  /Users/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/associations.rb:1531:in `has_many'
  /Users/yahonda/src/github.com/rails/rails/activerecord/test/models/cpk/book_destroy_async.rb:7:in `<class:BookDestroyAsync>'
  /Users/yahonda/src/github.com/rails/rails/activerecord/test/models/cpk/book_destroy_async.rb:4:in `<module:Cpk>'
  /Users/yahonda/src/github.com/rails/rails/activerecord/test/models/cpk/book_destroy_async.rb:3:in `<top (required)>'
  /Users/yahonda/.rbenv/versions/3.3.1/lib/ruby/3.3.0/bundled_gems.rb:74:in `require'
  /Users/yahonda/.rbenv/versions/3.3.1/lib/ruby/3.3.0/bundled_gems.rb:74:in `block (2 levels) in replace_require'
  /Users/yahonda/src/github.com/rails/rails/activerecord/test/activejob/destroy_association_async_test.rb:27:in `<top (required)>'
  /Users/yahonda/.rbenv/versions/3.3.1/lib/ruby/3.3.0/bundled_gems.rb:74:in `require'
  /Users/yahonda/.rbenv/versions/3.3.1/lib/ruby/3.3.0/bundled_gems.rb:74:in `block (2 levels) in replace_require'
  /Users/yahonda/src/github.com/rails/rails/railties/lib/rails/test_unit/runner.rb:61:in `block in load_tests'
  /Users/yahonda/src/github.com/rails/rails/railties/lib/rails/test_unit/runner.rb:60:in `each'
  /Users/yahonda/src/github.com/rails/rails/railties/lib/rails/test_unit/runner.rb:60:in `load_tests'
  /Users/yahonda/src/github.com/rails/rails/railties/lib/rails/test_unit/runner.rb:52:in `run'
  /Users/yahonda/src/github.com/rails/rails/activerecord/test/support/tools.rb:37:in `<top (required)>'
  bin/test:11:in `require_relative'
  bin/test:11:in `<main>'
DEPRECATION WARNING: Setting `query_constraints:` option on `Cpk::ChapterDestroyAsync.belongs_to :book` is deprecated. To maintain current behavior, use the `foreign_key` option instead. (called from new at /Users/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/reflection.rb:19)
/Users/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/reflection.rb:19:in `new'
  /Users/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/reflection.rb:19:in `create'
  /Users/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/associations/builder/association.rb:50:in `create_reflection'
  /Users/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/associations/builder/association.rb:32:in `build'
  /Users/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/associations.rb:1910:in `belongs_to'
  /Users/yahonda/src/github.com/rails/rails/activerecord/test/models/cpk/chapter_destroy_async.rb:8:in `<class:ChapterDestroyAsync>'
  /Users/yahonda/src/github.com/rails/rails/activerecord/test/models/cpk/chapter_destroy_async.rb:4:in `<module:Cpk>'
  /Users/yahonda/src/github.com/rails/rails/activerecord/test/models/cpk/chapter_destroy_async.rb:3:in `<top (required)>'
  /Users/yahonda/.rbenv/versions/3.3.1/lib/ruby/3.3.0/bundled_gems.rb:74:in `require'
  /Users/yahonda/.rbenv/versions/3.3.1/lib/ruby/3.3.0/bundled_gems.rb:74:in `block (2 levels) in replace_require'
  /Users/yahonda/src/github.com/rails/rails/activerecord/test/activejob/destroy_association_async_test.rb:28:in `<top (required)>'
  /Users/yahonda/.rbenv/versions/3.3.1/lib/ruby/3.3.0/bundled_gems.rb:74:in `require'
  /Users/yahonda/.rbenv/versions/3.3.1/lib/ruby/3.3.0/bundled_gems.rb:74:in `block (2 levels) in replace_require'
  /Users/yahonda/src/github.com/rails/rails/railties/lib/rails/test_unit/runner.rb:61:in `block in load_tests'
  /Users/yahonda/src/github.com/rails/rails/railties/lib/rails/test_unit/runner.rb:60:in `each'
  /Users/yahonda/src/github.com/rails/rails/railties/lib/rails/test_unit/runner.rb:60:in `load_tests'
  /Users/yahonda/src/github.com/rails/rails/railties/lib/rails/test_unit/runner.rb:52:in `run'
  /Users/yahonda/src/github.com/rails/rails/activerecord/test/support/tools.rb:37:in `<top (required)>'
  bin/test:11:in `require_relative'
  bin/test:11:in `<main>'
Run options: --seed 24461

....................

Finished in 0.199597s, 100.2019 runs/s, 370.7471 assertions/s.
20 runs, 74 assertions, 0 failures, 0 errors, 0 skips
%
```

* Suppress RuboCop output when there are no offenses in code generation

Follow up rails#51782.

> But it's overkill for the default case where people use the default style guide,
> and it introduces both delay and console output as a cost.

When there are no offenses with the coding style generated by code generation,
outputting RuboCop results to the console was redundant.
Since RuboCop has `--format=quiet` option that suppresses console output
when there are no offenses, this PR adds that option:
https://docs.rubocop.org/rubocop/1.63/formatters.html#quiet-formatter

While this PR doesn't resolve any added execution speed by RuboCop,
the frequency of using the generator is not high within the development flow.
Therefore, depending on the execution speed, it might be possible to uncomment rails#51782,
but this PR respects the defaults in rails#51782 and doesn't address that.

* Enable Lint/Debugger

This will prevent issues like be0cb4e, which would have resulted in:

```
guides/rails_guides/generator.rb:16:1: W: Lint/Debugger: Remove debugger entry point require "debug".
require "debug"
^^^^^^^^^^^^^^^
```

Disabled the cop in actionpack tests for screenshot_helper and page_dump_helper:

```
actionpack/test/controller/integration_test.rb:1369:9: W: Lint/Debugger: Remove debugger entry point save_and_open_page.
        save_and_open_page
        ^^^^^^^^^^^^^^^^^^
actionpack/test/controller/integration_test.rb:1381:11: W: Lint/Debugger: Remove debugger entry point save_and_open_page.
          save_and_open_page
          ^^^^^^^^^^^^^^^^^^
actionpack/test/controller/integration_test.rb:1391:39: W: Lint/Debugger: Remove debugger entry point save_and_open_page.
      assert_raise(InvalidResponse) { save_and_open_page }
                                      ^^^^^^^^^^^^^^^^^^
```

```
actionpack/lib/action_dispatch/system_testing/test_helpers/screenshot_helper.rb:111:13: W: Lint/Debugger: Remove debugger entry point page.save_page(absolute_html_path).
            page.save_page(absolute_html_path)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
actionpack/lib/action_dispatch/system_testing/test_helpers/screenshot_helper.rb:115:13: W: Lint/Debugger: Remove debugger entry point page.save_screenshot(absolute_image
_path).
            page.save_screenshot(absolute_image_path)
```

The DebuggerRequires option was first available in rubocop v1.63.0, in rubocop/rubocop#12766.

* Support `duration` in `ActiveSupport::XmlMini`

* Development of Rails 8.0 starts now

:tada:

* Reapply "Rails 8 will target Ruby 3.3+ only for new apps"

This reverts commit 64ab211.

* Clean CHANGELOG for 8.0

* Fix rubocop

See rubocop/rubocop#12898 for the issue.

* Add name to DevContainer compose file

Currently when you generate a project the compose.yaml generated
file does not include the top-level name property. Not having this
top-level name property makes all containers / volumes started by
devcontainer to be prepended with the folder name, which is
`devcontainer` in the case of the .devcontainer/compose.yml` file.

This is ok if you run only one project with devcontainer but starts
to get problem if you run multiple projects. If you have one project
that runs on postgresql 15 and a new one that runs on postgresql 16 it
will fail to boot the postgresql container because both devcontainers is
using the same volume: `devcontainer_postgres-data`.

This commit fixes this by setting the top-lavel name property with
the project name, which will make the containers and volumes to be
prepended with the project name and not with `devcontainer`.

* Remove support for oracle, sqlserver and JRuby specific database adapters from the new and db:system:change commands. The supported options are sqlite3, mysql, postgresql and trilogy.

* Refactoring Database generators

Extract all the DB information (gems, dockerfile packages, devcontainer etc.) into an object. This let's us remove the growing number of case statements in this code.

* This will be released in 7.2

* Merge pull request rails#51766 from Shopify/revert-actionable-errors-retry

Revert "Merge pull request rails#50941 from andrewn617/actionable-cli"

* Point user to devcontainer for containerized dev environment

* Add Highlights section in the Rails 7.1 release notes

* Fix `ActiveRecord::Relation#touch_all` with custom attribute aliased as attribute for update

* Remove jruby and oracle related gems from Gemfile

We are only know goign to support mysql2, trilogy, postgresql and sqlite3
adapters in Rails.

* Add Kamal by default to Rails 8 (rails#51798)

* Add Kamal by default

* Excess CR

* Add Thruster for testing

* Update comment to reflect shrunken responsibilities

* Use latest Thruster

---------

Co-authored-by: Sampat Badhe <sampatbadhe@gmail.com>
Co-authored-by: Gannon McGibbon <gannon.mcgibbon@gmail.com>
Co-authored-by: fatkodima <fatkodima123@gmail.com>
Co-authored-by: Rafael Mendonça França <rafael@rubyonrails.org>
Co-authored-by: Jean Boussier <jean.boussier@gmail.com>
Co-authored-by: Akhil G Krishnan <akhilgkrishnan4u@gmail.com>
Co-authored-by: Chedli Bourguiba <chaadow@users.noreply.github.com>
Co-authored-by: Yasuo Honda <yasuo.honda@gmail.com>
Co-authored-by: Koichi ITO <koic.ito@gmail.com>
Co-authored-by: zzak <zzakscott@gmail.com>
Co-authored-by: heka1024 <heka1024@gmail.com>
Co-authored-by: Cadu Ribeiro <mail@cadu.dev>
Co-authored-by: Andrew Novoselac <andrew.novoselac@shopify.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants