Skip to content

Commit afc1cb0

Browse files
committed
Upgrade to Rails 7.2
1 parent 59e10ca commit afc1cb0

File tree

9 files changed

+120
-109
lines changed

9 files changed

+120
-109
lines changed

Gemfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
source 'https://rubygems.org'
44
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
55

6-
gem 'rails', '~> 7.1.0'
6+
gem 'rails', '~> 7.2.0'
77

88
gem 'bootsnap', '>= 1.1.0', require: false
99
gem 'bunny', '~> 2.17'

Gemfile.lock

+65-68
Original file line numberDiff line numberDiff line change
@@ -7,80 +7,76 @@ GEM
77
GEM
88
remote: https://rubygems.org/
99
specs:
10-
actioncable (7.1.4.2)
11-
actionpack (= 7.1.4.2)
12-
activesupport (= 7.1.4.2)
10+
actioncable (7.2.1.2)
11+
actionpack (= 7.2.1.2)
12+
activesupport (= 7.2.1.2)
1313
nio4r (~> 2.0)
1414
websocket-driver (>= 0.6.1)
1515
zeitwerk (~> 2.6)
16-
actionmailbox (7.1.4.2)
17-
actionpack (= 7.1.4.2)
18-
activejob (= 7.1.4.2)
19-
activerecord (= 7.1.4.2)
20-
activestorage (= 7.1.4.2)
21-
activesupport (= 7.1.4.2)
22-
mail (>= 2.7.1)
23-
net-imap
24-
net-pop
25-
net-smtp
26-
actionmailer (7.1.4.2)
27-
actionpack (= 7.1.4.2)
28-
actionview (= 7.1.4.2)
29-
activejob (= 7.1.4.2)
30-
activesupport (= 7.1.4.2)
31-
mail (~> 2.5, >= 2.5.4)
32-
net-imap
33-
net-pop
34-
net-smtp
16+
actionmailbox (7.2.1.2)
17+
actionpack (= 7.2.1.2)
18+
activejob (= 7.2.1.2)
19+
activerecord (= 7.2.1.2)
20+
activestorage (= 7.2.1.2)
21+
activesupport (= 7.2.1.2)
22+
mail (>= 2.8.0)
23+
actionmailer (7.2.1.2)
24+
actionpack (= 7.2.1.2)
25+
actionview (= 7.2.1.2)
26+
activejob (= 7.2.1.2)
27+
activesupport (= 7.2.1.2)
28+
mail (>= 2.8.0)
3529
rails-dom-testing (~> 2.2)
36-
actionpack (7.1.4.2)
37-
actionview (= 7.1.4.2)
38-
activesupport (= 7.1.4.2)
30+
actionpack (7.2.1.2)
31+
actionview (= 7.2.1.2)
32+
activesupport (= 7.2.1.2)
3933
nokogiri (>= 1.8.5)
4034
racc
41-
rack (>= 2.2.4)
35+
rack (>= 2.2.4, < 3.2)
4236
rack-session (>= 1.0.1)
4337
rack-test (>= 0.6.3)
4438
rails-dom-testing (~> 2.2)
4539
rails-html-sanitizer (~> 1.6)
46-
actiontext (7.1.4.2)
47-
actionpack (= 7.1.4.2)
48-
activerecord (= 7.1.4.2)
49-
activestorage (= 7.1.4.2)
50-
activesupport (= 7.1.4.2)
40+
useragent (~> 0.16)
41+
actiontext (7.2.1.2)
42+
actionpack (= 7.2.1.2)
43+
activerecord (= 7.2.1.2)
44+
activestorage (= 7.2.1.2)
45+
activesupport (= 7.2.1.2)
5146
globalid (>= 0.6.0)
5247
nokogiri (>= 1.8.5)
53-
actionview (7.1.4.2)
54-
activesupport (= 7.1.4.2)
48+
actionview (7.2.1.2)
49+
activesupport (= 7.2.1.2)
5550
builder (~> 3.1)
5651
erubi (~> 1.11)
5752
rails-dom-testing (~> 2.2)
5853
rails-html-sanitizer (~> 1.6)
59-
activejob (7.1.4.2)
60-
activesupport (= 7.1.4.2)
54+
activejob (7.2.1.2)
55+
activesupport (= 7.2.1.2)
6156
globalid (>= 0.3.6)
62-
activemodel (7.1.4.2)
63-
activesupport (= 7.1.4.2)
64-
activerecord (7.1.4.2)
65-
activemodel (= 7.1.4.2)
66-
activesupport (= 7.1.4.2)
57+
activemodel (7.2.1.2)
58+
activesupport (= 7.2.1.2)
59+
activerecord (7.2.1.2)
60+
activemodel (= 7.2.1.2)
61+
activesupport (= 7.2.1.2)
6762
timeout (>= 0.4.0)
68-
activestorage (7.1.4.2)
69-
actionpack (= 7.1.4.2)
70-
activejob (= 7.1.4.2)
71-
activerecord (= 7.1.4.2)
72-
activesupport (= 7.1.4.2)
63+
activestorage (7.2.1.2)
64+
actionpack (= 7.2.1.2)
65+
activejob (= 7.2.1.2)
66+
activerecord (= 7.2.1.2)
67+
activesupport (= 7.2.1.2)
7368
marcel (~> 1.0)
74-
activesupport (7.1.4.2)
69+
activesupport (7.2.1.2)
7570
base64
7671
bigdecimal
77-
concurrent-ruby (~> 1.0, >= 1.0.2)
72+
concurrent-ruby (~> 1.0, >= 1.3.1)
7873
connection_pool (>= 2.2.5)
7974
drb
8075
i18n (>= 1.6, < 2)
76+
logger (>= 1.4.2)
8177
minitest (>= 5.1)
82-
mutex_m
83-
tzinfo (~> 2.0)
78+
securerandom (>= 0.3)
79+
tzinfo (~> 2.0, >= 2.0.5)
8480
airbrussh (1.5.3)
8581
sshkit (>= 1.6.1, != 1.7.0)
8682
amq-protocol (2.3.2)
@@ -183,7 +179,6 @@ GEM
183179
mini_portile2 (2.8.7)
184180
minitest (5.25.1)
185181
msgpack (1.7.3)
186-
mutex_m (0.2.0)
187182
net-imap (0.5.0)
188183
date
189184
net-protocol
@@ -229,31 +224,31 @@ GEM
229224
rackup (2.1.0)
230225
rack (>= 3)
231226
webrick (~> 1.8)
232-
rails (7.1.4.2)
233-
actioncable (= 7.1.4.2)
234-
actionmailbox (= 7.1.4.2)
235-
actionmailer (= 7.1.4.2)
236-
actionpack (= 7.1.4.2)
237-
actiontext (= 7.1.4.2)
238-
actionview (= 7.1.4.2)
239-
activejob (= 7.1.4.2)
240-
activemodel (= 7.1.4.2)
241-
activerecord (= 7.1.4.2)
242-
activestorage (= 7.1.4.2)
243-
activesupport (= 7.1.4.2)
227+
rails (7.2.1.2)
228+
actioncable (= 7.2.1.2)
229+
actionmailbox (= 7.2.1.2)
230+
actionmailer (= 7.2.1.2)
231+
actionpack (= 7.2.1.2)
232+
actiontext (= 7.2.1.2)
233+
actionview (= 7.2.1.2)
234+
activejob (= 7.2.1.2)
235+
activemodel (= 7.2.1.2)
236+
activerecord (= 7.2.1.2)
237+
activestorage (= 7.2.1.2)
238+
activesupport (= 7.2.1.2)
244239
bundler (>= 1.15.0)
245-
railties (= 7.1.4.2)
240+
railties (= 7.2.1.2)
246241
rails-dom-testing (2.2.0)
247242
activesupport (>= 5.0.0)
248243
minitest
249244
nokogiri (>= 1.6)
250245
rails-html-sanitizer (1.6.0)
251246
loofah (~> 2.21)
252247
nokogiri (~> 1.14)
253-
railties (7.1.4.2)
254-
actionpack (= 7.1.4.2)
255-
activesupport (= 7.1.4.2)
256-
irb
248+
railties (7.2.1.2)
249+
actionpack (= 7.2.1.2)
250+
activesupport (= 7.2.1.2)
251+
irb (~> 1.13)
257252
rackup (>= 1.0.0)
258253
rake (>= 12.2)
259254
thor (~> 1.0, >= 1.2.2)
@@ -316,6 +311,7 @@ GEM
316311
rubocop (~> 1.61)
317312
rubocop-rspec (~> 3, >= 3.0.1)
318313
ruby-progressbar (1.13.0)
314+
securerandom (0.3.1)
319315
set (1.1.0)
320316
sidekiq (7.3.4)
321317
connection_pool (>= 2.3.0)
@@ -343,6 +339,7 @@ GEM
343339
tzinfo (2.0.6)
344340
concurrent-ruby (~> 1.0)
345341
unicode-display_width (2.6.0)
342+
useragent (0.16.10)
346343
webrick (1.8.2)
347344
websocket-driver (0.7.6)
348345
websocket-extensions (>= 0.1.0)
@@ -374,7 +371,7 @@ DEPENDENCIES
374371
pg
375372
pry
376373
puma
377-
rails (~> 7.1.0)
374+
rails (~> 7.2.0)
378375
rspec-rails
379376
rspec_junit_formatter
380377
rubocop

