Skip to content

Commit 7ce9e81

Browse files
Merge pull request #9492 from p8/roda-sequel/iodine
[ruby/roda] Add Iodine server
2 parents 68a5018 + 6359f3f commit 7ce9e81

10 files changed

+50
-55
lines changed

frameworks/Ruby/roda-sequel/Gemfile

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,9 @@ source "https://rubygems.org"
33
gem 'base64' # required by passenger on Ruby 3.4
44
gem "erubi", "~> 1.12"
55
gem "json", "~> 2.8"
6-
gem "passenger", "~> 6.0", platforms: %i[ruby mswin], require: false
7-
gem "puma", "~> 6.2", require: false
86
gem "sequel", "~> 5.67"
97
gem "roda", "~> 3.66"
108
gem "tilt", "~> 2.1", require: "tilt/erb"
11-
gem "unicorn", "~> 6.1", platforms: %i[ruby mswin], require: false
129

1310
group :mysql do
1411
gem "mysql2", "~> 0.5", platforms: %i[ruby mswin]
@@ -18,3 +15,15 @@ group :postgresql do
1815
gem "pg", "~> 1.4", platforms: %i[ruby mswin]
1916
gem "sequel_pg", "~> 1.17", platforms: :ruby, require: false
2017
end
18+
19+
group :iodine, optional: true do
20+
gem "iodine", "~> 0.7", require: false
21+
end
22+
23+
group :puma, optional: true do
24+
gem "puma", "~> 6.2", require: false
25+
end
26+
27+
group :unicorn, optional: true do
28+
gem "unicorn", "~> 6.1", platforms: %i[ruby mswin], require: false
29+
end

frameworks/Ruby/roda-sequel/Gemfile.lock

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,11 @@ GEM
88
kgio (2.11.4)
99
mysql2 (0.5.6)
1010
nio4r (2.7.4)
11-
passenger (6.0.23)
12-
rack (>= 1.6.13)
13-
rackup
14-
rake (>= 12.3.3)
1511
pg (1.5.8)
1612
puma (6.5.0)
1713
nio4r (~> 2.0)
1814
rack (3.1.8)
19-
rackup (2.1.0)
20-
rack (>= 3)
21-
webrick (~> 1.8)
2215
raindrops (0.20.1)
23-
rake (13.2.1)
2416
roda (3.85.0)
2517
rack
2618
sequel (5.85.0)
@@ -32,7 +24,6 @@ GEM
3224
unicorn (6.1.0)
3325
kgio (~> 2.6)
3426
raindrops (~> 0.7)
35-
webrick (1.8.2)
3627

3728
PLATFORMS
3829
ruby
@@ -43,7 +34,6 @@ DEPENDENCIES
4334
erubi (~> 1.12)
4435
json (~> 2.8)
4536
mysql2 (~> 0.5)
46-
passenger (~> 6.0)
4737
pg (~> 1.4)
4838
puma (~> 6.2)
4939
roda (~> 3.66)

frameworks/Ruby/roda-sequel/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ comparing a variety of web platforms.
1212

1313
The tests will be run with:
1414

