Skip to content

Commit

Permalink
Merge pull request #353 from collectiveidea/upgrades
Browse files Browse the repository at this point in the history
Upgrades
  • Loading branch information
danielmorrison authored Oct 29, 2024
2 parents b3a54f7 + fd99e8e commit 51ae521
Show file tree
Hide file tree
Showing 22 changed files with 326 additions and 156 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ jobs:
environment:
RAILS_ENV: test
docker:
- image: cimg/ruby:3.3.4-node
- image: cimg/ruby:3.3.5-node
environment:
PGHOST: localhost
PGUSER: buildlight
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# syntax = docker/dockerfile:1

# Make sure RUBY_VERSION matches the Ruby version in .ruby-version and Gemfile
ARG RUBY_VERSION=3.3.4
ARG RUBY_VERSION=3.3.5
FROM --platform=linux/amd64 ruby:$RUBY_VERSION-alpine AS base

LABEL fly_launch_runtime="rails"
Expand Down
7 changes: 2 additions & 5 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
source "https://rubygems.org"
ruby "3.3.4"
ruby "3.3.5"

gem "rails", "~> 7.2.1"

Expand All @@ -8,17 +8,14 @@ gem "pg"
gem "bootsnap"
gem "dockerfile-rails"
gem "honeybadger"
gem "ostruct" # Required by particlerb
gem "particlerb"
gem "puma"

gem "importmap-rails"
gem "cssbundling-rails"
gem "propshaft"

# This gem is pulled in via ActionCable, so remove when the PR is merged.
# https://github.com/faye/websocket-driver-ruby/pull/85
gem "websocket-driver", github: "danielmorrison/websocket-driver-ruby", branch: "support-frozen-by-default"

group :development, :test do
gem "debug"
gem "factory_bot_rails"
Expand Down
39 changes: 17 additions & 22 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
GIT
remote: https://github.com/danielmorrison/websocket-driver-ruby.git
revision: 0e950c51343045221f8414611994439105e32b86
branch: support-frozen-by-default
specs:
websocket-driver (0.7.5)
websocket-extensions (>= 0.1.0)

GEM
remote: https://rubygems.org/
specs:
Expand Down Expand Up @@ -100,12 +92,12 @@ GEM
rails (>= 3.0.0)
drb (2.2.1)
erubi (1.13.0)
factory_bot (6.4.6)
factory_bot (6.5.0)
activesupport (>= 5.0.0)
factory_bot_rails (6.4.3)
factory_bot (~> 6.4)
factory_bot_rails (6.4.4)
factory_bot (~> 6.5)
railties (>= 5.0.0)
faraday (1.10.3)
faraday (1.10.4)
faraday-em_http (~> 1.0)
faraday-em_synchrony (~> 1.0)
faraday-excon (~> 1.1)
Expand All @@ -123,7 +115,7 @@ GEM
faraday-httpclient (1.0.1)
faraday-multipart (1.0.4)
multipart-post (~> 2)
faraday-net_http (1.0.1)
faraday-net_http (1.0.2)
faraday-net_http_persistent (1.2.0)
faraday-patron (1.0.0)
faraday-rack (1.0.0)
Expand All @@ -134,19 +126,19 @@ GEM
thor (>= 0.14.0, < 2)
globalid (1.2.1)
activesupport (>= 6.1)
honeybadger (5.16.0)
honeybadger (5.18.0)
logger
i18n (1.14.6)
concurrent-ruby (~> 1.0)
importmap-rails (2.0.1)
importmap-rails (2.0.3)
actionpack (>= 6.0.0)
activesupport (>= 6.0.0)
railties (>= 6.0.0)
io-console (0.7.2)
irb (1.14.1)
rdoc (>= 4.0.0)
reline (>= 0.4.2)
json (2.7.2)
json (2.7.4)
language_server-protocol (3.17.0.3)
lint_roller (1.1.0)
logger (1.6.1)
Expand All @@ -163,7 +155,7 @@ GEM
mini_portile2 (2.8.7)
minitest (5.25.1)
msgpack (1.7.3)
multipart-post (2.4.0)
multipart-post (2.4.1)
net-imap (0.5.0)
date
net-protocol
Expand All @@ -183,15 +175,16 @@ GEM
racc (~> 1.4)
nokogiri (1.16.7-x86_64-linux)
racc (~> 1.4)
ostruct (0.6.0)
parallel (1.26.3)
parser (3.3.5.0)
ast (~> 2.4.1)
racc
particlerb (2.1.0)
faraday (>= 0.9.0)
faraday_middleware (>= 0.9.0)
pg (1.5.8)
propshaft (0.9.0)
pg (1.5.9)
propshaft (1.1.0)
actionpack (>= 7.0.0)
activesupport (>= 7.0.0)
rack
Expand Down Expand Up @@ -318,6 +311,8 @@ GEM
unicode-display_width (2.6.0)
useragent (0.16.10)
webrick (1.8.2)
websocket-driver (0.7.6)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
zeitwerk (2.7.1)