bin/rubocop

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/usr/bin/env ruby
2+
# frozen_string_literal: true
3+
4+
require 'rubygems'
5+
require 'bundler/setup'
6+
7+
# explicit rubocop config increases performance slightly while avoiding config confusion.
8+
ARGV.unshift('--config', File.expand_path('../.rubocop.yml', __dir__))
9+
10+
load Gem.bin_path('rubocop', 'rubocop')

bin/setup

+5-1
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
require 'fileutils'
55

6-
# path to your application root.
76
APP_ROOT = File.expand_path('..', __dir__)
7+
APP_NAME = 'workflow-server'
88

99
def system!(*)
1010
system(*, exception: true)
@@ -32,4 +32,8 @@ FileUtils.chdir APP_ROOT do
3232

3333
puts "\n== Restarting application server =="
3434
system! 'bin/rails restart'
35+
36+
# puts "\n== Configuring puma-dev =="
37+
# system "ln -nfs #{APP_ROOT} ~/.puma-dev/#{APP_NAME}"
38+
# system "curl -Is https://#{APP_NAME}.test/up | head -n 1"
3539
end

config/application.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ module WorkflowServer
2424
# The base configuration for the Rails app
2525
class Application < Rails::Application
2626
# Initialize configuration defaults for originally generated Rails version.
27-
config.load_defaults 7.1
27+
config.load_defaults 7.2
2828

