From 1de4345c4db92779d012dcd3676d2df410027ca3 Mon Sep 17 00:00:00 2001 From: Schneems Date: Sat, 23 Nov 2024 15:36:01 -0600 Subject: [PATCH] Change default process type host to IPv6 `::` IPv6 is the future. Here's some more context heroku/roadmap#40. Related https://github.com/heroku/ruby-getting-started/pull/165 --- buildpacks/ruby/CHANGELOG.md | 6 ++++++ buildpacks/ruby/src/steps/get_default_process.rs | 3 ++- docs/application_contract.md | 4 ++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/buildpacks/ruby/CHANGELOG.md b/buildpacks/ruby/CHANGELOG.md index e7e2aebf..cfcf7747 100644 --- a/buildpacks/ruby/CHANGELOG.md +++ b/buildpacks/ruby/CHANGELOG.md @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Changed + +- Default process types defined by the Ruby buildpack now use IPv6 host `::` which is equivalent of IPv4 host `0.0.0.0`. This will only affect applications that do not define a `web` process type via the `Procfile` and [Procfile Cloud Native Buildpack](https://github.com/heroku/buildpacks-procfile). Those applications must make sure to update their configuration to bind to an IPv6 host. ([]()) + +### Added + - The buildpack now warns the user when environmental variables used in running the default process are not defined. ([#307](https://github.com/heroku/buildpacks-ruby/pull/307)) ## [3.0.0] - 2024-05-17 diff --git a/buildpacks/ruby/src/steps/get_default_process.rs b/buildpacks/ruby/src/steps/get_default_process.rs index 503ac958..08208c75 100644 --- a/buildpacks/ruby/src/steps/get_default_process.rs +++ b/buildpacks/ruby/src/steps/get_default_process.rs @@ -72,7 +72,7 @@ fn default_rack() -> Process { &[ "bundle exec rackup", "--port \"${PORT:?Error: PORT env var is not set!}\"", - "--host \"0.0.0.0\"", + "--host \"::\"", ] .join(" "), ]) @@ -88,6 +88,7 @@ fn default_rails() -> Process { "bin/rails server", "--port \"${PORT:?Error: PORT env var is not set!}\"", "--environment \"$RAILS_ENV\"", + "--binding \"::\"", ] .join(" "), ]) diff --git a/docs/application_contract.md b/docs/application_contract.md index df365d19..effac1da 100644 --- a/docs/application_contract.md +++ b/docs/application_contract.md @@ -61,9 +61,9 @@ Once an application has passed the detect phase, the build phase will execute to - We will delete the least recently used (LRU) files first. Detected via file mtime. - Process types: - Given an application with the `railties` gem: - - We will default the web process to `bin/rails server` while specifying `-p $PORT` and `-e $RAILS_ENV"`. Use the `Procfile` to override this default. + - We will default the web process to `bin/rails server` while specifying `--port $PORT`, `--environment $RAILS_ENV"` and an IPv6 host with `--binding "::"` (equivalent of IPv4 host `0.0.0.0`). Use the `Procfile` to override this default. - If `railties` gem is not found but `rack` gem is present and a `config.ru` file exists on root: - - We will default the web process to `rackup` while specifying `-p $PORT` and `-h 0.0.0.0`. Use the `Procfile` to override this default. . + - We will default the web process to `rackup` while specifying `--port $PORT` and IPv6 host with `--host "::"` (equivalent of IPv4 host `0.0.0.0`). Use the `Procfile` to override this default. . - Environment variable defaults - We will set a default for the following environment variables: - `JRUBY_OPTS="-Xcompile.invokedynamic=false"` - Invoke dynamic is a feature of the JVM intended to enhance support for dynamicaly typed languages (such as Ruby). This caused issues with Physion Passenger 4.0.16 and was disabled [details](https://github.com/heroku/heroku-buildpack-ruby/issues/145). You can override this value. - `RACK_ENV=${RACK_ENV:-"production"}` - An environment variable that may affect the behavior of Rack based webservers and webapps. You can override this value.