Skip to content

Commit

Permalink
first commit to upgrade to rails 7.0 (#3353)
Browse files Browse the repository at this point in the history
This is the first pass at upgrading to rails 7.

Other than basic upgrade procedures it:
* changes the file routes a little bit due to a rails 7 bug.
* locks nokogiri for ruby 2.7 support (Ubuntu 20.04)
* locks net-imap for ruby 2.7 support (Ubuntu 20.04)
  • Loading branch information
johrstrom authored Mar 5, 2024
1 parent 215b389 commit 6d413e4
Show file tree
Hide file tree
Showing 9 changed files with 257 additions and 117 deletions.
10 changes: 8 additions & 2 deletions apps/dashboard/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ source 'https://rubygems.org'


# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '6.1.7.6'
gem 'rails', '7.0.8'

# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
Expand Down Expand Up @@ -38,6 +38,11 @@ group :development do
# gem 'web-console', '~> 2.0'
end

# lock nokogiri & net-imap to versions that are compatible with ruby 2.7.0
# Ubuntu 20.04 uses.
gem 'nokogiri', '~> 1.15', '< 1.16'
gem 'net-imap', '~> 0.3', '< 0.4'

# Extra third-party gems
gem 'dotenv-rails', '~> 2.1'
gem 'redcarpet', '~> 3.3'
Expand All @@ -53,6 +58,8 @@ gem 'rss', '~> 0.2'

gem 'jsbundling-rails', '~> 1.0'
gem 'cssbundling-rails', '~> 1.1'
# should upgrade to propshaft - only have an issue with fontawesome icons
gem 'sprockets-rails', '>= 2.0.0'

# OOD specific gems
gem 'ood_support', '~> 0.0.2'
Expand All @@ -66,4 +73,3 @@ gem "sinatra", require: false
gem "sinatra-contrib", require: false
gem "erubi", require: false
gem "dalli", require: false

133 changes: 71 additions & 62 deletions apps/dashboard/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,65 +1,71 @@
GEM
remote: https://rubygems.org/
specs:
actioncable (6.1.7.6)
actionpack (= 6.1.7.6)
activesupport (= 6.1.7.6)
actioncable (7.0.8)
actionpack (= 7.0.8)
activesupport (= 7.0.8)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailbox (6.1.7.6)
actionpack (= 6.1.7.6)
activejob (= 6.1.7.6)
activerecord (= 6.1.7.6)
activestorage (= 6.1.7.6)
activesupport (= 6.1.7.6)
actionmailbox (7.0.8)
actionpack (= 7.0.8)
activejob (= 7.0.8)
activerecord (= 7.0.8)
activestorage (= 7.0.8)
activesupport (= 7.0.8)
mail (>= 2.7.1)
actionmailer (6.1.7.6)
actionpack (= 6.1.7.6)
actionview (= 6.1.7.6)
activejob (= 6.1.7.6)
activesupport (= 6.1.7.6)
net-imap
net-pop
net-smtp
actionmailer (7.0.8)
actionpack (= 7.0.8)
actionview (= 7.0.8)
activejob (= 7.0.8)
activesupport (= 7.0.8)
mail (~> 2.5, >= 2.5.4)
net-imap
net-pop
net-smtp
rails-dom-testing (~> 2.0)
actionpack (6.1.7.6)
actionview (= 6.1.7.6)
activesupport (= 6.1.7.6)
rack (~> 2.0, >= 2.0.9)
actionpack (7.0.8)
actionview (= 7.0.8)
activesupport (= 7.0.8)
rack (~> 2.0, >= 2.2.4)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actiontext (6.1.7.6)
actionpack (= 6.1.7.6)
activerecord (= 6.1.7.6)
activestorage (= 6.1.7.6)
activesupport (= 6.1.7.6)
actiontext (7.0.8)
actionpack (= 7.0.8)
activerecord (= 7.0.8)
activestorage (= 7.0.8)
activesupport (= 7.0.8)
globalid (>= 0.6.0)
nokogiri (>= 1.8.5)
actionview (6.1.7.6)
activesupport (= 6.1.7.6)
actionview (7.0.8)
activesupport (= 7.0.8)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0)
activejob (6.1.7.6)
activesupport (= 6.1.7.6)
activejob (7.0.8)
activesupport (= 7.0.8)
globalid (>= 0.3.6)
activemodel (6.1.7.6)
activesupport (= 6.1.7.6)
activerecord (6.1.7.6)
activemodel (= 6.1.7.6)
activesupport (= 6.1.7.6)
activestorage (6.1.7.6)
actionpack (= 6.1.7.6)
activejob (= 6.1.7.6)
activerecord (= 6.1.7.6)
activesupport (= 6.1.7.6)
activemodel (7.0.8)
activesupport (= 7.0.8)
activerecord (7.0.8)
activemodel (= 7.0.8)
activesupport (= 7.0.8)
activestorage (7.0.8)
actionpack (= 7.0.8)
activejob (= 7.0.8)
activerecord (= 7.0.8)
activesupport (= 7.0.8)
marcel (~> 1.0)
mini_mime (>= 1.1.0)
activesupport (6.1.7.6)
activesupport (7.0.8)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
zeitwerk (~> 2.3)
addressable (2.8.6)
public_suffix (>= 2.0.2, < 6.0)
autoprefixer-rails (10.2.5.1)
Expand Down Expand Up @@ -142,7 +148,7 @@ GEM
mime-types-data (3.2023.1205)
mini_mime (1.1.5)
mini_portile2 (2.8.5)
minitest (5.21.2)
minitest (5.22.0)
mocha (2.1.0)
ruby2_keywords (>= 0.0.5)
multi_json (1.15.0)
Expand All @@ -162,11 +168,11 @@ GEM
nokogiri (1.15.5)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
ood_appkit (2.1.1)
ood_appkit (2.1.4)
addressable (~> 2.4)
lograge (~> 0.3)
ood_core (~> 0.1)
rails (>= 6.0.0, < 7)
rails (>= 6.0.0)
redcarpet (~> 3.2)
ood_core (0.24.2)
ffi (~> 1.9, >= 1.9.6)
Expand All @@ -185,40 +191,40 @@ GEM
rack (~> 2.2, >= 2.2.4)
rack-test (2.1.0)
rack (>= 1.3)
rails (6.1.7.6)
actioncable (= 6.1.7.6)
actionmailbox (= 6.1.7.6)
actionmailer (= 6.1.7.6)
actionpack (= 6.1.7.6)
actiontext (= 6.1.7.6)
actionview (= 6.1.7.6)
activejob (= 6.1.7.6)
activemodel (= 6.1.7.6)
activerecord (= 6.1.7.6)
activestorage (= 6.1.7.6)
activesupport (= 6.1.7.6)
rails (7.0.8)
actioncable (= 7.0.8)
actionmailbox (= 7.0.8)
actionmailer (= 7.0.8)
actionpack (= 7.0.8)
actiontext (= 7.0.8)
actionview (= 7.0.8)
activejob (= 7.0.8)
activemodel (= 7.0.8)
activerecord (= 7.0.8)
activestorage (= 7.0.8)
activesupport (= 7.0.8)
bundler (>= 1.15.0)
railties (= 6.1.7.6)
sprockets-rails (>= 2.0.0)
railties (= 7.0.8)
rails-dom-testing (2.2.0)
activesupport (>= 5.0.0)
minitest
nokogiri (>= 1.6)
rails-html-sanitizer (1.6.0)
loofah (~> 2.21)
nokogiri (~> 1.14)
railties (6.1.7.6)
actionpack (= 6.1.7.6)
activesupport (= 6.1.7.6)
railties (7.0.8)
actionpack (= 7.0.8)
activesupport (= 7.0.8)
method_source
rake (>= 12.2)
thor (~> 1.0)
zeitwerk (~> 2.5)
rake (13.1.0)
rdoc (6.6.2)
psych (>= 4.0.0)
redcarpet (3.6.0)
regexp_parser (2.9.0)
request_store (1.5.1)
request_store (1.6.0)
rack (>= 1.4)
rest-client (2.1.0)
http-accept (>= 1.7.0, < 2.0)
Expand Down Expand Up @@ -269,7 +275,7 @@ GEM
websocket-extensions (0.1.5)
xpath (3.2.0)
nokogiri (~> 1.8)
zeitwerk (2.6.12)
zeitwerk (2.6.13)
zip_tricks (5.6.0)

