Skip to content

Commit

Permalink
feat: Upgrade to Rails 7.2
Browse files Browse the repository at this point in the history
The secret key base will be loaded from rubyconfig settings.yml, instead
of Rails credentials, since the actual configuration for a deployment
never will be part of this repository, and deploying a key and an
encrypted blob from the same configuration management or deployment
pipeline is not only useless but cumbersome too.
  • Loading branch information
jgraichen committed Oct 9, 2024
1 parent 555c7b4 commit 0eb9802
Show file tree
Hide file tree
Showing 27 changed files with 599 additions and 363 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,8 @@
!/.yarn/sdks
!/.yarn/versions

# Ignore env-overrides for configs
# Ignore overrides for configuration files
config/environments/*.local.yml
config/hutch.*.yml
config/settings.local.yml
config/settings/*.local.yml
1 change: 1 addition & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require:
- rubocop-factory_bot
- rubocop-performance
- rubocop-rails
- rubocop-rspec
Expand Down
6 changes: 4 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ source 'https://rubygems.org'

ruby '~> 3.2'

gem 'config', '~> 5.5'
gem 'dry-validation', '~> 1.10'
gem 'forked', '~> 0.1.2'
gem 'puma', '~> 6.4'
gem 'rails', '~> 7.1.0'
gem 'rails', '~> 7.2.0'
gem 'unicorn', '~> 6.0'

gem 'active_record_upsert', '~> 0.11.0'
gem 'active_record_upsert', github: 'jesjos/active_record_upsert', ref: 'c3e07ae'

gem 'bulk_insert', '~> 1.8'
gem 'hutch', '~> 1.1'
Expand Down
177 changes: 102 additions & 75 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,87 +1,89 @@
GIT
remote: https://github.com/jesjos/active_record_upsert.git
revision: c3e07aecf28d6a81a06fcada4710b103dfca823b
ref: c3e07ae
specs:
active_record_upsert (0.11.2)
activerecord (>= 5.2, < 8.0)
pg (>= 0.18, < 2.0)

GEM
remote: https://rubygems.org/
specs:
actioncable (7.1.4)
actionpack (= 7.1.4)
activesupport (= 7.1.4)
actioncable (7.2.1)
actionpack (= 7.2.1)
activesupport (= 7.2.1)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
zeitwerk (~> 2.6)
actionmailbox (7.1.4)
actionpack (= 7.1.4)
activejob (= 7.1.4)
activerecord (= 7.1.4)
activestorage (= 7.1.4)
activesupport (= 7.1.4)
mail (>= 2.7.1)
net-imap
net-pop
net-smtp
actionmailer (7.1.4)
actionpack (= 7.1.4)
actionview (= 7.1.4)
activejob (= 7.1.4)
activesupport (= 7.1.4)
mail (~> 2.5, >= 2.5.4)
net-imap
net-pop
net-smtp
actionmailbox (7.2.1)
actionpack (= 7.2.1)
activejob (= 7.2.1)
activerecord (= 7.2.1)
activestorage (= 7.2.1)
activesupport (= 7.2.1)
mail (>= 2.8.0)
actionmailer (7.2.1)
actionpack (= 7.2.1)
actionview (= 7.2.1)
activejob (= 7.2.1)
activesupport (= 7.2.1)
mail (>= 2.8.0)
rails-dom-testing (~> 2.2)
actionpack (7.1.4)
actionview (= 7.1.4)
activesupport (= 7.1.4)
actionpack (7.2.1)
actionview (= 7.2.1)
activesupport (= 7.2.1)
nokogiri (>= 1.8.5)
racc
rack (>= 2.2.4)
rack (>= 2.2.4, < 3.2)
rack-session (>= 1.0.1)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
actiontext (7.1.4)
actionpack (= 7.1.4)
activerecord (= 7.1.4)
activestorage (= 7.1.4)
activesupport (= 7.1.4)
useragent (~> 0.16)
actiontext (7.2.1)
actionpack (= 7.2.1)
activerecord (= 7.2.1)
activestorage (= 7.2.1)
activesupport (= 7.2.1)
globalid (>= 0.6.0)
nokogiri (>= 1.8.5)
actionview (7.1.4)
activesupport (= 7.1.4)
actionview (7.2.1)
activesupport (= 7.2.1)
builder (~> 3.1)
erubi (~> 1.11)
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
active_record_upsert (0.11.2)
activerecord (>= 5.2, < 7.2)
pg (>= 0.18, < 2.0)
activejob (7.1.4)
activesupport (= 7.1.4)
activejob (7.2.1)
activesupport (= 7.2.1)
globalid (>= 0.3.6)
activemodel (7.1.4)
activesupport (= 7.1.4)
activemodel (7.2.1)
activesupport (= 7.2.1)
activemodel-serializers-xml (1.0.3)
activemodel (>= 5.0.0.a)
activesupport (>= 5.0.0.a)
builder (~> 3.1)
activerecord (7.1.4)
activemodel (= 7.1.4)
activesupport (= 7.1.4)
activerecord (7.2.1)
activemodel (= 7.2.1)
activesupport (= 7.2.1)
timeout (>= 0.4.0)
activestorage (7.1.4)
actionpack (= 7.1.4)
activejob (= 7.1.4)
activerecord (= 7.1.4)
activesupport (= 7.1.4)
activestorage (7.2.1)
actionpack (= 7.2.1)
activejob (= 7.2.1)
activerecord (= 7.2.1)
activesupport (= 7.2.1)
marcel (~> 1.0)
activesupport (7.1.4)
activesupport (7.2.1)
base64
bigdecimal
concurrent-ruby (~> 1.0, >= 1.0.2)
concurrent-ruby (~> 1.0, >= 1.3.1)
connection_pool (>= 2.2.5)
drb
i18n (>= 1.6, < 2)
logger (>= 1.4.2)
minitest (>= 5.1)
mutex_m
tzinfo (~> 2.0)
securerandom (>= 0.3)
tzinfo (~> 2.0, >= 2.0.5)
addressable (2.8.7)
public_suffix (>= 2.0.2, < 7.0)
amq-protocol (2.3.2)
Expand Down Expand Up @@ -110,9 +112,13 @@ GEM
json
coderay (1.1.3)
concurrent-ruby (1.3.4)
config (5.5.2)
deep_merge (~> 1.2, >= 1.2.1)
ostruct
connection_pool (2.4.1)
crass (1.0.6)
date (3.3.4)
deep_merge (1.2.2)
diff-lcs (1.5.1)
draper (4.0.2)
actionpack (>= 5.0)
Expand All @@ -122,14 +128,26 @@ GEM
request_store (>= 1.0)
ruby2_keywords
drb (2.2.1)
dry-configurable (1.2.0)
dry-core (~> 1.0, < 2)
zeitwerk (~> 2.6)
dry-core (1.0.1)
concurrent-ruby (~> 1.0)
zeitwerk (~> 2.6)
dry-inflector (1.1.0)
dry-initializer (3.1.1)
dry-logic (1.5.0)
concurrent-ruby (~> 1.0)
dry-core (~> 1.0, < 2)
zeitwerk (~> 2.6)
dry-schema (1.13.4)
concurrent-ruby (~> 1.0)
dry-configurable (~> 1.0, >= 1.0.1)
dry-core (~> 1.0, < 2)
dry-initializer (~> 3.0)
dry-logic (>= 1.4, < 2)
dry-types (>= 1.7, < 2)
zeitwerk (~> 2.6)
dry-struct (1.6.0)
dry-core (~> 1.0, < 2)
dry-types (>= 1.7, < 2)
Expand All @@ -142,6 +160,12 @@ GEM
dry-inflector (~> 1.0)
dry-logic (~> 1.4)
zeitwerk (~> 2.6)
dry-validation (1.10.0)
concurrent-ruby (~> 1.0)
dry-core (~> 1.0, < 2)
dry-initializer (~> 3.0)
dry-schema (>= 1.12, < 2)
zeitwerk (~> 2.6)
erubi (1.13.0)
factory_bot (6.5.0)
activesupport (>= 5.0.0)
Expand Down Expand Up @@ -195,7 +219,6 @@ GEM
activesupport (>= 6.1)
bunny
multi_json (1.15.0)
mutex_m (0.2.0)
net-imap (0.4.16)
date
net-protocol
Expand Down Expand Up @@ -240,20 +263,20 @@ GEM
rackup (2.1.0)
rack (>= 3)
webrick (~> 1.8)
rails (7.1.4)
actioncable (= 7.1.4)
actionmailbox (= 7.1.4)
actionmailer (= 7.1.4)
actionpack (= 7.1.4)
actiontext (= 7.1.4)
actionview (= 7.1.4)
activejob (= 7.1.4)
activemodel (= 7.1.4)
activerecord (= 7.1.4)
activestorage (= 7.1.4)
activesupport (= 7.1.4)
rails (7.2.1)
actioncable (= 7.2.1)
actionmailbox (= 7.2.1)
actionmailer (= 7.2.1)
actionpack (= 7.2.1)
actiontext (= 7.2.1)
actionview (= 7.2.1)
activejob (= 7.2.1)
activemodel (= 7.2.1)
activerecord (= 7.2.1)
activestorage (= 7.2.1)
activesupport (= 7.2.1)
bundler (>= 1.15.0)
railties (= 7.1.4)
railties (= 7.2.1)
rails-assets-manifest (3.0.1)
activesupport (> 4.2)
railties (> 4.2)
Expand All @@ -267,10 +290,10 @@ GEM
rails-rfc6570 (3.2.0)
actionpack (>= 4.2, < 8.0)
addressable (~> 2.3)
railties (7.1.4)
actionpack (= 7.1.4)
activesupport (= 7.1.4)
irb
railties (7.2.1)
actionpack (= 7.2.1)
activesupport (= 7.2.1)
irb (~> 1.13)
rackup (>= 1.0.0)
rake (>= 12.2)
thor (~> 1.0, >= 1.2.2)
Expand Down Expand Up @@ -348,16 +371,17 @@ GEM
ruby-progressbar (1.13.0)
ruby2_keywords (0.0.5)
rubyzip (2.3.2)
securerandom (0.3.1)
selenium-webdriver (4.25.0)
base64 (~> 0.2)
logger (~> 1.4)
rexml (~> 3.2, >= 3.2.5)
rubyzip (>= 1.2.2, < 3.0)
websocket (~> 1.0)
sentry-rails (5.20.1)
sentry-rails (5.21.0)
railties (>= 5.0)
sentry-ruby (~> 5.20.1)
sentry-ruby (5.20.1)
sentry-ruby (~> 5.21.0)
sentry-ruby (5.21.0)
bigdecimal
concurrent-ruby (~> 1.0, >= 1.0.2)
set (1.1.0)
Expand All @@ -379,6 +403,7 @@ GEM
unicorn (6.1.0)
kgio (~> 2.6)
raindrops (~> 0.7)
useragent (0.16.10)
uuid4 (1.4.0)
base62-rb (~> 0.3.0)
web-console (4.2.1)
Expand All @@ -400,13 +425,15 @@ PLATFORMS
x86_64-linux

DEPENDENCIES
active_record_upsert (~> 0.11.0)
active_record_upsert!
bulk_insert (~> 1.8)
capybara (~> 3.32)
concurrent-ruby (~> 1.1)
config (~> 5.5)
draper (~> 4.0)
dry-struct (~> 1.6.0)
dry-types (~> 1.7.0)
dry-validation (~> 1.10)
factory_bot_rails
forked (~> 0.1.2)
has_scope (~> 0.8.0)
Expand All @@ -420,7 +447,7 @@ DEPENDENCIES
pry
pry-byebug
puma (~> 6.4)
rails (~> 7.1.0)
rails (~> 7.2.0)
rails-assets-manifest (~> 3.0, >= 3.0.0)
rails-rfc6570 (~> 3.0)
responders (~> 3.0)
Expand Down
8 changes: 8 additions & 0 deletions bin/rubocop
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env ruby
require "rubygems"
require "bundler/setup"

# explicit rubocop config increases performance slightly while avoiding config confusion.
ARGV.unshift("--config", File.expand_path("../.rubocop.yml", __dir__))

load Gem.bin_path("rubocop", "rubocop")
6 changes: 5 additions & 1 deletion bin/setup
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/env ruby
require "fileutils"

# path to your application root.
APP_ROOT = File.expand_path("..", __dir__)
APP_NAME = "server"

def system!(*args)
system(*args, exception: true)
Expand Down Expand Up @@ -30,4 +30,8 @@ FileUtils.chdir APP_ROOT do

puts "\n== Restarting application server =="
system! "bin/rails restart"

# puts "\n== Configuring puma-dev =="
# system "ln -nfs #{APP_ROOT} ~/.puma-dev/#{APP_NAME}"
# system "curl -Is https://#{APP_NAME}.test/up | head -n 1"
end
12 changes: 9 additions & 3 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,18 @@
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)

require 'csv'

module Server
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 7.1
config.load_defaults 7.2

# Manually assign the Rails secret key base from ENV or the
# rubyconfig framework instead of Rails credentials. We do not use
# encrypted credentials because this is an open-source application
# and anyone needs their own credentials. Proper deployments are a
# pain too, since they do ship the configuration, not the
# application source.
config.secret_key_base = ENV['SECRET_KEY_BASE'] || Settings.secret_key_base

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

0 comments on commit 0eb9802

Please sign in to comment.