Craig Box's journeys, stories and notes...

Posts Tagged ‘rails’

Mongrel upload progress problem - cause found

Friday, June 15th, 2007

Per my previous post on upload progress in Rails, I can now confirm:

The certificates must be in PEM format and must be sorted starting with the subject's certificate (actual client or server certificate), followed by intermediate CA certificates if applicable, and ending at the highest level (root) CA.

Which means, cat site.cer chain.cer Equifax_Secure_Global_eBusiness_CA-1.cer site.key > site.pem.

I've backported Pound to Ubuntu Dapper, from Debian Testing. Dapper only has 1.0, which might work, but the configuration has changed beween 1.x and 2.x, which makes the examples incorrect.

Ways to get an upload progress bar in a Ruby on Rails application

Sunday, May 27th, 2007


  • The "Sean Treadway method" Requires fcgid and Apache. Pretty much superseded by...
  • Mongrel's upload progress extension. Your upload form launches an AJAX updater that says "How far thru' the file am I, foo'?" every N seconds. However, because your upstream bandwidth is hosed (especially on 128Kbps DSL), it tends to take N+15 seconds to get a response. Can be notoriously hard to make go. (Hint, try sudo gem cleanup, and not running your code as root, or not being on a VPN to the server. Any combination of these might have helped.)
    • Mongrel tends to be run behind a load balancing proxy. These sometimes buffer requests so you end up sending 100% of the file before the server knows a file is coming. A solution appears to be to run another Mongrel instance on another port to accept uploads. This is a solution that lots of people suggest but no-one actually says "I do this, here's how".
    • Apache users might need to use mod_proxy_html to rewrite your links, if your JS doesn't have URLs generated with Rails' url_to helpers. This may or may not exist for Apache 2.2.
    • I have everything working up to this point, but the progress doesn't actually display for me using Apache 2.2 as my load balancer.
  • There is a Mongrel Upload Progress with Streaming extention, based on XUpload. The author sounds like he's been working on making it use JSON rather than Javascript, but there's not been a release since. May or may not work with Safari.
  • Use lighttpd and it's upload progress engine. I presume you'd just use it to proxy Mongrel. (Not really for me, as I'm somewhat tied to Apache on my SSL port.)
  • Merb, which seems to be Ruby off Rails. Again, it is used as a secondary server that just accepts uploads, but I have no idea how you'd run a merb and hand uploads to your Rails application. Comments to this welcome.
  • Shockwave Macromedia Adobe Flash, which does all the upload progress client-side. There's a nice degrades-to-Javascript engine called SWFUpload to try here.

Confused yet?