Skip to content

Commit 4eed1fe

Browse files
justin808claude
andcommitted
Add Thruster HTTP/2 proxy for improved performance
This commit integrates Thruster, a zero-config HTTP/2 proxy from Basecamp, to replace direct Puma --early-hints usage across all Procfiles. Key changes: - Add thruster gem to Gemfile - Update all Procfiles to use "bundle exec thrust bin/rails server" instead of direct Puma with --early-hints - Switch shakapacker from git branch to stable version 9.3.0 - Remove custom shakapacker build from npm postinstall script Benefits: - HTTP/2 support with automatic TLS termination - Asset caching and compression - Simplified configuration compared to manual early hints - Better performance for static assets 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent b6255d5 commit 4eed1fe

File tree

8 files changed

+19
-27
lines changed

8 files changed

+19
-27
lines changed

Gemfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
66
ruby "3.4.6"
77

88
gem "react_on_rails", "16.1.1"
9-
gem "shakapacker", github: "shakacode/shakapacker", branch: "justin808/early-hints"
9+
gem "shakapacker", "9.3.0"
1010

1111
# Bundle edge Rails instead: gem "rails", github: "rails/rails"
1212
gem "listen"
@@ -15,6 +15,7 @@ gem "rails", "~> 8.0"
1515
gem "pg"
1616

1717
gem "puma"
18+
gem "thruster"
1819

1920
# Use SCSS for stylesheets
2021
gem "sass-rails"

Gemfile.lock

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,3 @@
1-
GIT
2-
remote: https://github.com/shakacode/shakapacker.git
3-
revision: 915edce51481bb1135853f9b877fd243623a9820
4-
branch: justin808/early-hints
5-
specs:
6-
shakapacker (9.3.0.beta.2)
7-
activesupport (>= 5.2)
8-
package_json
9-
rack-proxy (>= 0.6.1)
10-
railties (>= 5.2)
11-
semantic_range (>= 2.3.0)
12-
131
GEM
142
remote: https://rubygems.org/
153
specs:
@@ -152,7 +140,6 @@ GEM
152140
factory_bot_rails (6.4.3)
153141
factory_bot (~> 6.4)
154142
railties (>= 5.0.0)
155-
ffi (1.17.2)
156143
ffi (1.17.2-arm64-darwin)
157144
ffi (1.17.2-x86_64-linux-gnu)
158145
foreman (0.88.1)
@@ -193,7 +180,6 @@ GEM
193180
matrix (0.4.2)
194181
method_source (1.1.0)
195182
mini_mime (1.1.5)
196-
mini_portile2 (2.8.9)
197183
minitest (5.26.0)
198184
mize (0.4.1)
199185
protocol (~> 2.0)
@@ -207,9 +193,6 @@ GEM
207193
net-smtp (0.5.1)
208194
net-protocol
209195
nio4r (2.7.4)
210-
nokogiri (1.18.10)
211-
mini_portile2 (~> 2.8.2)
212-
racc (~> 1.4)
213196
nokogiri (1.18.10-arm64-darwin)
214197
racc (~> 1.4)
215198
nokogiri (1.18.10-x86_64-linux-gnu)
@@ -398,6 +381,12 @@ GEM
398381
websocket (~> 1.0)
399382
semantic_range (3.1.0)
400383
sexp_processor (4.17.1)
384+
shakapacker (9.3.0)
385+
activesupport (>= 5.2)
386+
package_json
387+
rack-proxy (>= 0.6.1)
388+
railties (>= 5.2)
389+
semantic_range (>= 2.3.0)
401390
simplecov (0.21.2)
402391
docile (~> 1.1)
403392
simplecov-html (~> 0.11)
@@ -423,6 +412,8 @@ GEM
423412
mize
424413
tins (~> 1.0)
425414
thor (1.4.0)
415+
thruster (0.1.16-arm64-darwin)
416+
thruster (0.1.16-x86_64-linux)
426417
tilt (2.4.0)
427418
timeout (0.4.3)
428419
tins (1.33.0)
@@ -459,7 +450,6 @@ GEM
459450
PLATFORMS
460451
arm64-darwin
461452
arm64-darwin-22
462-
ruby
463453
x86_64-linux
464454
x86_64-linux-gnu
465455

@@ -502,10 +492,11 @@ DEPENDENCIES
502492
scss_lint
503493
sdoc
504494
selenium-webdriver (~> 4)
505-
shakapacker!
495+
shakapacker (= 9.3.0)
506496
spring
507497
spring-commands-rspec
508498
stimulus-rails (~> 1.3)
499+
thruster
509500
turbo-rails (~> 2.0)
510501
uglifier
511502
web-console

Procfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
web: bundle exec puma -C config/puma.rb --early-hints
1+
web: bundle exec thrust bin/rails server

Procfile.dev

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# You can run these commands in separate shells
33
rescript: yarn res:dev
44
redis: redis-server
5-
rails: bundle exec rails s -p 3000
5+
rails: bundle exec thrust bin/rails server -p 3000
66
# Sleep to allow rescript files to compile before starting webpack
77
wp-client: sleep 5 && RAILS_ENV=development NODE_ENV=development bin/shakapacker-dev-server
88
wp-server: sleep 5 && bundle exec rake react_on_rails:locale && HMR=true SERVER_BUNDLE_ONLY=yes bin/shakapacker --watch

Procfile.dev-prod-assets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# You can run these commands in separate shells
2-
web: bin/rails s -p 3001 --early-hints
2+
web: bundle exec thrust bin/rails server -p 3001
33
redis: redis-server
44

55
# Next line runs a watch process with webpack to compile the changed files.

Procfile.dev-static

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# You can run these commands in separate shells
2-
web: rails s -p 3000
2+
web: bundle exec thrust bin/rails server -p 3000
33
redis: redis-server
44

55
# Next line runs a watch process with webpack to compile the changed files.

Procfile.dev-static-assets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# You can run these commands in separate shells
2-
web: bin/rails s -p 3000
2+
web: bundle exec thrust bin/rails server -p 3000
33
redis: redis-server
44

55
# Next line runs a watch process with webpack to compile the changed files.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
},
1818
"homepage": "https://github.com/shakacode/react-webpack-rails-tutorial",
1919
"scripts": {
20-
"postinstall": "patch-package && if [ -f node_modules/shakapacker/package/index.ts ] && [ ! -f node_modules/shakapacker/package/index.js ]; then cd node_modules/shakapacker && yarn install --production=false && yarn build; fi",
20+
"postinstall": "patch-package",
2121
"res:clean": "rescript clean",
2222
"res:format": "rescript format -all",
2323
"res:dev": "yarn res:clean && rescript build -w",
@@ -92,7 +92,7 @@
9292
"sass": "^1.58.3",
9393
"sass-loader": "^13.3.2",
9494
"sass-resources-loader": "^2.2.5",
95-
"shakapacker": "github:shakacode/shakapacker#justin808/early-hints",
95+
"shakapacker": "9.3.0",
9696
"stimulus": "^3.0.1",
9797
"style-loader": "^3.3.1",
9898
"swc-loader": "^0.2.6",

0 commit comments

Comments
 (0)