Expand All @@ -337,6 +332,7 @@ DEPENDENCIES
figaro
honeybadger
importmap-rails
ostruct
particlerb
pg
propshaft
Expand All @@ -347,10 +343,9 @@ DEPENDENCIES
standard
standard-performance
standard-rails
websocket-driver!

RUBY VERSION
ruby 3.3.4p94
ruby 3.3.5p100

BUNDLED WITH
2.5.17
2.5.19
2 changes: 2 additions & 0 deletions app/models/status.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
class Status < ApplicationRecord
after_commit :update_devices

scope :red, -> { where(red: true) }

def name
"#{username}/#{project_name}"
end
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 = "buildlight"

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
5 changes: 3 additions & 2 deletions config/application.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
require_relative "boot"

require "rails"

# Pick the frameworks you want:
require "active_model/railtie"
require "active_job/railtie"
Expand All @@ -22,7 +21,7 @@
module Buildlight
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 7.1
config.load_defaults 7.2

# 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 All @@ -39,5 +38,7 @@ class Application < Rails::Application

config.x.debug = ENV["DEBUG"].present?
config.x.host = ENV["HOST"]
# Don't generate system test files.
config.generators.system_tests = nil
end
end
23 changes: 11 additions & 12 deletions config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# Show full error reports.
config.consider_all_requests_local = true

# Enable server timing
# Enable server timing.
config.server_timing = true

# Enable/disable caching. By default caching is disabled.
Expand All @@ -24,23 +24,22 @@
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}"
}
config.public_file_server.headers = {"Cache-Control" => "public, max-age=#{2.days.to_i}"}
else
config.action_controller.perform_caching = false

config.cache_store = :null_store
end

# Store uploaded files on the local file system (see config/storage.yml for options).
# config.active_storage.service = :local

# Don't care if the mailer can't send.
config.action_mailer.raise_delivery_errors = false

# Disable caching for Action Mailer templates even if Action Controller
# caching is enabled.
config.action_mailer.perform_caching = false

config.action_mailer.default_url_options = {host: "localhost", port: 3000}

# Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log

Expand All @@ -59,18 +58,18 @@
# Highlight code that enqueued background job in logs.
config.active_job.verbose_enqueue_logs = true

# Suppress logger output for asset requests.
config.assets.quiet = true

# 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
config.action_view.annotate_rendered_view_with_filenames = true

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

# Raise error when a before_action's only/except options reference missing actions
# Raise error when a before_action's only/except options reference missing actions.
config.action_controller.raise_on_missing_callback_actions = true

# Apply autocorrection by RuboCop to files generated by `bin/rails generate`.
# config.generators.apply_rubocop_autocorrect_after_generate!
end
16 changes: 6 additions & 10 deletions config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,13 @@
# Disable serving static files from `public/`, relying on NGINX/Apache to do so instead.
# config.public_file_server.enabled = false

# Compress CSS using a preprocessor.
# config.assets.css_compressor = :sass

# Do not fallback to assets pipeline if a precompiled asset is missed.
config.assets.compile = false

