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

Heroku Cedar 16 throwing new error on first build. #68

Open
chavenor opened this issue Mar 23, 2017 · 11 comments
Open

Heroku Cedar 16 throwing new error on first build. #68

chavenor opened this issue Mar 23, 2017 · 11 comments

Comments

@chavenor
Copy link

Did some searching on google didn't find much. Any ideas? Is it possible that nginx upstream pgk hasn't been built for heroku-16 yet?

-----> nginx-buildpack app detected
cp: cannot stat 'bin/nginx-heroku-16': No such file or directory
 !     Push rejected, failed to compile nginx-buildpack app.
 !     Push failed
@asnelzin
Copy link

Current workaround for me is heroku stack:set cedar-14 -a <app_name>, but obviously it's not the right way.

@moohkooh
Copy link

But why it does not work on heroku-16?

@asnelzin
Copy link

@moohkooh because it's uses $STACK variable here: https://github.com/ryandotsmith/nginx-buildpack/blob/master/bin/compile#L7

@Igor-Vuk
Copy link

I am getting the same error. It would be great to update it for heroku-16 stack and also add http_gzip_static_module since I think most of us use precompressed files now.

@sandeep-s
Copy link

asnelzin - Thanks! Workaround works seamlessly ;-).

One question though. What if tomorrow heroku-16 stack is updated with the package? How to switch from cedar-14 to heroku-16? Thanks much in advance!

@filipgolonka
Copy link

@sandeep-s

heroku stack:set heroku-16 -a <app_name>

@edouardmenayde
Copy link

edouardmenayde commented Aug 31, 2017

Is there any news on this ? Can anyone explain how is it possible this repository has so much issues and pull request going on and the last commit was made 3 years ago ? Couldn't all people using this module agree to make it a kind of community plugin addon forking it ? To be clear I don't want to blame anyone here: I just don't understand what's going on...

@filipgolonka
Copy link

@edouardmenayde this is how open source community is working (sometimes) :) feel free to fork the repo and make a change :)

@edouardmenayde
Copy link

@filipgolonka Not necessarily : puppet has some amazing community modules for heavily used ones for example.

simonw pushed a commit to simonw/simonwillisonblog that referenced this issue Oct 2, 2017
Heroku's default setup for Django uses the gunicorn application server. Each
Heroku dyno can only run a limited number of gunicorn workers, which means a
limited number of requets can be served in parallel (around 4 per dyno is a
good rule of thumb).

Where things get nasty is when you have devices on slow connections - like
mobile phones. Heroku's router buffers headers but it does not buffer response
bodies, so a slow device could hold up a gunicorn worker for several seconds.
Too many slow devices at once and the site will become unavailable to other
users.

This issue is explained and discussed here:

    http://blog.etianen.com/blog/2014/01/19/gunicorn-heroku-django/

That article recommends using waitress as an alternative to gunicorn, but in
the comments at the bottom of the article people suggest using the Heroku
nginx-buildpack as an alternative.

I'm actually using a fork of the Heroku buildpack which applies a more recent
version of nginx.

Here is a slightly out-of-date tutorial on getting this all set up:

    https://koed00.github.io/Heroku_setups/

I used the following commands to set up the buildpacks:

    heroku stack:set cedar-14
    heroku buildpacks:clear
    heroku buildpacks:add https://github.com/beanieboi/nginx-buildpack.git
    heroku buildpacks:add https://github.com/heroku/heroku-buildpack-python.git

Unfortunately the nginx buildpack is not yet compatible with the new heroku-16
stack, so until the nginx buildpack has been updated it's necessary to run the
application on the older cedor-14 stack. See this discussion for details:

    ryandotsmith/nginx-buildpack#68

Adding nginx in this way also gives us the opportunity to fix another
limitation of Heroku: the default logging. By default, log lines look like
this:

    Oct 01 18:01:06 simonwillisonblog heroku/router: at=info
        method=GET path="/2017/Oct/1/ship/" host=simonwillison.net
        request_id=bb22f67e-6924-4e81-b6ad-74d1f465cda7
        fwd="2001:8003:74c5:8b00:79e4:80ed:fa85:7b37,108.162.249.198"
        dyno=web.1 connect=0ms service=338ms status=200 bytes=4523 protocol=http

Notably missing here is both the user-agent string and the referrer header
sent by the browser! If you like tailing log files these omissions are pretty
disappointing.

The nginx buildback I'm using loads a default configuration file at
config/nginx.conf.erb. By including my own copy of this file I can override
the original and define my own custom log format.

The new log lines look like this:

    2017-10-02T01:44:38.762845+00:00 app[web.1]:
        measure#nginx.service=0.133 request="GET / HTTP/1.1" status_code=200
        request_id=8b6402de-d072-42c4-9854-0f71697b30e5 remote_addr="10.16.227.159"
        forwarded_for="199.188.193.220" forwarded_proto="http" via="1.1 vegur"
        body_bytes_sent=12666 referer="-" user_agent="Mozilla/5.0 (Macintosh;
        Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko)
        Chrome/61.0.3163.100 Safari/537.36"
@lolobosse
Copy link

Hi there, looking at the Heroku PR, I found: heroku#4 and digging a bit more into @kuwabarahiroshi work, I figured a solution which works for me:

heroku buildpacks:add --index 1 https://github.com/kuwabarahiroshi/heroku-buildpack-nginx.git

@jmejia
Copy link

jmejia commented Dec 22, 2017

The Heroku fork of this repo has been updated to support Heroku-16. Similar to @lolobosse's response, you should be able to run:

heroku buildpacks:add --index 1 https://github.com/heroku/heroku-buildpack-nginx.git

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants