diff --git a/frameworks/Ruby/sinatra/Gemfile b/frameworks/Ruby/sinatra/Gemfile index c6346471ce21..88720bf547b9 100644 --- a/frameworks/Ruby/sinatra/Gemfile +++ b/frameworks/Ruby/sinatra/Gemfile @@ -4,22 +4,27 @@ gem 'activerecord', '~> 7.2', require: 'active_record' gem 'json', '~> 2.8' gem 'sinatra', '~> 4.0', require: 'sinatra/base' -group :mysql do +group :mysql, optional: true do gem 'mysql2', '~> 0.5', :platforms=>[:ruby, :mswin] end -group :postgresql do +group :postgresql, optional: true do gem 'pg', '~> 1.5', platforms: [:ruby, :mswin] end -group :passenger do +group :passenger, optional: true do gem 'passenger', '~> 6.0', platforms: [:ruby, :mswin], require: false end -group :puma do +group :puma, optional: true do gem 'puma', '~> 6.4', require: false end group :unicorn do gem 'unicorn', '~> 6.1', platforms: [:ruby, :mswin], require: false end + +group :agoo, optional: true do + gem 'agoo', require: false + gem 'rackup' +end diff --git a/frameworks/Ruby/sinatra/Gemfile.lock b/frameworks/Ruby/sinatra/Gemfile.lock index db7773ad559c..ddfcc1fb8be8 100644 --- a/frameworks/Ruby/sinatra/Gemfile.lock +++ b/frameworks/Ruby/sinatra/Gemfile.lock @@ -18,6 +18,7 @@ GEM minitest (>= 5.1) securerandom (>= 0.3) tzinfo (~> 2.0, >= 2.0.5) + agoo (2.15.13) base64 (0.2.0) bigdecimal (3.1.8) concurrent-ruby (1.3.4) @@ -74,11 +75,13 @@ PLATFORMS DEPENDENCIES activerecord (~> 7.2) + agoo json (~> 2.8) mysql2 (~> 0.5) passenger (~> 6.0) pg (~> 1.5) puma (~> 6.4) + rackup sinatra (~> 4.0) unicorn (~> 6.1) diff --git a/frameworks/Ruby/sinatra/benchmark_config.json b/frameworks/Ruby/sinatra/benchmark_config.json index 2c0be64ed472..3e318c9aa587 100644 --- a/frameworks/Ruby/sinatra/benchmark_config.json +++ b/frameworks/Ruby/sinatra/benchmark_config.json @@ -44,6 +44,28 @@ "versus": "rack-postgres-puma-mri", "notes": "" }, + "postgres-agoo-mri": { + "json_url": "/json", + "db_url": "/db", + "query_url": "/queries?queries=", + "fortune_url": "/fortunes", + "update_url": "/updates?queries=", + "plaintext_url": "/plaintext", + "port": 8080, + "approach": "Realistic", + "classification": "Micro", + "database": "Postgres", + "framework": "sinatra", + "language": "Ruby", + "orm": "Full", + "platform": "Rack", + "webserver": "Agoo", + "os": "Linux", + "database_os": "Linux", + "display_name": "sinatra-postgres-agoo-mri", + "versus": "rack-postgres-agoo-mri", + "notes": "" + }, "postgres-passenger-mri": { "db_url": "/db", "query_url": "/queries?queries=", diff --git a/frameworks/Ruby/sinatra/boot.rb b/frameworks/Ruby/sinatra/boot.rb index f8cc4be86c32..261e12f11451 100644 --- a/frameworks/Ruby/sinatra/boot.rb +++ b/frameworks/Ruby/sinatra/boot.rb @@ -10,14 +10,13 @@ SERVER_STRING = if defined?(PhusionPassenger) - [ - PhusionPassenger::SharedConstants::SERVER_TOKEN_NAME, - PhusionPassenger::VERSION_STRING - ].join('/').freeze + 'passenger' elsif defined?(Puma) - Puma::Const::PUMA_SERVER_STRING + 'puma' elsif defined?(Unicorn) - Unicorn::HttpParser::DEFAULTS['SERVER_SOFTWARE'] + 'unicorn' + elsif defined?(Agoo) + 'agoo' end Bundler.require(:default) # Load core modules diff --git a/frameworks/Ruby/sinatra/sinatra-postgres-agoo-mri.dockerfile b/frameworks/Ruby/sinatra/sinatra-postgres-agoo-mri.dockerfile new file mode 100644 index 000000000000..c6f2f33c4a16 --- /dev/null +++ b/frameworks/Ruby/sinatra/sinatra-postgres-agoo-mri.dockerfile @@ -0,0 +1,20 @@ +FROM ruby:3.4-rc + +ENV RUBY_YJIT_ENABLE=1 + +# Use Jemalloc +RUN apt-get update && \ + apt-get install -y --no-install-recommends libjemalloc2 +ENV LD_PRELOAD=libjemalloc.so.2 + +ADD ./ /sinatra +WORKDIR /sinatra + +ENV BUNDLE_WITH=postgresql:agoo +RUN bundle install --jobs=4 --gemfile=/sinatra/Gemfile + +ENV DBTYPE=postgresql + +EXPOSE 8080 + +CMD RACK_ENV=production bundle exec rackup -r agoo -s agoo -p 8080 -q -O workers=$(ruby config/auto_tune.rb | grep -Eo '[0-9]+' | head -n 1) diff --git a/frameworks/Ruby/sinatra/sinatra-postgres-passenger-mri.dockerfile b/frameworks/Ruby/sinatra/sinatra-postgres-passenger-mri.dockerfile index 672444b4daee..78bbf09f2a6a 100644 --- a/frameworks/Ruby/sinatra/sinatra-postgres-passenger-mri.dockerfile +++ b/frameworks/Ruby/sinatra/sinatra-postgres-passenger-mri.dockerfile @@ -10,7 +10,7 @@ ENV LD_PRELOAD=libjemalloc.so.2 ADD ./ /sinatra WORKDIR /sinatra -ENV BUNDLE_WITHOUT=mysql:puma:unicorn +ENV BUNDLE_WITH=postgresql:passenger RUN bundle install --jobs=4 --gemfile=/sinatra/Gemfile # TODO: https://github.com/phusion/passenger/issues/1916 diff --git a/frameworks/Ruby/sinatra/sinatra-postgres-unicorn-mri.dockerfile b/frameworks/Ruby/sinatra/sinatra-postgres-unicorn-mri.dockerfile index 882d124c895a..4ca88527522e 100644 --- a/frameworks/Ruby/sinatra/sinatra-postgres-unicorn-mri.dockerfile +++ b/frameworks/Ruby/sinatra/sinatra-postgres-unicorn-mri.dockerfile @@ -10,7 +10,7 @@ ENV LD_PRELOAD=libjemalloc.so.2 ADD ./ /sinatra WORKDIR /sinatra -ENV BUNDLE_WITHOUT=mysql:passenger:puma +ENV BUNDLE_WITH=postgresql:unicorn RUN bundle install --jobs=4 --gemfile=/sinatra/Gemfile ENV DBTYPE=postgresql diff --git a/frameworks/Ruby/sinatra/sinatra-postgres.dockerfile b/frameworks/Ruby/sinatra/sinatra-postgres.dockerfile index 62b6c607bb43..2162bc12caa1 100644 --- a/frameworks/Ruby/sinatra/sinatra-postgres.dockerfile +++ b/frameworks/Ruby/sinatra/sinatra-postgres.dockerfile @@ -10,7 +10,7 @@ ENV LD_PRELOAD=libjemalloc.so.2 ADD ./ /sinatra WORKDIR /sinatra -ENV BUNDLE_WITHOUT=mysql:passenger:unicorn +ENV BUNDLE_WITH=postgresql:puma RUN bundle install --jobs=4 --gemfile=/sinatra/Gemfile ENV DBTYPE=postgresql diff --git a/frameworks/Ruby/sinatra/sinatra.dockerfile b/frameworks/Ruby/sinatra/sinatra.dockerfile index 4de24d6bae2b..19a64c836a6f 100644 --- a/frameworks/Ruby/sinatra/sinatra.dockerfile +++ b/frameworks/Ruby/sinatra/sinatra.dockerfile @@ -10,7 +10,7 @@ ENV LD_PRELOAD=libjemalloc.so.2 ADD ./ /sinatra WORKDIR /sinatra -ENV BUNDLE_WITHOUT=postgresql:passenger:unicorn +ENV BUNDLE_WITH=mysql:puma RUN bundle install --jobs=4 --gemfile=/sinatra/Gemfile ENV DBTYPE=mysql