Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade nginx to 1.13.11 and add Heroku 16 binary #1

Open
wants to merge 28 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
347ca29
Upgrade nginx to 1.13.11 and add Heroku 16 binary
beanieboi Apr 9, 2018
fb6dc66
Update build process
beanieboi Sep 13, 2018
e49a592
Add support for heroku-18 and update nginx version
beanieboi Sep 13, 2018
c3951f5
rename buildpack to nginx
beanieboi Sep 13, 2018
8a7d444
update README with the latest build and Heroku instructions
beanieboi Sep 13, 2018
bc46fdc
Convert tabs to spaces
beanieboi Sep 13, 2018
3a1f5a6
add Code of Conduct
beanieboi Sep 13, 2018
f4e58bb
update changelog format (#3)
beanieboi Sep 17, 2018
c0a39e5
add support for nginx solo mode (#2)
beanieboi Sep 17, 2018
099ad52
fix path to nginx solo config
beanieboi Sep 17, 2018
cf95294
add Requirements for solo mode
beanieboi Sep 17, 2018
3b56f74
Add headers more module (#4)
beanieboi Sep 19, 2018
30779bf
bump nginx to 1.15.5
beanieboi Oct 5, 2018
75edbc2
Update readme and changelog
beanieboi Oct 5, 2018
59852cb
Merge pull request #5 from beanieboi/nginx-1.15.5
beanieboi Oct 5, 2018
1e8b2b6
Update nginx to 1.15.6
beanieboi Nov 9, 2018
9b8fe49
Merge pull request #6 from beanieboi/nginx-1.15.6
beanieboi Nov 9, 2018
c76061a
Update README.md
beanieboi Nov 9, 2018
16af49e
include uuid4 module in nginx
beanieboi May 29, 2019
526ab18
upgrade nginx to 1.17
beanieboi May 29, 2019
e171694
pull latest docker image before building
beanieboi May 29, 2019
c76b4da
run shell in heroku 18 (its the new default on Heroku)
beanieboi May 29, 2019
7766f98
add 1.17 binaries
beanieboi May 29, 2019
8a5ccf0
Update README.md
beanieboi May 29, 2019
2df7060
Update CHANGELOG.md
beanieboi May 29, 2019
bd53d1e
Update nginx to 1.17.7
beanieboi Jan 6, 2020
4553a7e
Update download urls to use HTTPS
beanieboi Jan 6, 2020
5d94fc6
Merge pull request #7 from beanieboi/update-nginx
beanieboi Jan 6, 2020
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
117 changes: 69 additions & 48 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,48 +1,69 @@
## v0.7

2016-02-14

* Update nginx to 1.11.3
* Update PCRE to 8.39

## v0.6

2016-02-14

* Update nginx to 1.9.11
* Update PCRE to 8.38

## v0.5

2015-05-09

* Update nginx to 1.8.0
* add gzip static module

## v0.4

2012-05-13

Update NGINX config

* enabled gzip compression
* using epoll and increasing workers to 4

## v0.3

2012-05-11

* Improve process managment using a fifo.

## v0.2

2012-05-10

* Improve the handling of app server failures

## v0.1

2012-05-09

* NGINX 1.4.1
* inital release
# Changelog
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.1] - 2020-01-06
### Added
- update nginx to 1.17.7

## [1.0] - 2019-05-29
### Added
- update nginx to 1.17.0
- add uuid4 module from https://github.com/cybozu/nginx-uuid4-module

## [0.9] - 2018-10-05
### Added
- update nginx to 1.15.5
- add nginx solo support, see [sample config for nginx solo mode](config/nginx-solo-sample.conf.erb) and [README](README.md)
- add headers-more module from https://github.com/openresty/headers-more-nginx-module

### Changed
- updated build scripts to compile on 2 cores (-j 2)

## [0.8] - 2018-09-13
### Changed
- update nginx to 1.15.3
- update PCRE to 8.42

## [0.7] - 2016-02-14
### Changed
- update nginx to 1.11.3
- update PCRE to 8.39

## [0.6] - 2016-02-14
### Changed
- update nginx to 1.9.11
- update PCRE to 8.38

## [0.5] - 2015-05-09
### Added
- gzip static module

### Changed
- update nginx to 1.8.0

## [0.4] - 2012-05-13
### Added
- enabled gzip compression

## [0.4] - 2012-05-13
### Added
- enabled gzip compression

### Changed
- include most recent nginx config
- using epoll and increasing workers to 4

## [0.3] - 2012-05-11
### Changed
- Improve process managment using a fifo.

## [0.2] - 2012-05-10
### Changed
- Improve the handling of app server failures

## [0.1] - 2012-05-09
### Added
- initial release with NGINX 1.4.1
73 changes: 73 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Contributor Covenant Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, gender identity and expression, level of experience,
education, socio-economic status, nationality, personal appearance, race,
religion, or sexual identity and orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment
include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.

## Scope

This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at [email protected]. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html

[homepage]: https://www.contributor-covenant.org
20 changes: 20 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
build: build-cedar-14 build-heroku-16 build-heroku-18

build-cedar-14:
@echo "Building nginx in Docker for cedar-14..."
@docker pull heroku/cedar:14
@docker run -v $(shell pwd):/buildpack --rm -it -w /buildpack heroku/cedar:14 scripts/build_nginx /buildpack/bin/nginx-cedar-14

build-heroku-16:
@echo "Building nginx in Docker for heroku-16..."
@docker pull heroku/heroku:16
@docker run -v $(shell pwd):/buildpack --rm -it -w /buildpack heroku/heroku:16-build scripts/build_nginx /buildpack/bin/nginx-heroku-16

build-heroku-18:
@echo "Building nginx in Docker for heroku-18..."
@docker pull heroku/heroku:18
@docker run -v $(shell pwd):/buildpack --rm -it -w /buildpack heroku/heroku:18-build scripts/build_nginx /buildpack/bin/nginx-heroku-18

shell:
@echo "Opening heroku-18 shell..."
@docker run -v $(shell pwd):/buildpack --rm -it -e "STACK=heroku-18" -e "PORT=5000" -w /buildpack heroku/heroku:18 bash
1 change: 0 additions & 1 deletion Procfile

This file was deleted.

55 changes: 39 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,18 @@ Some application servers (e.g. Ruby's Unicorn) halt progress when dealing with n

## Versions

* Buildpack Version: 0.7
* NGINX Version: 1.11.3
* NGINX Version: 1.17.7

## Requirements
## Requirements (Proxy Mode)

* Your webserver listens to the socket at `/tmp/nginx.socket`.
* You touch `/tmp/app-initialized` when you are ready for traffic.
* You can start your web server with a shell command.

## Requirements (Solo Mode)

* Add a custom nginx config to your app source code at `config/nginx.conf.erb`. You can start by copying the [sample config for nginx solo mode](config/nginx-solo-sample.conf.erb).

## Features

* Unified NXNG/App Server logs.
Expand All @@ -43,7 +46,7 @@ at=info method=GET path=/ host=salty-earth-7125.herokuapp.com request_id=e2c79e8

### Language/App Server Agnostic

Nginx-buildpack provides a command named `bin/start-nginx` this command takes another command as an argument. You must pass your app server's startup command to `start-nginx`.
nginx-buildpack provides a command named `bin/start-nginx` this command takes another command as an argument. You must pass your app server's startup command to `start-nginx`.

For example, to get NGINX and Unicorn up and running:

Expand All @@ -52,6 +55,17 @@ $ cat Procfile
web: bin/start-nginx bundle exec unicorn -c config/unicorn.rb
```

### nginx Solo Mode

nginx-buildpack provides a command named `bin/start-nginx-solo`. This is for you if you don't want to run an additional app server on the Dyno.
This mode requires you to put a `config/nginx.conf.erb` in your app code. You can start by coping the [sample config for nginx solo mode](config/nginx-solo-sample.conf.erb).
For example, to get NGINX and Unicorn up and running:

```bash
$ cat Procfile
web: bin/start-nginx-solo
```

### Setting the Worker Processes

You can configure NGINX's `worker_processes` directive via the
Expand All @@ -65,16 +79,29 @@ $ heroku config:set NGINX_WORKERS=8

### Customizable NGINX Config

You can provide your own NGINX config by creating a file named `nginx.conf.erb` in the config directory of your app. Start by copying the buildpack's [default config file](https://github.com/ryandotsmith/nginx-buildpack/blob/master/config/nginx.conf.erb).
You can provide your own NGINX config by creating a file named `nginx.conf.erb` in the config directory of your app. Start by copying the buildpack's [default config file](config/nginx.conf.erb).

### Customizable NGINX Compile Options

See [scripts/build_nginx.sh](scripts/build_nginx.sh) for the build steps. Configuring is as easy as changing the "./configure" options.
See [scripts/build_nginx](scripts/build_nginx) for the build steps. Configuring is as easy as changing the "./configure" options.

### Application/Dyno coordination
You can run the builds in a [Docker](https://www.docker.com/) container:

```
$ make build # It outputs the latest builds to bin/cedar-*
```

To test the builds:

The buildpack will not start NGINX until a file has been written to `/tmp/app-initialized`. Since NGINX binds to the dyno's $PORT and since the $PORT determines if the app can receive traffic, you can delay NGINX accepting traffic until your application is ready to handle it. The examples below show how/when you should write the file when working with Unicorn.
```
$ make shell
$ cp bin/nginx-$STACK bin/nginx
$ FORCE=1 bin/start-nginx
```

### Application/Dyno coordination

The buildpack will not start NGINX until a file has been written to /tmp/app-initialized. Since NGINX binds to the dyno's $PORT and since the $PORT determines if the app can receive traffic, you can delay NGINX accepting traffic until your application is ready to handle it. The examples below show how/when you should write the file when working with Unicorn.
## Setup

Here are 2 setup examples. One example for a new app, another for an existing app. In both cases, we are working with ruby & unicorn. Keep in mind that this buildpack is not ruby specific.
Expand All @@ -83,11 +110,7 @@ Here are 2 setup examples. One example for a new app, another for an existing ap

Update Buildpacks
```bash
$ heroku config:set BUILDPACK_URL=https://github.com/ddollar/heroku-buildpack-multi.git
$ echo 'https://github.com/ryandotsmith/nginx-buildpack.git' >> .buildpacks
$ echo 'https://codon-buildpacks.s3.amazonaws.com/buildpacks/heroku/ruby.tgz' >> .buildpacks
$ git add .buildpacks
$ git commit -m 'Add multi-buildpack'
$ heroku buildpacks:add https://github.com/beanieboi/nginx-buildpack
```
Update Procfile:
```
Expand Down Expand Up @@ -154,9 +177,9 @@ web: bin/start-nginx bundle exec unicorn -c config/unicorn.rb
```
Create & Push Heroku App:
```bash
$ heroku create --buildpack https://github.com/ddollar/heroku-buildpack-multi.git
$ echo 'https://codon-buildpacks.s3.amazonaws.com/buildpacks/heroku/ruby.tgz' >> .buildpacks
$ echo 'https://github.com/ryandotsmith/nginx-buildpack.git' >> .buildpacks
$ heroku create
$ heroku buildpacks:add heroku/ruby
$ heroku buildpacks:add https://github.com/beanieboi/nginx-buildpack
$ git add .
$ git commit -am "init"
$ git push heroku master
Expand Down
2 changes: 2 additions & 0 deletions bin/compile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ nginx_version=$(./bin/nginx-$STACK -V 2>&1 | head -1 | awk '{ print $NF }')
echo "-----> nginx-buildpack: Installed ${nginx_version} to app/bin"
cp bin/start-nginx "$1/bin/"
echo '-----> nginx-buildpack: Added start-nginx to app/bin'
cp bin/start-nginx-solo "$1/bin/"
echo '-----> nginx-buildpack: Added start-nginx-solo to app/bin'

mkdir -p "$1/config"

Expand Down
2 changes: 1 addition & 1 deletion bin/detect
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env bash
# bin/detect <build-dir>
echo 'nginx-buildpack'
echo 'nginx'
exit 0
Binary file modified bin/nginx-cedar-14
100644 → 100755
Binary file not shown.
Binary file added bin/nginx-heroku-16
Binary file not shown.
Binary file added bin/nginx-heroku-18
Binary file not shown.
Loading