How to implement SPDY with Rails 3.2.2 on Heroku? - ruby-on-rails

I'm hearing that SPDY is where things are likely headed, and I'd like to try to use it with a Rails site I'm running. I haven't been able to find any tutorials however, and the one gem I found doesn't seem to work (everyone is reporting the same error on it across all browsers).
Is it currently possible to implement SPDY on Heroku with a Rails app?

No, there is no way to get SPDY on Heroku today, although I do hope that will change in the future. Heroku has their own HTTP "routing fabric" which is fronted by nginx frontends. The nginx team is working on a SPDY module, but there is no hard date for its release yet. In addition, Heroku would need to install it on their frontends, etc -- in other words, it would require some careful coordination.
If you are interested in testing SPDY with Rails, I would recommend checking out mod_spdy for Apache. You should be able to use Passenger in conjunction with mod_spdy, although that would have to run outside of Heroku for now.

Try setting up CloudFlare an SPDY CDN/proxy service

You can set up a reverse proxy in front of your Heroku app.
One way to do it is using Dockhero addon.
Here's an example with SPDY / HTTP/2 / QUIC support to your Rails app hosted with Heroku - https://github.com/dockhero/quic-protocol-demo
Dockhero add-on is in Private Alpha as of September 2016, try it for free by signing up at https://dockhero.io/

Related

websocket-rails standalone mode running heroku

I'm trying to run websocket app using rails module "websocket-rails" by standalone
mode on heroku. I ran the app in my local env but it seems not working on heroku.
It seems my app cannot reach websocket server.
I use redis for the websocket backend and the redis config does not show any errors.
Is there anything else I can check to investigate the fault? Or heroku does not
support standalone mode websocket?
If there is any document, I'll appreciate that.
thanks in advance.
It was just the setting of websocket server. I'm not sure this is the legit answer, but just specify the app uri for websocket server, it worked. I wrote the details here

Live chat on Rails app through Faye but on Passenger with Apache

Our website is currently running our Rails web app on Passenger with Apache.
Recently, there is a requirement to do live chatting. As such we are planning to deploy Faye by following this article (http://code.tutsplus.com/tutorials/how-to-use-faye-as-a-real-time-push-server-in-rails--net-22600).
However, since Apache does not support websocket, we are not able to use any of such implementation.
We preferred not to change the webserver since additional effort for testing and migration will be involve. Is there any other way to get around this problem?
Appreciate any helps from Rails expert out that.
-Jax
Don't know the answer, though somewhere I read that you should use redis for faye to run it with apache/passenger beacuse they can't be run in single process and share memory, checkout faye-redis gem. Than probably faye server should be run as separate process, and Apache configured to send ':9292/faye' to it.

Rails: local server handling SSL

I'm very surprised to find such little documentation on this topic which quite many developers must have faced before me.
We're changing our app to 100% HTTPS/SSL (as partial SSL doesn't make sense).
That's cool but before that, we need to migrate to it, hence to test it. Of course I found some basic information (here and here).
As I'd like my local environment to be as close as possible to the other ones in order to avoid unexpected errors, those solutions are not satisfying to me : they are ok for short time testing a feature, not more.
Here are the problems/questions I have:
Can I get a valid certificate for my local machine, to avoid the ugly warning step I can't even accept definitively on chrome?
Booting server with thin (thin start --ssl --ssl-verify --ssl-key-file server.key --ssl-cert-file server.crt), can I get same log messages as from rails server?
Can't I keep using rails server as a booting command (except by writing an dirty ALIAS ...)
Summary question is can I make a config so that it is transparent for anybody to run the instance of our app locally in https?
I mean, absolutely everything's done in rails to make development easy, and production robust, but here, there would be such a lack of good tools? I hardly can believe it ... or let's do it now!
Thanks for support! I'm using rails 3.2 with ruby 1.9.
Can I get a valid certificate for my local machine, to avoid the ugly
warning step I can't even accept definitively on chrome?
This depends if you're using the actual certificate for your domain (eg. example.com), or generating one just for development. If you are using the actual certificate from production, you could simply edit your hosts file to have example.com resolve to localhost. Then visiting https://example.com should load your Rails app.
You'll probably also need to include this in your application.rb:
config.force_ssl = true
If you're generating your own certificate you'll need to go through the motions of creating a private Certificate Authority to avoid the SSL warning in Chrome. This is a lot more work and probably not worth it.
Booting server with thin (thin start --ssl --ssl-verify --ssl-key-file
server.key --ssl-cert-file server.crt), can I get same log messages as
from rails server?
You should be able to tail -f log/development.log from the root of your Rails app.
Can't I keep using rails server as a booting command (except by
writing an dirty ALIAS ...)
This one is trickier as the server that runs when using rails s is WebBrick. You could try what's listed in this post here: Configuring WEBrick to use SSL in Rails 4
As an aside the typical setup for a Rails app is to proxy it behind say an SSL terminated nginx server. This way your Rails app doesn't need to know anything about SSL, as well as giving you a number of other benefits like being able to serve assets from nginx, load-balancing, virtual hosts etc.
If you're interested in setting up an environment that is identical to production I'd look into Vagrant.

Javascript not working in production: Nginx, Passenger, Rails on Ubuntu Server (Node.js?)

Do I need to install/config Node.js to get Javascript running?
Is this the simplest solution, seeing that my site has really low traffic?
Javascript doesn't seem to work for me but only in production for a site I am running. The site is setup on the latest version of Ubuntu Server, with Nginx and Passenger (it's a Ruby on Rails app). The site runs great and fast for the past few months, but Javascripts (in particular, things like Twitter Bootstrap's tooltip, etc.) don't run on this production server although they work in my testing/dev environments.
My thoughts are that Javascript is broken b/c I need to install/configure Node.js? I've seen Node.js mentioned in some deployment setup guides but can't find detailed info into if this is necessary.
My site is very low traffic (maybe 3-5 users at any time) for a small company website. The only reason I needed to setup my own web server is that I needed to run the app on the private company network to access certain resources.
By default your js/css don't compiled. You should precompile them.
You can run "bundle exec rake assets:precompile" on your computer and deploy compiled code to the server. Instead node.js you can use therubyracer gem.
For more information read rails guide

Rails and https (ssl) running on linux

I've been looking for tutorials how to start SSL on my localhost. But ones that I found was related to using nginx or apache. I'm wondering is it possible to use HTTPS(SSL) on localhost using usual ruby server (like webrick, thin, unicorn)?
Have you checked Thin with SSL support and ruby-debug
Additionally you will need your own certificate try this page http://hints.macworld.com/article.php?story=20041129143420344 for a step-by-step tutorial for osX

Resources