Closed ryandotsmith closed 9 years ago
When setting this up on my application, I created a wrapper script to conditionally start my web server with or without nginx to prevent my team from having to manage two Procfiles.
Procfile:
web: bin/start
# Server command
COMMAND='bundle exec unicorn -p $PORT -c ./config/unicorn.rb'
if [[ $NGINX == "true" ]]
then
# Start command as argument to `start-nginx` script
bin/start-nginx $COMMAND
else
# Start command without nginx (development and debugging)
$COMMAND
fi
Once in production with the nginx-buildpack, I can control the use of nginx by setting the environment variable NGINX
to trigger a restart:
heroku config:set NGINX=true
heroku config:unset NGINX
I think this is a case of maintaining dev/prod parody. In production, the app server will be receiving requests from NGINX over a UNIX socket, it would be nice to have this work locally as well.