This repository has been archived by the owner on Nov 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 426
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This adds support for the new Heroku-20 stack: https://devcenter.heroku.com/articles/heroku-20-stack The buildpack's binaries were previously generated by: https://github.com/hone/docker-nginx-builder However that repository is quite out of date, and much of its complexity is no longer required thanks to improvements to `ngx_mruby`'s upstream build scripts/process: https://github.com/matsumotory/ngx_mruby/tree/v2.2.3/docs/install https://github.com/matsumotory/ngx_mruby/blob/v2.2.3/build.sh The new build script has been co-located in this buildpack to improve discoverability, and prevent needing to open PRs against multiple repos when performing updates. The buildpack previously used a subdirectory of the Ruby buildpack's S3 bucket, however I've created a new S3 bucket to improve isolation. This PR adds support for building new binaries for all stacks, however for now only switches to them for Heroku-20, so that the newer nginx version can be tested on the new stack for a while before backporting to the others. The newer ngx_mruby required a compatibility fix, however that has already landed in #181. The binaries have been uploaded already, using the newly documented steps in the README. Closes W-8367040.
- Loading branch information
Showing
6 changed files
with
81 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
vendor/ | ||
.bundle/ | ||
archives/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
S3_BUCKET ?= heroku-buildpack-static | ||
|
||
.PHONY: build build-heroku-16 build-heroku-18 build-heroku-20 sync | ||
|
||
build: build-heroku-16 build-heroku-18 build-heroku-20 | ||
|
||
build-heroku-16: | ||
@docker pull heroku/heroku:16-build | ||
@docker run -v "$(shell pwd)":/buildpack --rm -it -e "STACK=heroku-16" heroku/heroku:16-build /buildpack/scripts/build_ngx_mruby.sh | ||
|
||
build-heroku-18: | ||
@docker pull heroku/heroku:18-build | ||
@docker run -v "$(shell pwd)":/buildpack --rm -it -e "STACK=heroku-18" heroku/heroku:18-build /buildpack/scripts/build_ngx_mruby.sh | ||
|
||
build-heroku-20: | ||
@docker pull heroku/heroku:20-build | ||
@docker run -v "$(shell pwd)":/buildpack --rm -it -e "STACK=heroku-20" heroku/heroku:20-build /buildpack/scripts/build_ngx_mruby.sh | ||
|
||
sync: | ||
@echo "Performing dry run of sync to $(S3_BUCKET)..." | ||
@echo | ||
@aws s3 sync archives/ s3://$(S3_BUCKET) --dryrun | ||
@echo | ||
@read -p "Continue with sync? [y/N]? " answer && [ "$$answer" = "y" ] | ||
@echo | ||
@aws s3 sync archives/ s3://$(S3_BUCKET) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
|
||
NGX_MRUBY_VERSION='2.2.3' | ||
NGX_MRUBY_URL="https://github.com/matsumotory/ngx_mruby/archive/v${NGX_MRUBY_VERSION}.tar.gz" | ||
|
||
echo "Building ngx_mruby v${NGX_MRUBY_VERSION} for ${STACK}" | ||
|
||
BUILD_DIR=$(mktemp -d /tmp/ngx_mruby.XXXX) | ||
SCRIPTS_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) | ||
OUTPUT_DIR="$(dirname "${SCRIPTS_DIR}")/archives/${STACK}" | ||
|
||
mkdir -p "${OUTPUT_DIR}" | ||
cd "${BUILD_DIR}" | ||
|
||
echo "Downloading ngx_mruby from ${NGX_MRUBY_URL}" | ||
curl -sSfL "${NGX_MRUBY_URL}" | tar -xz --strip-components 1 | ||
|
||
./build.sh | ||
make install | ||
|
||
echo 'nginx build complete!' | ||
|
||
NGINX_BIN_DIR="${BUILD_DIR}/build/nginx/sbin" | ||
cd "${NGINX_BIN_DIR}" | ||
|
||
# Check that nginx can start | ||
./nginx -v | ||
|
||
NGINX_VERSION=$(./nginx -v |& cut -d '/' -f 2-) | ||
ARCHIVE_PATH="${OUTPUT_DIR}/nginx-${NGINX_VERSION}-ngx_mruby-${NGX_MRUBY_VERSION}.tgz" | ||
|
||
tar -czf "${ARCHIVE_PATH}" nginx | ||
|
||
echo "Archive saved to: ${ARCHIVE_PATH}" |