PLATFORMS
Expand All @@ -292,18 +298,21 @@ DEPENDENCIES
jsbundling-rails (~> 1.0)
local_time (~> 1.0.3)
mocha (~> 2.1)
net-imap (~> 0.3, < 0.4)
nokogiri (~> 1.15, < 1.16)
ood_appkit (~> 2.1.0)
ood_core (~> 0.24.1)
ood_support (~> 0.0.2)
pbs (~> 2.2.1)
rails (= 6.1.7.6)
rails (= 7.0.8)
redcarpet (~> 3.3)
rest-client (~> 2.0)
rss (~> 0.2)
sdoc
selenium-webdriver (= 4.5.0)
sinatra
sinatra-contrib
sprockets-rails (>= 2.0.0)
timecop (~> 0.9)
webrick
zip_tricks (~> 5.5)
Expand Down
20 changes: 11 additions & 9 deletions apps/dashboard/config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,26 @@
# Show full error reports.
config.consider_all_requests_local = true

# Enable server timing
config.server_timing = true

# Enable/disable caching. By default caching is disabled.
# Run rails dev:cache to toggle caching.
if Rails.root.join('tmp', 'caching-dev.txt').exist?
if Rails.root.join("tmp/caching-dev.txt").exist?
config.action_controller.perform_caching = true
config.action_controller.enable_fragment_cache_logging = true

