« MySQL + middlegen = Scaling Issue | Main | Welcome to the Dev part of the OVO Blog. »

Deploying Ruby

I’ve recently moved over to the world of ruby on rails to develop portlets for Ovosuite. Coming from a J2EE background, I can say it’s a breath of fresh air: everything 'feels' light and nimble again... no massive build times, no waiting for containers to deploy, no CMP weirdness.... (Although active record can still give you a turn).

Admittedly my experience with ruby is very minimal, so when it came time to get the services running on our production environment, things became a little painful. Its the usual ruby set-up: apache2 + fast-cgi running on Linux (debian).

A couple of things I've learnt from the experience:

1:DO NOT USE p STATEMENTS!

The application I was deploying has debug 'p' statements (if your unaware, the p statement will print to stdout) littered through the code. This was causing a weird error: "malformed header from script. Bad header= XXX" to appear in my apache logs. It took me a little longer than usual to fix this one because I haven’t used cgi before (my web based skills went from ASP to PHP then onto J2EE). CGI takes the output (stdout) of the application and treats that as the HTTP payload for the web page. During development, rails runs using its internal HTTP server where 'p' statements appear on the console (convenient for debugging), but in a production environment (fast-cgi), those same p statements will be embedded in the server response, which apache cant handle.

The lesson from this is to use the rails logging facilities :) (Although what a really want for Xmas is a full debug environment with stepping and variable inspection etc.. I suppose I’ve been spoilt by java in that regard)

2:Watch what you keep in your session.

Rails has a nifty way of storing sessions (completely serialised to disk (or other)) to allow massive scalability potential. Unfortunately, after a restart, it looses track of what libraries are in use, so it may not be able to de-serialize the session again if you have something a bit exotic in there. This was the case for my the TZInfo: a cool time zone library we use. Apparently it uses a bunch of internal classes in the background to handle each time zone, so even if you have require_gem 'tzinfo' and include TZInfo in your code, it still cannot find your classes when loading the session. The easy way around this is to write a wrapper function that gets the time zone based on the string identifier stored in the session.

3.Basic Linux stuff.

OK, I'm the coder, not the Linux guy in the company, so there are a few other 'obvious' things:

Make sure execute permissions are on dispatch.fcgi

Make sure the shebang in dispatch.fcgi is pointing to /usr/local/bin/ruby

Make sure www-data can write to tmp, log and read everything else

Make sure you change the re-write run in public/.htaccess to use fast cgi instead of cgi:

RewriteRule ^(.*)$ dispatch.cgi [QSA,L] should be RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]

That’s about it for now...

Posted on Wednesday, July 12, 2006 at 10:43AM by Registered CommenterOvosuite Team | Comments5 Comments | References69 References

References (69)

