Showing posts with label nginx. Show all posts
Showing posts with label nginx. Show all posts

Wednesday, February 6, 2008

Attachment Mania

I'm sitting face to face with a problem...

That problem being the ability to add an attachment to a "message" of sorts. Think of it as attaching a file to a forum post...except not everyone should have access to this file. And we need to do this with Ruby on Rails.

So what do we need?

Well, first and foremost I suggest we create a directory which sits outside the rails app itself. Say:
/var/myapp/attachments

Brad, why in the hell do you want to do that?


Simple, these are very private files which are going to be stored. No one should be able to just key-up the path in the browser to get to them. It will save me the lawsuit and bandwidth.

The second thing we need is to free up mongrel from serving up any static files. Let mongrel handle requests for rails but let nginx handle the static file response. This little nugget will allow us to do such a thing from rails in a clear, concise manner.

The last thing we need is to alter our capistrano script to not whipe our cache of attachments each time we deploy a new version of our rails application.

I'll post a response with my findings, if anyone has any suggestions...well, you know where to post.

Application Throughput is for Closers Only

After reading a few informative posts and some statistics on application deployments and their performance with rails and the growing number of available proxies/webservers, I thought I'd take my shot at putting something fast together on a not-so beefy machine.

Read this article first and then this (Thin), this (Garbage Collection in Rails) and then this (Rails Routing).

Ok, ok, you probably didn't reall all of those...but at least read the first one. My goal is to try to bake all these together with an app that will actually do something outside of "hello, world" and see what type of performance I can juice out of an Ubuntu (Gibbon) box running on a 1.8Ghz AMD and 1.5Gb RAM. I have a fairly lightweight financial management application I've built on rails that is a perfect candidate for this type of experiment.

What's going to be involved? Nginx, Swiftiply, Thin, Postgresql and of course Rails. Now I'd like to mention here that currently (correct me if I'm wrong) there isn't a patch to run Thin via Swiftiply - I plan on changing that now that I don't have to huddle my family into a crawl space due to the 8,000 tornado warnings we had last night. It's like the world didn't want me to implement it!

Anyway, I'll post progress as I make it - if nothing else it's going to be a fun learning experience. Maybe some notoriety will come about from it if I can tie Thin into Swiftiply "un-shittily" (I'm sure someone will bitch about something).

That's all for now.