private_pub
private_pub copied to clipboard
PrivatePub does not work in production if RAILS_ENV is not set.
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.
+1. Thanks a lot :-)
helps me too .. thank you
+1. Thanks.
+1. Thanks a lot. It helped me..:)
Helped thanks... :)
+1 Awesome thanks. This should be added to the README @ryanb
Thank you so much for unbaffling me.
+1 Lots of thanks.
+1 thanks
+1 thanks!!! to the readme plis
:+1: Thanks
+1 Awesome
Thanks!
Thanks. must add to readme
+1 thanks.
Can you paste the output of bundle exec thin -v
?
Thanks buddy, I missed thin in production :)
+1 Thanks
+1
I stacked long time,,, This helps me a lot, thanks!!
+1
+1 thanks!
+1 Thanks!
Thank you! Worked for RAILS_ENV=staging too.
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.
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.
+1 RAILS_ENV=production bundle exec rackup private_pub.ru -s thin -d -E production
+1, thank you :)
hsamadi, thank you!
Thanks buddy. Perfect solution for me.
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
+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