diff --git a/CHANGELOG.md b/CHANGELOG.md index 82019318..00e9cf7a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +* [#243](https://github.com/heroku/heroku-buildpack-static/pull/243) Buildpack is officially deprecated + ## v8 (2022-05-19) * [#240](https://github.com/heroku/heroku-buildpack-static/pull/240) Update ngx_mruby from 2.2.3 to 2.2.4. diff --git a/README.md b/README.md index 64d1d8a2..2b40e705 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,35 @@ # heroku-buildpack-static + **NOTE**: This buildpack is in an experimental OSS project. This is a buildpack for handling static sites and single page web apps. For a guide, read the [Getting Started with Single Page Apps on Heroku](https://gist.github.com/hone/24b06869b4c1eca701f9). +## WARNING: `heroku-buildpack-static` is deprecated + +This buildpack is deprecated and is no longer being maintained. +If you are using this project, you can transition over to NGINX via an NGINX buildpack. +Use your project's existing configuration. +To find the NGINX configuration generated by the heroku-buildpack-static you can run: + +``` +$ heroku run bash +~ $ bin/config/make-config +~ $ cat config/nginx.conf +``` + +These commands will output your current NGINX config generated from your `static.json` contents. + +- Write these contents to your local repo at `config/nginx.conf.erb`, commit them to git. +- Replace path logic that previously used `mruby` with static logic. +- Configure your app to use the NGINX buildpack via `heroku buildpacks:add heroku-community/nginx`. +- Remove this buildpack via `heroku buildpacks:remove heroku-community/static` (or `heroku buildpacks:remove https://github.com/heroku/heroku-buildpack-static`). + +## Deprecation PRs + +If you have tips or tricks for migrating off of this buildpack and want to add them to the instructions above please send a PR. + ## Features * serving static assets * gzip on by default @@ -278,6 +303,7 @@ when accessing `/foo`, `X-Foo` will have the value `"foo"` and `X-Bar` will not In case you have multiple buildpacks for the application you can ensure static rendering in `Procfile` with `web: bin/boot`. ## Testing + For testing we use Docker to replicate Heroku locally. You'll need to have [it setup locally](https://docs.docker.com/installation/). We're also using rspec for testing with Ruby. You'll need to have those setup and install those deps: ```sh diff --git a/bin/compile b/bin/compile index 51c4d72f..7094b3d4 100755 --- a/bin/compile +++ b/bin/compile @@ -8,6 +8,29 @@ cache_dir=$2 env_dir=$3 bp_dir=$(dirname $(dirname $0)) +cat <<'EOF' + ## WARNING: `heroku-buildpack-static` is deprecated + + This buildpack is deprecated and is no longer being maintained. + If you are using this project, you can transition over to NGINX via an NGINX buildpack. + Use your project's existing configuration. + To find the NGINX configuration generated by the heroku-buildpack-static you can run: + + ``` + $ heroku run bash + ~ $ bin/config/make-config + ~ $ cat config/nginx.conf + ``` + + These commands will output your current NGINX config generated from your `static.json` contents. + + - Write these contents to your local repo at `config/nginx.conf.erb`, commit them to git. + - Replace path logic that previously used `mruby` with static logic. + - Configure your app to use the NGINX buildpack via `heroku buildpacks:add heroku-community/nginx`. + - Remove this buildpack via `heroku buildpacks:remove heroku-community/static` (or `heroku buildpacks:remove https://github.com/heroku/heroku-buildpack-static`). + +EOF + case "${STACK}" in heroku-18|heroku-20) nginx_archive_url="https://heroku-buildpack-static.s3.amazonaws.com/${STACK}/nginx-1.21.3-ngx_mruby-2.2.4.tgz" diff --git a/scripts/config/lib/ngx_mruby/routes_path.rb b/scripts/config/lib/ngx_mruby/routes_path.rb index 1fabbcbe..f4cdb9ec 100644 --- a/scripts/config/lib/ngx_mruby/routes_path.rb +++ b/scripts/config/lib/ngx_mruby/routes_path.rb @@ -5,7 +5,7 @@ config = {} config = JSON.parse(File.read(USER_CONFIG)) if File.exist?(USER_CONFIG) -req = Nginx::Request.new +req = Nginx::Request.new # defined by https://github.com/matsumotory/ngx_mruby/blob/c7682cfb4c0984a41f1a447b71ae01e1f4fcc6bf/docs/class_and_method/README.md#nginxrequest-class uri = req.var.uri nginx_route = req.var.route routes = NginxConfigUtil.parse_routes(config["routes"])