Skip to content

PrivatePub does not work in production if RAILS_ENV is not set. #29

Open
antek-drzewiecki opened this Issue Jan 23, 2012 · 32 comments
@antek-drzewiecki

Hello,

I'm new to github, rails and ruby. But before i'd make a pull request i'd like to start a discussion, to see your comments. Basically i dont know if its a real issue. When running in development mode, all goes fine. The RAILS_ENV is set to development and the private_pub gem runs fluent and the publishing and subscribing can begin.

Now in production mode if your RAILS_ENV is not set. The application will run in production mode, but your faye server will run in development experiencing "Incorrect signature." messages. Since rack does not pass the thin -E production params. A solve is to export your RAILS_ENV in the termial.
export RAILS_ENV=production
or when using bundler starting the gem with
RAILS_ENV=production bundle exec rackup private_pub.ru -s thin -E production

I wish to commit this to the readme but i'd like to know how you guys would solve this problem.

@karteek
karteek commented Feb 7, 2012

+1. Thanks a lot :-)

@twetzel
twetzel commented Jul 22, 2012

helps me too .. thank you

@dallasread

+1. Thanks.

@aman199002

+1. Thanks a lot. It helped me..:)

@naveenagarwal

Helped thanks... :)

@seanarnold

+1 Awesome thanks. This should be added to the README @ryanb

@beno
beno commented Feb 8, 2013

Thank you so much for unbaffling me.

@tommyalvarez

+1 Lots of thanks.

@ShiningRay

+1 thanks

@jdsampayo

+1 thanks!!! to the readme plis

@pSenthil202

👍 Thanks

@JHanley85

+1 Awesome

@resure
resure commented May 21, 2013

Thanks!

@kabdelhady

Thanks. must add to readme

@jakejuby

+1 thanks.

@gregmolnar

Can you paste the output of bundle exec thin -v?

@manoj2411

Thanks buddy, I missed thin in production :)

@LeandroFigueredo

+1 Thanks

@rogeliog

+1

@mazeltov7

I stacked long time,,, This helps me a lot, thanks!!

@deepredsky

+1

@amp343
amp343 commented Apr 13, 2014

+1 thanks!

@hsamadi
hsamadi commented Jul 3, 2014

+1 Thanks!

@vladimir-e

Thank you! Worked for RAILS_ENV=staging too.

@x44x45x41x4E

Hmmnnn. Tried the mention settings above and restarted my server which is Puma instead of thin but publishing and subscribing is still not working in the production environment. Same issue with @Antek-drzewiecki, everything runs smoothly on our development environment. Any help or suggestion would be appreciated.

EDIT: Ignore this. Already fixed the problem. Just a wrong config in my script. Thanks.

@hsamadi
hsamadi commented Sep 13, 2014

I think it seems reasonable to replace ENV["RAILS_ENV"] in private_pub.ru with ENV["RACK_ENV"] since PrivatePub is a Rack app not a Rails app. rackup only sets RACK_ENV. Thin, Webrick and Mongrel also have the same behavior.

@yigitbacakoglu

+1
RAILS_ENV=production bundle exec rackup private_pub.ru -s thin -d -E production

@mironov
mironov commented Apr 16, 2015

+1, thank you :)

@guilhermeap

hsamadi, thank you!

@harshad26

Thanks buddy. Perfect solution for me.

@rili
rili commented May 14, 2016 edited

thank you man, was almost getting crazy and giving up... that should indeed be added to Readme.

My problem was that i could not send messages in production using ssl if i started the server with the command that Ryan shows in the "Serving Faye over HTTPS (with Thin)" section without adding RAILS_ENV=production before bundle exec

So using the following didnt work for me:
thin -C config/private_pub_thin.yml start

but using this instead worked fine:
RAILS_ENV=production thin -C config/private_pub_thin.yml start

@porta8080

+1000 RAILS_ENV=production did the trick. I'm running the command in EC2 (both app and faye running in the same server) as following:

RAILS_ENV=production bundle exec rackup private_pub.ru -s thin -E production -o 0.0.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.