heroku / heroku-buildpack-nginx

Run NGINX in a Heroku app
1 stars 3 forks source link

Unclear how to use build_nginx #62

Closed agrberg closed 4 years ago

agrberg commented 4 years ago

The README mentions that it is possible to customize nginx's compile options via the https://github.com/heroku/heroku-buildpack-nginx/blob/master/scripts/build_nginx script.

The script says it's designed to be run in a Heroku web dyno and the final binary downloaded for vendoring. However, it is light on details as to how to go about this.

Looking through the script's history, I've found a call to setup a Python web server but this was removed in https://github.com/heroku/heroku-buildpack-nginx/commit/a51ae6300ca6b80a82f3ec0f446025229edfd8da#diff-c1594fe8a33425936bb1b25a1f142c6b. Perhaps a red herring but the loop to keep the bash script running was also removed in https://github.com/heroku/heroku-buildpack-nginx/commit/e64133f2f3ebccdcb8bbdca422294dfa6ecd6897#diff-c1594fe8a33425936bb1b25a1f142c6b.

What I've attempted so far is:

I'm able to deploy by my logs.txt (relevant portion duplicated below) say the app crashes.

Googling has also hit a dead end for the moment so I'm hopeful that whatever I'm missing is more obvious to those with more experience than me.

2020-08-22T21:40:45.033008+00:00 app[web.1]: checking for OS
2020-08-22T21:40:45.037078+00:00 app[web.1]: + Linux 4.4.0-1076-aws x86_64
2020-08-22T21:40:46.670273+00:00 app[web.1]: checking for C compiler ... not found
2020-08-22T21:40:46.679991+00:00 app[web.1]: 
2020-08-22T21:40:46.679993+00:00 app[web.1]: ./configure: error: C compiler cc is not found
2020-08-22T21:40:46.679994+00:00 app[web.1]: 
2020-08-22T21:40:46.689548+00:00 app[web.1]: make: *** No rule to make target 'install'.  Stop.
2020-08-22T21:40:46.747961+00:00 app[web.1]: checking for OS
2020-08-22T21:40:46.751417+00:00 app[web.1]: + Linux 4.4.0-1076-aws x86_64
2020-08-22T21:40:46.772664+00:00 app[web.1]: checking for C compiler ... not found
2020-08-22T21:40:46.776255+00:00 app[web.1]: 
2020-08-22T21:40:46.776302+00:00 app[web.1]: ./configure: error: C compiler cc is not found
2020-08-22T21:40:46.776325+00:00 app[web.1]: 
2020-08-22T21:40:46.779272+00:00 app[web.1]: make: *** No rule to make target 'install'.  Stop.
2020-08-22T21:40:46.784637+00:00 app[web.1]: cp: cannot stat '/tmp/nginx/sbin/nginx': No such file or directory
2020-08-22T21:40:46.786734+00:00 app[web.1]: cp: cannot stat '/tmp/nginx-debug/sbin/nginx': No such file or directory
2020-08-22T21:40:46.788976+00:00 app[web.1]: cp: cannot stat '/tmp/nginx/conf/mime.types': No such file or directory
2020-08-22T21:40:46.793573+00:00 app[web.1]: ./
2020-08-22T21:40:46.797268+00:00 app[web.1]: cp: missing destination file operand after '/tmp/nginx-.tgz'
2020-08-22T21:40:46.797275+00:00 app[web.1]: Try 'cp --help' for more information.
2020-08-22T21:40:46.799339+00:00 app[web.1]: cp: missing destination file operand after '/tmp/nginx/sbin/nginx'
2020-08-22T21:40:46.799344+00:00 app[web.1]: Try 'cp --help' for more information.
2020-08-22T21:40:46.836898+00:00 heroku[web.1]: Process exited with status 0
2020-08-22T21:40:46.876657+00:00 heroku[web.1]: State changed from starting to crashed
2020-08-22T21:40:48.515167+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=custom-nginx.herokuapp.com request_id=2ef22723-daf3-4645-96ab-c7cdc4ea47d2 fwd="97.77.198.5" dyno= connect= service= status=503 bytes= protocol=https
2020-08-22T21:40:49.319575+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=custom-nginx.herokuapp.com request_id=9117a2eb-2bc6-4abe-bf9f-792e561313a9 fwd="97.77.198.5" dyno= connect= service= status=503 bytes= protocol=https
agrberg commented 4 years ago

Sooooo I kept at it and figured out that the comments and instructions were unclear/out-of-date. Turns out building your own NGINX is pretty easy so I wrapped up what I learned for others in https://github.com/heroku/heroku-buildpack-nginx/pull/63.