Skip to content

Commit 917d50a

Browse files
authored
[rack] Don't install unused servers (#9337)
For example, don't install falcon when testing puma. Also use the shorter "Puma" for the 'Server' header when using puma.
1 parent e5cffb4 commit 917d50a

File tree

6 files changed

+20
-14
lines changed

6 files changed

+20
-14
lines changed

frameworks/Ruby/rack/Gemfile

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,25 @@ source 'https://rubygems.org'
44

55
gem 'rack', '~> 3.0'
66
gem 'connection_pool', '~> 2.4'
7-
gem 'falcon', '~> 0.47', platforms: %i[ruby mswin]
87
gem 'jdbc-postgres', '~> 42.2', platforms: :jruby, require: 'jdbc/postgres'
98
gem 'json', '~> 2.6', platforms: :jruby
109
gem 'oj', '~> 3.14', platforms: %i[ruby mswin]
1110
gem 'pg', '~> 1.5', platforms: %i[ruby mswin]
12-
gem 'puma', '~> 6.4'
1311
gem 'sequel'
1412
gem 'sequel_pg', platforms: %i[ruby mswin]
1513
gem 'tzinfo-data', '1.2023.3'
16-
gem 'unicorn', '~> 6.1', platforms: %i[ruby mswin], require: false
14+
15+
group :falcon do
16+
gem 'falcon', '~> 0.47', platforms: %i[ruby mswin]
17+
end
18+
19+
group :puma do
20+
gem 'puma', '~> 6.4'
21+
end
22+
23+
group :unicorn do
24+
gem 'unicorn', '~> 6.1', platforms: %i[ruby mswin]
25+
end
1726

1827
group :development do
1928
gem 'rack-test'

frameworks/Ruby/rack/hello_world.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@ class HelloWorld
3030
SERVER_STRING = if defined?(PhusionPassenger)
3131
'Passenger'
3232
elsif defined?(Puma)
33-
Puma::Const::PUMA_SERVER_STRING
33+
'Puma'
3434
elsif defined?(Unicorn)
3535
'Unicorn'
3636
elsif defined?(Falcon)
3737
'Falcon'
3838
else
39-
' Ruby Rack'
39+
'Ruby Rack'
4040
end
4141
TEMPLATE_PREFIX = '<!DOCTYPE html>
4242
<html>

frameworks/Ruby/rack/rack-falcon.dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ ENV LD_PRELOAD=libjemalloc.so.2
99

1010
WORKDIR /rack
1111

12-
COPY Gemfile ./
12+
COPY Gemfile ./
1313

1414
ENV BUNDLE_FORCE_RUBY_PLATFORM=true
15-
RUN bundle config set without 'development test'
15+
RUN bundle config set without 'development test puma unicorn'
1616
RUN bundle install --jobs=8
1717

1818
COPY . .

frameworks/Ruby/rack/rack-jruby.dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ WORKDIR /rack
66

77
COPY Gemfile ./
88

9-
RUN bundle config set without 'development test'
9+
RUN bundle config set without 'development test falcon unicorn'
1010
RUN bundle install --jobs=8
1111

1212
COPY . .

frameworks/Ruby/rack/rack-unicorn.dockerfile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,11 @@ WORKDIR /rack
1212
COPY Gemfile ./
1313

1414
ENV BUNDLE_FORCE_RUBY_PLATFORM=true
15-
RUN bundle config set without 'development test'
15+
RUN bundle config set without 'development test falcon puma'
1616
RUN bundle install --jobs=8
1717

1818
COPY . .
1919

2020
EXPOSE 8080
2121

22-
#CMD nginx -c /rack/config/nginx.conf && bundle exec unicorn -E production -c config/unicorn.rb
23-
2422
CMD bundle exec unicorn -c config/unicorn.rb -o 0.0.0.0 -p 8080 -E production

frameworks/Ruby/rack/rack.dockerfile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,14 @@ ENV LD_PRELOAD=libjemalloc.so.2
1010

1111
WORKDIR /rack
1212

13-
COPY Gemfile ./
13+
COPY Gemfile ./
1414

1515
ENV BUNDLE_FORCE_RUBY_PLATFORM=true
16-
RUN bundle config set without 'development test'
16+
RUN bundle config set without 'development test falcon unicorn'
1717
RUN bundle install --jobs=8
1818

1919
COPY . .
2020

2121
EXPOSE 8080
2222

2323
CMD bundle exec puma -C config/puma.rb -b tcp://0.0.0.0:8080 -e production
24-

0 commit comments

Comments
 (0)