* Remove `load_middlewares` call `Rage.load_middlewares` was deprecated in v1.5 * Bump to Rage >= 1.10 * Remove `as_json` overrides * Remove env variable `RAGE_PATCH_AR_POOL` is enabled by default since v1.10 * Let Rage connect to the DB
@@ -1,6 +1,6 @@
source "https://rubygems.org"
-gem "rage-rb", "~> 1.3"
+gem "rage-rb", "~> 1.10"
gem "pg", "~> 1.0"
gem "activerecord", "~> 7.2.0", require: "active_record"
@@ -1,7 +1,3 @@
class Fortune < ApplicationRecord
self.table_name = "Fortune"
-
- def as_json(*)
- attributes
- end
end
@@ -1,9 +1,5 @@
class World < ApplicationRecord
self.table_name = "World"
alias_attribute(:randomNumber, :randomnumber)
@@ -1,4 +1,3 @@
require_relative "config/application"
run Rage.application
-Rage.load_middlewares(self)
@@ -2,16 +2,7 @@
require "etc"
-connection = {
- adapter: "postgresql",
- host: "tfb-database",
- username: "benchmarkdbuser",
- password: "benchmarkdbpass",
- database: "hello_world",
- reaping_frequency: 0,
- pool: (2 * Math.log(256 / Etc.nprocessors)).floor
-}
+pool_size = (2 * Math.log(256 / Etc.nprocessors)).floor
+puts "ActiveRecord pool size: #{pool_size}"
-puts "ActiveRecord connection options: #{connection.inspect}"
-ActiveRecord::Base.establish_connection(connection)
+ENV["DATABASE_URL"]="postgres://benchmarkdbuser:benchmarkdbpass@tfb-database/hello_world?pool=#{pool_size}&reaping_frequency=0"
@@ -8,7 +8,6 @@ RUN bundle install --jobs=8
COPY . /rage
ENV RUBY_YJIT_ENABLE=1
-ENV RAGE_PATCH_AR_POOL=1
ENV BUNDLE_FORCE_RUBY_PLATFORM=true
CMD bundle exec rage s -b 0.0.0.0 -p 8080 -e production