Skip to content
This repository has been archived by the owner on Nov 1, 2023. It is now read-only.

Commit

Permalink
Deprecate buildpack (#243)
Browse files Browse the repository at this point in the history
* Deprecate buildpack

This build pack is currently not maintained by a team and carries no support obligations. Let's make this clearer by deprecating the build pack.

This is done right before the release of heroku-22 as supporting new stacks require maintenance effort. Also before the desire to re-write it as a CNB comes into play.

* Bring back Readme contents

Having README docs makes it easier for developers to lookup features while they transition off the buildpack.

* Update docs for deprecation

- Mention the need to re-write mruby parts
- Link to a specific nginx build pack and give commands on how to add it
- Give specific command to remove this buildpack from app
- Mention in README we're open to extra docs/help for people migrating off.
- Space after testing header because it's my thing and I looked at those docs. 
- Added a link to where  `Nginx::Request` is defined because it's not obvious it comes from ngx_mruby

* Update README.md

Co-authored-by: Ed Morley <501702+edmorley@users.noreply.github.com>

* Update bin/compile

Co-authored-by: Ed Morley <501702+edmorley@users.noreply.github.com>

* Address PR comments

Co-authored-by: Ed Morley <501702+edmorley@users.noreply.github.com>
  • Loading branch information
schneems and edmorley authored Jun 9, 2022
1 parent 21c1f51 commit e6a2804
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down
23 changes: 23 additions & 0 deletions bin/compile
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion scripts/config/lib/ngx_mruby/routes_path.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"])
Expand Down

0 comments on commit e6a2804

Please sign in to comment.