References allow you to track sources for this article, as well as articles that were written in response to this article.
  • Response
    Response: Linked
    He has achieved success who has lived well, laughed often, and loved much
  • Response
    liz vicious torrent
  • Response
    Cheap phentermine. Cheap phentermine free shipping.
  • Response
    Response: Microsoft
    None
  • Response
    micro torrent download
  • Response
    Response: salvia
    salvia
  • Response
    Response: energy drinks
    energy drink
  • Response
    Response: Microsoft
    Only best free news! : http://american-citysearch.com
  • Response
    Response: Viagra
  • Response
    Insurance And Loans
  • Response
    FREE Panic at the Disco's New Album TORRENT!!!
  • Response
    COUNTING CROWS - SAT Nights and SUN Mornings
  • Response
    COUNTING CROWS - NEWEST ALBUM 2008
  • Response
    PANIC-AT-THE-DISCO-PRETTY-ODD - NEWEST ALBUM 2008
  • Response
    PANIC-AT-THE-DISCO - NEWEST ALBUM 2008
  • Response
    PANIC-AT-THE-DISCO - NEWEST ALBUM 2008
  • Response
    Response: Viagra
  • Response
    Response: Viagra
  • Response
    Response: Viagra
  • Response
    Response: Viagra
  • Response
    Response: Viagra
  • Response
    Response: Viagra
  • Response
    CLICK FOR YOUR FREE iPHONE
  • Response
    Response: Viagra
  • Response
    e694d68aec49dfef544c3587ec6f4b27
  • Response
    Response: CLICK
    CLICK
  • Response
    Response: THE TRUTH IS HERE
    THE TRUTH IS HERE
  • Response
  • Response
  • Response
    Response: Viagra
  • Response
    Fearless-ReleaseS - The best with first releases
  • Response
    Response: CLICK HERE LADIES
    CLICK HERE LADIES
  • Response
    Response: CLICK HERE LADIES
    CLICK HERE LADIES
  • Response
    CLICK HERE FOR A FREE PS3 & GTA4
  • Response
    Response: buy cheap cialis
    Buy cialis Buy Cialis Online.
  • Response
    Ymca Nude Swimming Story Repost Ashley Tisdale Nude Pics Cute Sayings Quotes For Teens
  • Response
    Response: Free Gay Cbt Video
    Lyrics To Smells Like Teen Spirit Calista Flockhart Nude Davo Porn
  • Response
    Response: Newgrounds Mature
    Ballerina Porn Rbs Insurance Amateurs Free Nude Schoolgirls
  • Response
    Response: Violent Gay Porn
    Exploided Teens Gay Muscle Videos Free Anal Vore
  • Response
    Woman Having Sex With Dogs Lauren Lee Smith Nude First Gay Time
  • Response
    Response: Sex Tourism
    Adult Sleeping Beauty Costume Teen Titans Hentai Games Brandie Amateur Nude
  • Response
    Adult Matchmaking Sites Gay Scat Man Russian Teen Sex
  • Response
    Response: Karyn Parsons Nude
    Sex Screensaver Teen Models 3pic Quinne Nude
  • Response
    Response: Beastyality Sex
    Teen Gothic Gallery Social Impact Of Blindness In Adults Diabetes Adult 2 Natural Treatment
  • Response
    Response: Play Sex Games
    Karyn Parsons Nude Gay Black Male Porn Beastyality Sex
  • Response
    Gyno Porn Haley Bennett Nude Photos Sherilyn Fenn Nude
  • Response
    Flinstones Porn Bareback Gay Personals Gay Anal Creampie
  • Response
    Gay Sex Techniques Watch Lesbian Porn Clips Ashley Massaro Nude Pics
  • Response
    Private Adult Movies Teen Hitch Hickers Nude Male Wrestlers
  • Response
    Response: Ashley Leggat Nude
    Vanessa Hudgens Nude Photos Uncensored Amber Fry Nude Glamour Model Teen Galleries Nn
  • Response
    Powerpuff Girls Nude Nude Phun Girls Extreme String Bikini
  • Response
    Sadomasochism Sex White Female Bodybuilder Porn Nude Venus Williams
  • Response
    Al4 Porn Guntur Sex Teen Party Ideas
  • Response
    Teen Wall Decor Twilight Sex Ebony Free Adult Mpgs
  • Response
    Response: Boating Nude
    Gay Precum Harley Davidson Bikini Girls Nude Twister Clips
  • Response
    Sex Offenders In Ga Milla Jovovich Nude Sex Voyuer
  • Response
    Response: Lea Walker Sex
    Penelope Cruz Nude Shannon Stewart Nude Gay Fist
  • Response
    Ellen Muth Nude Nude Sculptures Free Bbw Hut
  • Response
    Huge download archive blog of Movies, Tv Series, Rapidshare Links Torrents and much more..
  • Response
    Response: Nicole Arbour Nude
    Sexy Webcam Girls Woman Caught Sunbathing Nude Tommy Lee Dick Nude
  • Response
    Response: Sex Big Brother
    Gay Football Jocks Lea Does Anal Top Celebs Nude
  • Response
    Teen Nude Model Jamaica Webcams Free Gay Yaoi Videos
  • Response
    Latina In Bikini Amateurs Homepages Maricopa County Jail Webcam
  • Response
    Carla Bruni Nude Rebecca Romijn Nude Teen Model Forum
  • Response
    Response: Kari Byron Bikini
    Lisa Nicole Carson Bikini Jessica Biel Bikini Teri Harrison Nude
  • Response
    European Slaves European Slaves
  • Response
    Babe Porno Babe Porno
  • Response
    It can often times become burdensome to sort the insightful free porn evidence from the bad.
  • Response
    Response: sex personals
    "Though his hit rate was far less than mine," she wrote, "some married women did contact him. But we estimated a quarter of his pursuers were married men!" Ruth says she was flabbergasted by "the level of deception out there in the 'burbs, and in our opinion she gets somewhat hysterical: ...

Reader Comments (5)

I released version 0.3.0 of TZInfo a couple of days ago. Amongst other things, this release will now let you store Timezones in the session directly. The only requirement to make this work is putting require_gem 'tzinfo' in your environment.rb file.
July 20, 2006 | Unregistered CommenterPhil Ross
I can't tell you how much I appreciate you sharing your experience. I'm running rails on Apache / CGI (Win) and had some controllers that worked and some that didn't. The problem - 'puts' statements that were outputting to stdout just like you say. Thanks for saving my head from meeting the wall yet again.
August 4, 2006 | Unregistered CommenterBricklord
Thanks for clarifying the 'puts' handling of fcgi. I was scratching my head for awhile about this.
December 16, 2006 | Unregistered Commenterdave
hip hop mp3
rap mp3 free hip hop mp3 download dead hip hop mp3 rap music mp3
October 21, 2007 | Unregistered Commenterhip hop mp3
Hi all
I am xrumer, where is my drink?!
It is just a testing ;)
May 8, 2008 | Unregistered CommenterXRumerJJGDJG

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Post:
 
All HTML will be escaped. Hyperlinks will be created for URLs automatically.