Skip to content

Commit 4f2495b

Browse files
committed
feat: Optimize Heroku configuration with production best practices
- Add jemalloc buildpack for 20-40% memory reduction - Configure WEB_CONCURRENCY=2 for Puma workers on basic dynos - Set RAILS_MAX_THREADS=5 for optimal thread pool size - Enable JEMALLOC_ENABLED flag for buildpack activation - Remove postdeploy from main app (keep only for review apps) - Migrations now run in release phase (Procfile) before new code goes live Based on best practices from Mastodon, Chatwoot, and Bullet Train Rails apps. Authored by: Aaron Lippold<lippold@gmail.com>
1 parent 4a374db commit 4f2495b

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

app.json

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
{
77
"url": "heroku/nodejs"
88
},
9+
{
10+
"url": "https://github.com/gaffneyc/heroku-buildpack-jemalloc.git"
11+
},
912
{
1013
"url": "heroku/ruby"
1114
}
@@ -23,6 +26,18 @@
2326
},
2427
"RAILS_LOG_TO_STDOUT": {
2528
"value": "true"
29+
},
30+
"WEB_CONCURRENCY": {
31+
"description": "Number of Puma worker processes. Set to 2 for basic dynos, can increase for larger dynos.",
32+
"value": "2"
33+
},
34+
"RAILS_MAX_THREADS": {
35+
"description": "Maximum number of threads per Puma worker. Default Rails setting.",
36+
"value": "5"
37+
},
38+
"JEMALLOC_ENABLED": {
39+
"description": "Enable jemalloc for better memory management (20-40% reduction).",
40+
"value": "true"
2641
}
2742
},
2843
"formation": {
@@ -31,9 +46,6 @@
3146
"size": "basic"
3247
}
3348
},
34-
"scripts": {
35-
"postdeploy": "DISABLE_DATABASE_ENVIRONMENT_CHECK=1 bundle exec rails db:schema:load db:seed"
36-
},
3749
"environments": {
3850
"review": {
3951
"addons": ["heroku-postgresql:essential-0"],

0 commit comments

Comments
 (0)