2929
# Please, add to the `ignore` list any other `lib` subdirectories that do
3030
# not contain `.rb` files, or that should not be reloaded or eager loaded.

config/boot.rb

+4
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,7 @@
44

55
require 'bundler/setup' # Set up gems listed in the Gemfile.
66
require 'bootsnap/setup' # Speed up boot time by caching expensive operations.
7+
8+
# We aren't using cookies in this application, so just generate a value at startup.
9+
require 'securerandom'
10+
ENV['SECRET_KEY_BASE'] ||= SecureRandom.hex(64)

config/credentials.yml.enc

-1
This file was deleted.

config/environments/development.rb

+7-6
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,14 @@
1616
# Show full error reports.
1717
config.consider_all_requests_local = true
1818

19-
# Enable server timing
19+
# Enable server timing.
2020
config.server_timing = true
2121

2222
# Enable/disable caching. By default caching is disabled.
2323
# Run rails dev:cache to toggle caching.
2424
if Rails.root.join('tmp/caching-dev.txt').exist?
2525
config.cache_store = :memory_store
26-
config.public_file_server.headers = {
27-
'Cache-Control' => "public, max-age=#{2.days.to_i}"
28-
}
26+
config.public_file_server.headers = { 'Cache-Control' => "public, max-age=#{2.days.to_i}" }
2927
else
3028
config.action_controller.perform_caching = false
3129

@@ -51,8 +49,11 @@
5149
# config.i18n.raise_on_missing_translations = true
5250

