Skip to content

Commit

Permalink
Better & cheaper initial experience on Heroku (#1525)
Browse files Browse the repository at this point in the history
This PR does a few things to make the process of setting up an app on
Heroku better and cheaper.

1. It adds a buildpack for `jemalloc` and sets the `JEMALLOC_ENABLED`
   ENV var. Fixes: #1524
2. Makes the initial setup cheaper by using smaller dynos and the entry
   level for a number of addons. Fixes: #1127
3. Removes the Sentry addon. This was redundant since Honeybadger was
   already included, and Sentry isn't supported in review apps on
   Heroku, so having it in `app.json` prevents the use of review apps
   entirely which is frustrating. Fixes: #1521
4. Sets `RAILS_MAX_THREADS` and `WEB_CONCURRENCY` to match the values
   suggested by heroku here: https://devcenter.heroku.com/articles/deploying-rails-applications-with-the-puma-web-server#recommended-default-puma-process-and-thread-configuration
   Fixes: #1523
  • Loading branch information
jagthedrummer authored Jun 13, 2024
1 parent 73f1e64 commit 2c89d70
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions app.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,27 @@
"keywords": ["ruby", "rails"],
"buildpacks": [
{ "url": "heroku/nodejs" },
{ "url": "https://github.com/gaffneyc/heroku-buildpack-jemalloc.git" },
{ "url": "heroku/ruby" }
],
"formation": {
"web": {
"quantity": 1,
"size": "standard-1x"
"size": "basic"
},
"worker": {
"quantity": 1,
"size": "standard-1x"
"size": "basic"
}
},
"addons": [
"heroku-postgresql:standard-0",
"heroku-redis:premium-0",
"memcachier:100",
"bucketeer:hobbyist",
"heroku-postgresql:essential-0",
"heroku-redis:mini",
"memcachier:dev",
"cloudinary:starter",
"scheduler:standard",
"rails-autoscale:white",
"honeybadger:basic",
"sentry:f1"
"honeybadger:basic"
],
"env": {
"BASE_URL": {
Expand All @@ -46,6 +45,18 @@
"description": "This ensures the Super Scaffolding templates don't show up in production.",
"generator": "secret",
"required": true
},
"RAILS_MAX_THREADS": {
"description": "The maximum number of threads that puma will fork. https://devcenter.heroku.com/articles/deploying-rails-applications-with-the-puma-web-server#recommended-default-puma-process-and-thread-configuration",
"value": "5"
},
"WEB_CONCURRENCY": {
"description": "The number of workers per puma thread. We set it low to prevent OOM errors on new heroku apps. If you move to larger dynos you can increase this. https://devcenter.heroku.com/articles/deploying-rails-applications-with-the-puma-web-server#recommended-default-puma-process-and-thread-configuration",
"value": "2"
},
"JEMALLOC_ENABLED": {
"description": "Activate the jemalloc buildpack. https://elements.heroku.com/buildpacks/gaffneyc/heroku-buildpack-jemalloc",
"value": true
}
}
}

0 comments on commit 2c89d70

Please sign in to comment.