config.cache_store = :memory_store
config.public_file_server.headers = {
'Cache-Control' => "public, max-age=#{2.days.to_i}"
"Cache-Control" => "public, max-age=#{2.days.to_i}"
}
else
config.action_controller.perform_caching = false

config.cache_store = :null_store
end

config.cache_store = :memory_store
config.action_mailer.raise_delivery_errors = true

config.action_mailer.perform_caching = false

Expand All @@ -42,21 +48,17 @@
# Tell Active Support which deprecation messages to disallow.
config.active_support.disallowed_deprecation_warnings = []


# Raises error for missing translations.
config.i18n.raise_on_missing_translations = true

# Annotate rendered view with file names.
config.action_view.annotate_rendered_view_with_filenames = true

# Use an evented file watcher to asynchronously detect changes in source code,
# routes, locales, etc. This feature depends on the listen gem.
# config.file_watcher = ActiveSupport::EventedFileUpdateChecker

# Uncomment if you wish to allow Action Cable access from any origin.
# config.action_cable.disable_request_forgery_protection = true

config.active_job.queue_adapter = ActiveJob::QueueAdapters::AsyncAdapter.new \
min_threads: 1, max_threads: 1
config.active_job.queue_adapter = ActiveJob::QueueAdapters::AsyncAdapter.new(min_threads: 1, max_threads: 1)

config.hosts = nil
end
37 changes: 4 additions & 33 deletions apps/dashboard/config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
# your application in memory, allowing both threaded web servers
# and those relying on copy on write to perform better.
# Rake tasks automatically ignore this option for performance.
# TODO: find out why is this set to false
config.eager_load = false

# Full error reports are disabled and caching is turned on.
Expand Down Expand Up @@ -56,14 +55,8 @@

# Locales are handled in config/initializers/locales.rb.

# Send deprecation notices to registered listeners.
config.active_support.deprecation = :notify

# Log disallowed deprecations.
config.active_support.disallowed_deprecation = :log

# Tell Active Support which deprecation messages to disallow.
config.active_support.disallowed_deprecation_warnings = []
# Don't log any deprecations.
config.active_support.report_deprecations = false

# Use default logging formatter so that PID and timestamp are not suppressed.
config.log_formatter = ::Logger::Formatter.new
Expand All @@ -73,34 +66,12 @@
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')

if ENV['RAILS_LOG_TO_STDOUT'].present?
logger = ActiveSupport::Logger.new($stdout)
logger = ActiveSupport::Logger.new(STDOUT)
logger.formatter = config.log_formatter
config.logger = ActiveSupport::TaggedLogging.new(logger)
end

# Inserts middleware to perform automatic connection switching.
# The `database_selector` hash is used to pass options to the DatabaseSelector
# middleware. The `delay` is used to determine how long to wait after a write
# to send a subsequent read to the primary.
#
# The `database_resolver` class is used by the middleware to determine which
# database is appropriate to use based on the time delay.
#
# The `database_resolver_context` class is used by the middleware to set
# timestamps for the last write to the primary. The resolver uses the context
# class timestamps to determine how long to wait before reading from the
# replica.
#
# By default Rails will store a last write timestamp in the session. The
# DatabaseSelector middleware is designed as such you can define your own
# strategy for connection switching and pass that into the middleware through
# these configuration options.
# config.active_record.database_selector = { delay: 2.seconds }
# config.active_record.database_resolver = ActiveRecord::Middleware::DatabaseSelector::Resolver
# config.active_record.database_resolver_context = ActiveRecord::Middleware::DatabaseSelector::Resolver::Session

config.active_job.queue_adapter = ActiveJob::QueueAdapters::AsyncAdapter.new \
min_threads: 1, max_threads: 1
config.active_job.queue_adapter = ActiveJob::QueueAdapters::AsyncAdapter.new(min_threads: 1, max_threads: 1)

config.hosts = ENV['ALLOWED_HOSTS'].nil? ? nil : ENV['ALLOWED_HOSTS'].split(',')
end
Loading

0 comments on commit 6d413e4

Please sign in to comment.