Skip to content

Commit 1d584f8

Browse files
authored
[ruby/rack] Add Passenger server (#9762)
Passenger has been removed from most framework tests. This adds it to Rack, so we at least test it once.
1 parent 76d5040 commit 1d584f8

File tree

5 files changed

+68
-11
lines changed

5 files changed

+68
-11
lines changed

frameworks/Ruby/rack/Gemfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ group :iodine, optional: true do
2222
gem 'iodine', '~> 0.7', platforms: %i[ruby mswin]
2323
end
2424

25+
group :passenger, optional: true do
26+
gem 'base64' # required by passenger on Ruby 3.4
27+
gem 'passenger', '~> 6.0', platforms: [:ruby, :mswin], require: false
28+
end
29+
2530
group :pitchfork, optional: true do
2631
gem 'pitchfork', '~> 0.17'
2732
end

frameworks/Ruby/rack/Gemfile.lock

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ GEM
3232
async-service (0.13.0)
3333
async
3434
async-container (~> 0.16)
35+
base64 (0.2.0)
3536
bigdecimal (3.1.9)
3637
concurrent-ruby (1.3.5)
3738
connection_pool (2.5.0)
@@ -75,6 +76,10 @@ GEM
7576
parser (3.3.7.1)
7677
ast (~> 2.4.1)
7778
racc
79+
passenger (6.0.26)
80+
rack (>= 1.6.13)
81+
rackup (>= 2.0.0)
82+
rake (>= 12.3.3)
7883
pg (1.5.9)
7984
pitchfork (0.17.0)
8085
logger
@@ -95,8 +100,11 @@ GEM
95100
rack (3.1.11)
96101
rack-test (2.2.0)
97102
rack (>= 1.3)
103+
rackup (2.2.1)
104+
rack (>= 3)
98105
rainbow (3.1.1)
99106
raindrops (0.20.1)
107+
rake (13.2.1)
100108
regexp_parser (2.10.0)
101109
rubocop (1.73.2)
102110
json (~> 2.3)
@@ -137,11 +145,13 @@ PLATFORMS
137145
x86_64-linux
138146

139147
DEPENDENCIES
148+
base64
140149
connection_pool (~> 2.4)
141150
falcon (~> 0.47)
142151
iodine (~> 0.7)
143152
jdbc-postgres (~> 42.2)
144153
json (~> 2.10)
154+
passenger (~> 6.0)
145155
pg (~> 1.5)
146156
pitchfork (~> 0.17)
147157
puma (~> 6.5)

frameworks/Ruby/rack/benchmark_config.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,27 @@
107107
"display_name": "rack-puma-jruby-sequel-raw",
108108
"notes": ""
109109
},
110+
"passenger": {
111+
"json_url": "/json",
112+
"plaintext_url": "/plaintext",
113+
"db_url": "/db",
114+
"query_url": "/queries?queries=",
115+
"fortune_url": "/fortunes",
116+
"update_url": "/updates?queries=",
117+
"port": 8080,
118+
"approach": "Realistic",
119+
"classification": "Micro",
120+
"orm": "raw",
121+
"database": "Postgres",
122+
"framework": "rack",
123+
"language": "Ruby",
124+
"platform": "Jruby",
125+
"webserver": "Passenger",
126+
"os": "Linux",
127+
"database_os": "Linux",
128+
"display_name": "rack-passenger-mri-sequel-raw",
129+
"notes": ""
130+
},
110131
"pitchfork": {
111132
"json_url": "/json",
112133
"plaintext_url": "/plaintext",

frameworks/Ruby/rack/hello_world.rb

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,7 @@ class HelloWorld
2525
PLAINTEXT_TYPE = 'text/plain'
2626
DATE = 'Date'
2727
SERVER = 'Server'
28-
SERVER_STRING = if defined?(Puma)
29-
'Puma'
30-
elsif defined?(Iodine)
31-
'Iodine'
32-
elsif defined?(Unicorn)
33-
'Unicorn'
34-
elsif defined?(Falcon)
35-
'Falcon'
36-
else
37-
'Ruby Rack'
38-
end
28+
SERVER_STRING = 'Rack'
3929
TEMPLATE_PREFIX = '<!DOCTYPE html>
4030
<html>
4131
<head>
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
FROM ruby:3.4
2+
3+
ENV RUBY_YJIT_ENABLE=1
4+
5+
# Use Jemalloc
6+
RUN apt-get update && \
7+
apt-get install -y --no-install-recommends libjemalloc2
8+
ENV LD_PRELOAD=libjemalloc.so.2
9+
10+
WORKDIR /rack
11+
12+
COPY Gemfile ./
13+
14+
ENV BUNDLE_FORCE_RUBY_PLATFORM=true
15+
RUN bundle config set with 'passenger'
16+
RUN bundle install --jobs=8
17+
18+
COPY . .
19+
20+
# TODO: https://github.com/phusion/passenger/issues/1916
21+
ENV _PASSENGER_FORCE_HTTP_SESSION=true
22+
23+
RUN ruby config/auto_tune.rb | grep -Eo '[0-9]+' | head -n 1 > instances
24+
25+
EXPOSE 8080
26+
27+
CMD bundle exec passenger start --log-level 1 \
28+
--engine builtin --disable-turbocaching --disable-security-update-check \
29+
--spawn-method direct --max-pool-size $(cat instances) --min-instances $(cat instances) --max-request-queue-size 1024 \
30+
--address 0.0.0.0 --port 8080 --environment production
31+

0 commit comments

Comments
 (0)