Private pub on heroku - ruby-on-rails

I am developing a chat application using rails 3.2.12 and a great gem called private pub, for which you can find a screencast here. It is built on top of faye and enables you to easily build real time chats by pushing messages.
Now, deploying it on heroku actually is not that simple with private pub. Apparently, you have to set up another app for the faye channel and then subscribe to that channel from your other app.
This is all very confusing. Neither private pub nor faye have anything about deployment on heroku in their documentation. I have found these two links:
Private Pub on Heroku | Rails 3
http://webprogramming29.wordpress.com/2013/02/15/setup-privatepub-or-faye-on-heroku/
However, I don't really understand them since they start at a more advanced level.
Has anyone of you ever deployed a private pub/faye app on heroku and can give a step by step guide? Thanks!

You can checkout my sample chat at github https://github.com/Hareramrai/batkaro.
You can also checkout private_pub server code at github https://github.com/Hareramrai/fayeserver .

If someone is looking for a more up to date answer, I just released a gem that enables real time behavior in a Rails app:
https://github.com/dchacke/entangled

It sounds like, from the articles that you linked, that you need to have two web processes running. One for the normal web server, and one for the Faye server.
It may be easier to have two Heroku apps rather than trying to get each running within the same app.

Related

Combining Rails and React on same Heroku app

I've recently deployed a ReactJS application on Heroku and everything went fine there.
But now I'm trying to deploy my RailsAPI app on there too, but everything I do I get errors, it's something with the git push that don't work.
He always says : hint: Updates were rejected because the tip of your current branch is behind
I suppose this is because there is already my ReactJS app on there? When I force push this happens :
App not compatible with buildpack: https://buildpack-registry.s3.amazonaws.com/buildpacks/heroku/nodejs.tgz
How can I run ReactJS along with RailsAPI on the same Heroku app? I've been searching and read a few stackoverflow posts but I can't seem to find anything similar to this...
I followed some tutorials but I don't get how they do it.
I'm using 2 different folders (and 2 different git repos) for the projects, so RailsAPI is seperated from ReactJS
My buildpacks for this project :
=== neighborapp-oc Buildpack URLs
1. heroku/nodejs
2. heroku/ruby
I know this is old, but in my opinion there is no reason not to create two separate apps, and then just direct your rails API calls in your frontend to the URL created by the rails heroku app. It works well in my experience. :)

How can I install Braintree on a Heroku Ruby server?

I am very new to Heroku and I don't have experience with ruby. I am trying to make my online server generate a token for my mobile client. I have also a created a Sandbox account. I am following the the tutorial in the below link:
https://developers.braintreepayments.com/start/hello-server/ruby
Keep in mind I'm new to this and I have no idea what I should do. In the below picture, is says add the following code to my project. What project? Where is this project? And how can I upload it to Heroku after I added the below code?
Can someone explain or send me a link to dummy it down for me (a lot) so I can understand how I can install Braintree on Swift using Heroku? Possibly a with images so I can understand better. I also need to know how I can tell my Xcode app to send tokens to my Heroku server to process them. I have been stuck on this task for a few weeks now and I still don't have any idea what I'm doing. Any help would be greatly appreciated.
You need to only add the gem to your gemfile locally. When you commit to heroku it will install the gem on the server by itself
Braintree has decent documentation on how to add the gem.
Those variables go in your environment.rb
Documentation: https://github.com/lyang/braintree-rails/wiki

How to deploy stage server in Rails and Heroku

My Rails app is hosted on Heroku. I would like to have another server for staging (i.e., showing and testing new features) before updating my main app.
I have no idea how to do this in general, and in Rails.
How should I go about it? Do I need to create entirely new app, Git repository, Heroku server etc.?
What would be the most popular Gem for this kind of job? (I hear a lot about Caspitrano, but I don't know how it helps in context of Heroku).
Thank you very much for your help.
Heroku documentation is covered this case. You just need create another branch for staging.
Check it https://devcenter.heroku.com/articles/multiple-environments

Heroku App with a Wordpress Blog

I recently discovered that Heroku now allows PHP which means that a wordpress blog can be hosted on it. I also found this project template: https://github.com/mhoofman/wordpress-heroku
I have a ruby on rails app which is to be hosted on heroku with a domain www.mysite.com, and in that app, i need a way for www.mysite.com/blog to show the wordpress blog.
Can someone help me out, with details on how I can do this?
Whilst I've not used the new PHP platform I don't think what you're asking for is going to be possible.
When you deploy an application to Heroku it detects the type of application during the push process and sets up the application accordingly, Heroku use Apache to host PHP as you can see from the output in this post http://tjstein.com/2011/09/running-wordpress-on-heroku-and-amazon-rds/ - there's not been any mention of mixing platforms in a single application yet so would imagine that it's not supported.
The nearest you'd get is hosting your site and your blog in two seperate applications with the blog on blog.mysite.com and then put a redirect on www.mysite.com/blog to the blog.mysite.com url.
Im Still working on this
the closest to getting a solution is using the reverse proxy gem
see the answer here:
How can I use a subdirectory instead of a subdomain?

HTTP Push on Heroku

What would be the best approach to creating an application on Heroku that has the capability to push data to the client?
I have looked at Juggernaut; however, it requires Flash and I am not sure about it actually running on Heroku.
Any help would be appreciated.
although I'm not using Heroku personally, they've just announced experimental node js support few days ago. While they are working on it, you might want to explore Node.js and Websockets in the meantime:
http://devthought.com/blog/2009/12/nodejs-and-the-websocket-protocol/
Yes juggernaut is not supported by heroku. I guess you should get in touch with the heroku guys for this. Unless and until heroku doesn't make it an addon package you won't be able to use juggernaut.

Resources