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

Deprecate buildpack #243

Merged
merged 6 commits into from
Jun 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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:/heroku/heroku-buildpack-static/pull/243) Buildpack is officially deprecated

## v8 (2022-05-19)

* [#240](https:/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:/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:/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:/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