# Enable serving of images, stylesheets, and JavaScripts from an asset server.
# config.asset_host = "http://assets.example.com"

# Specifies the header that your server uses for sending files.
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for Apache
# config.action_dispatch.x_sendfile_header = "X-Accel-Redirect" # for NGINX

# Store uploaded files on the local file system (see config/storage.yml for options).
# config.active_storage.service = :local

# Mount Action Cable outside main process or domain.
# config.action_cable.mount_path = nil
# config.action_cable.url = "wss://example.com/cable"
Expand All @@ -51,6 +42,9 @@
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
config.force_ssl = true

# Skip http-to-https redirect for the default health check endpoint.
# config.ssl_options = { redirect: { exclude: ->(request) { request.path == "/up" } } }

# Log to STDOUT by default
config.logger = ActiveSupport::Logger.new($stdout)
.tap { |logger| logger.formatter = ::Logger::Formatter.new }
Expand All @@ -59,7 +53,7 @@
# Prepend all log lines with the following tags.
config.log_tags = [:request_id]

# Info include generic and useful information about system operation, but avoids logging too much
# "info" includes generic and useful information about system operation, but avoids logging too much
# information to avoid inadvertent exposure of personally identifiable information (PII). If you
# want to log everything, set the level to "debug".
config.log_level = ENV.fetch("RAILS_LOG_LEVEL", "info")
Expand All @@ -71,6 +65,8 @@
# config.active_job.queue_adapter = :resque
# config.active_job.queue_name_prefix = "buildlight_production"

# Disable caching for Action Mailer templates even if Action Controller
# caching is enabled.
config.action_mailer.perform_caching = false

# Ignore bad email addresses and do not raise email delivery errors.
Expand Down
16 changes: 8 additions & 8 deletions config/environments/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@
config.eager_load = ENV["CI"].present?

# Configure public file server for tests with Cache-Control for performance.
config.public_file_server.enabled = true
config.public_file_server.headers = {
"Cache-Control" => "public, max-age=#{1.hour.to_i}"
}
config.public_file_server.headers = {"Cache-Control" => "public, max-age=#{1.hour.to_i}"}

# Show full error reports and disable caching.
config.consider_all_requests_local = true
Expand All @@ -34,16 +31,19 @@
# Disable request forgery protection in test environment.
config.action_controller.allow_forgery_protection = false

# Store uploaded files on the local file system in a temporary directory.
# config.active_storage.service = :test

# Disable caching for Action Mailer templates even if Action Controller
# caching is enabled.
config.action_mailer.perform_caching = false

# Tell Action Mailer not to deliver emails to the real world.
# The :test delivery method accumulates sent emails in the
# ActionMailer::Base.deliveries array.
config.action_mailer.delivery_method = :test

# Unlike controllers, the mailer instance doesn't have any context about the
# incoming request so you'll need to provide the :host parameter yourself.
config.action_mailer.default_url_options = {host: "www.example.com"}

# Print deprecation notices to the stderr.
config.active_support.deprecation = :stderr

Expand All @@ -59,6 +59,6 @@
# Annotate rendered view with file names.
# config.action_view.annotate_rendered_view_with_filenames = true

# Raise error when a before_action's only/except options reference missing actions
# Raise error when a before_action's only/except options reference missing actions.
config.action_controller.raise_on_missing_callback_actions = true
end
5 changes: 0 additions & 5 deletions config/initializers/assets.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,3 @@

# Add additional assets to the asset load path.
# Rails.application.config.assets.paths << Emoji.images_path

# Precompile additional assets.
# application.js, application.css, and all non-JS/CSS in the app/assets
# folder are already added.
# Rails.application.config.assets.precompile += %w( admin.js admin.css )
2 changes: 1 addition & 1 deletion config/initializers/filter_parameter_logging.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
# Use this to limit dissemination of sensitive information.
# See the ActiveSupport::ParameterFilter documentation for supported notations and behaviors.
Rails.application.config.filter_parameters += [
:passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn
:passw, :email, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn
]
Loading

0 comments on commit 51ae521

Please sign in to comment.