I am trying to deploy a python with django on heroku and configure an nginx reverse proxy to have like a filter which won't let the requests pass to my django backend until the token is checked to an third party IDP.
** STEP 1 **
I am following this tutorial to add the nginx buildpack : https://elements.heroku.com/buildpacks/hq-mobile/v3-nginx-buildpack
After I've added the buildpack and start the app, I get the following message: bin/start-nginx: line 37: bundle: command not found
After some digging I noticed some paths need to be added to the config vars for the heroku app in order for bundler to get the needed dependencies :
So I've added this paths:
heroku config:add GEM_PATH=vendor/bundle/1.9.3
heroku config:set PATH=bin:vendor/bundle/ruby/1.9.3/bin:/usr/local/bin:/usr/bin:/bin
Then the config/unicorn.rb file:
require 'fileutils'
listen '/tmp/nginx.socket'
before_fork do |server,worker|
FileUtils.touch('/tmp/app-initialized')
end
Procfile:
web: bin/start-nginx bundle exec unicorn -c config/unicorn.rb gunicorn -c gunicorn.conf.py MyApp.wsgi
gunicorn.conf.py
# gunicorn.conf
def when_ready(server):
# touch app-initialized when ready
open('/tmp/app-initialized', 'w').close()
bind = 'unix:///tmp/nginx.socket'
workers = 4
Even after adding this, the error still persists.
** STEP 2 **
Once the normal buildpack will be in place I want to follow this tutorial to configure nginx how I want:
https://www.nginx.com/blog/validating-oauth-2-0-access-tokens-nginx/
What configuration is needed to be able to have this buildpack working in my situation?