0

To avoid issues in development with Foreman I need to I need to wrap the Puma server in a Socks proxy for Quotaguard to get a static IP in production and production only.

Using a link to this article that I found from this question I implemented the following code in bin/web call from Procfile.

#!/bin/sh
if [ "$RACK_ENV" == "production" ]; then
  echo Using qgsocksify to wrap Puma
  bin/qgsocksify bundle exec puma -C config/puma.rb
else
  echo Using straight Puma
  bundle exec puma -C config/puma.rb
fi

Although the environment is production set on RACK_ENV the unwrapped "straight Puma" server launches. Testing this locally works but it fails on Heroku.

What's the syntax error that would cause it to fail on Heroku?

Community
  • 1
  • 1
Michael Glenn
  • 1,872
  • 1
  • 19
  • 23

1 Answers1

1

Apparently sh doesn't use == for equivalence on Heroku but works locally on my Mac which is why it works in development. Googling revealed standard sh uses = for equivalence. In this case however I just changed #!/bin/sh to #!/bin/bash as Heroku supports bash as well.

#!/bin/bash
if [ "$RACK_ENV" == "production" ]; then
  echo Using qgsocksify to wrap Puma
  bin/qgsocksify bundle exec puma -C config/puma.rb
else
  echo Using straight Puma
  bundle exec puma -C config/puma.rb
fi
Michael Glenn
  • 1,872
  • 1
  • 19
  • 23