5351
# Annotate rendered view with file names.
54-
# config.action_view.annotate_rendered_view_with_filenames = true
52+
config.action_view.annotate_rendered_view_with_filenames = true
5553

56-
# Raise error when a before_action's only/except options reference missing actions
54+
# Raise error when a before_action's only/except options reference missing actions.
5755
config.action_controller.raise_on_missing_callback_actions = true
56+
57+
# Apply autocorrection by RuboCop to files generated by `bin/rails generate`.
58+
# config.generators.apply_rubocop_autocorrect_after_generate!
5859
end

config/puma.rb

+27-31
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,36 @@
11
# frozen_string_literal: true
22

3-
# Puma can serve each request in a thread from an internal thread pool.
4-
# The `threads` method setting takes two numbers: a minimum and maximum.
5-
# Any libraries that use thread pools should be configured to match
6-
# the maximum value specified for Puma. Default is set to 5 threads for minimum
7-
# and maximum; this matches the default thread size of Active Record.
8-
#
9-
max_threads_count = ENV.fetch('RAILS_MAX_THREADS', 5)
10-
min_threads_count = ENV.fetch('RAILS_MIN_THREADS') { max_threads_count }
11-
threads min_threads_count, max_threads_count
3+
# This configuration file will be evaluated by Puma. The top-level methods that
4+
# are invoked here are part of Puma's configuration DSL. For more information
5+
# about methods provided by the DSL, see https://puma.io/puma/Puma/DSL.html.
126

13-
# Specifies the `port` that Puma will listen on to receive requests; default is 3000.
7+
# Puma starts a configurable number of processes (workers) and each process
8+
# serves each request in a thread from an internal thread pool.
149
#
15-
port ENV.fetch('PORT', 3000)
16-
17-
# Specifies the `environment` that Puma will run in.
10+
# The ideal number of threads per worker depends both on how much time the
11+
# application spends waiting for IO operations and on how much you wish to
12+
# to prioritize throughput over latency.
1813
#
19-
environment ENV.fetch('RAILS_ENV', 'development')
20-
21-
# Specifies the `pidfile` that Puma will use.
22-
pidfile ENV.fetch('PIDFILE', 'tmp/pids/server.pid')
23-
24-
# Specifies the number of `workers` to boot in clustered mode.
25-
# Workers are forked web server processes. If using threads and workers together
26-
# the concurrency of the application would be max `threads` * `workers`.
27-
# Workers do not work on JRuby or Windows (both of which do not support
28-
# processes).
14+
# As a rule of thumb, increasing the number of threads will increase how much
15+
# traffic a given process can handle (throughput), but due to CRuby's
16+
# Global VM Lock (GVL) it has diminishing returns and will degrade the
17+
# response time (latency) of the application.
2918
#
30-
# workers ENV.fetch("WEB_CONCURRENCY") { 2 }
31-
32-
# Use the `preload_app!` method when specifying a `workers` number.
33-
# This directive tells Puma to first boot the application and load code
34-
# before forking the application. This takes advantage of Copy On Write
35-
# process behavior so workers use less memory.
19+
# The default is set to 3 threads as it's deemed a decent compromise between
20+
# throughput and latency for the average Rails application.
3621
#
37-
# preload_app!
22+
# Any libraries that use a connection pool or another resource pool should
23+
# be configured to provide at least as many connections as the number of
24+
# threads. This includes Active Record's `pool` parameter in `database.yml`.
25+
threads_count = ENV.fetch('RAILS_MAX_THREADS', 3)
26+
threads threads_count, threads_count
27+
28+
# Specifies the `port` that Puma will listen on to receive requests; default is 3000.
29+
port ENV.fetch('PORT', 3000)
3830

39-
# Allow puma to be restarted by `rails restart` command.
31+
# Allow puma to be restarted by `bin/rails restart` command.
4032
plugin :tmp_restart
33+
34+
# Specify the PID file. Defaults to tmp/pids/server.pid in development.
35+
# In other environments, only set the PID file if requested.
36+
pidfile ENV['PIDFILE'] if ENV['PIDFILE']

0 commit comments

Comments
 (0)