15-
* [Ruby 3.3](http://www.ruby-lang.org)
15+
* [Ruby 3.4](http://www.ruby-lang.org)
1616
* [Puma 6](http://puma.io)
17-
* [Passenger 6](https://www.phusionpassenger.com)
18-
* [Unicorn 5](https://bogomips.org/unicorn/)
17+
* [Unicorn 6](https://bogomips.org/unicorn/)
18+
* [Iodine](https://github.com/boazsegev/iodine)
1919
* [Roda 3](http://roda.jeremyevans.net)
2020
* [Sequel 5](http://sequel.jeremyevans.net)
2121
* [Erubi 1](https://github.com/jeremyevans/erubi)

frameworks/Ruby/roda-sequel/benchmark_config.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,13 @@
4444
"versus": "rack-sequel-postgres-puma-mri",
4545
"notes": ""
4646
},
47-
"postgres-passenger-mri": {
47+
"postgres-iodine-mri": {
48+
"json_url": "/json",
4849
"db_url": "/db",
4950
"query_url": "/queries?queries=",
5051
"fortune_url": "/fortunes",
5152
"update_url": "/updates?queries=",
53+
"plaintext_url": "/plaintext",
5254
"port": 8080,
5355
"approach": "Realistic",
5456
"classification": "Micro",
@@ -57,11 +59,11 @@
5759
"language": "Ruby",
5860
"orm": "Full",
5961
"platform": "Rack",
60-
"webserver": "Passenger",
62+
"webserver": "Iodine",
6163
"os": "Linux",
6264
"database_os": "Linux",
63-
"display_name": "roda-sequel-postgres-passenger-mri",
64-
"versus": "rack-sequel-postgres-passenger-mri",
65+
"display_name": "roda-sequel-postgres-iodine-mri",
66+
"versus": "rack-sequel-postgres-iodine-mri",
6567
"notes": ""
6668
},
6769
"postgres-unicorn-mri": {

frameworks/Ruby/roda-sequel/boot.rb

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,12 @@
99
SEQUEL_NO_ASSOCIATIONS = true
1010

1111
SERVER_STRING =
12-
if defined?(PhusionPassenger)
13-
[
14-
PhusionPassenger::SharedConstants::SERVER_TOKEN_NAME,
15-
PhusionPassenger::VERSION_STRING
16-
].join("/").freeze
12+
if defined?(Iodine)
13+
"Iodine"
1714
elsif defined?(Puma)
18-
Puma::Const::PUMA_SERVER_STRING
15+
"Puma"
1916
elsif defined?(Unicorn)
20-
Unicorn::HttpParser::DEFAULTS["SERVER_SOFTWARE"]
17+
"Unicorn"
2118
end
2219

2320
Bundler.require(:default) # Load core modules
@@ -48,7 +45,7 @@ def connect(dbtype)
4845
(threads = Puma.cli_config.options.fetch(:max_threads)) > 1
4946
opts[:max_connections] = (2 * Math.log(threads)).floor
5047
opts[:pool_timeout] = 10
51-
else
48+
elsif defined?(Unicorn)
5249
Sequel.single_threaded = true
5350
end
5451

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
FROM ruby:3.4
2+
3+
ADD ./ /roda-sequel
4+
WORKDIR /roda-sequel
5+
6+
ENV RUBY_YJIT_ENABLE=1
7+
8+
# Use Jemalloc
9+
RUN apt-get update && \
10+
apt-get install -y --no-install-recommends libjemalloc2
11+
ENV LD_PRELOAD=libjemalloc.so.2
12+
13+
ENV BUNDLE_FORCE_RUBY_PLATFORM=true
14+
RUN bundle config set with 'iodine'
15+
RUN bundle install --jobs=8
16+
17+
ENV DBTYPE=postgresql
18+
19+
EXPOSE 8080
20+
21+
CMD bundle exec iodine -p 8080

frameworks/Ruby/roda-sequel/roda-sequel-postgres-passenger-mri.dockerfile

Lines changed: 0 additions & 27 deletions
This file was deleted.

frameworks/Ruby/roda-sequel/roda-sequel-postgres-unicorn-mri.dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ RUN apt-get update && \
1111
ENV LD_PRELOAD=libjemalloc.so.2
1212

1313
ENV BUNDLE_FORCE_RUBY_PLATFORM=true
14+
RUN bundle config set with 'unicorn'
1415
RUN bundle install --jobs=8
1516

1617
ENV DBTYPE=postgresql

frameworks/Ruby/roda-sequel/roda-sequel-postgres.dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ RUN apt-get update && \
1111
ENV LD_PRELOAD=libjemalloc.so.2
1212

1313
ENV BUNDLE_FORCE_RUBY_PLATFORM=true
14+
RUN bundle config set with 'puma'
1415
RUN bundle install --jobs=8
1516

1617
ENV DBTYPE=postgresql

frameworks/Ruby/roda-sequel/roda-sequel.dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ RUN apt-get update && \
1111
ENV LD_PRELOAD=libjemalloc.so.2
1212

1313
ENV BUNDLE_FORCE_RUBY_PLATFORM=true
14+
RUN bundle config set with 'puma'
1415
RUN bundle install --jobs=8
1516

1617
ENV DBTYPE=mysql

0 commit comments

Comments
 (0)