saush

Mind your Ps

Posted in Rails by sausheong on August 15, 2006

I was trying to move my application (Sam) up to Dreamhost over the weekend. It might sound silly, since Welcome has its own server facilities, leased line etc but I ran out of servers and I was reluctant to ask for more out-of-budget hardware. Anyway this application needs to be available for access from France and Singapore and prior experience of hosting applications in Singapore resulted in terrible performance.

So anyway the plans looked great and I took out one that gave me 300GB of bandwidth and 20GB for US $120 a month, which even gave me a free domain to boot. Great deal! The admin panel looked a bit strange (I’m more used to cpanel style) but it was ok. I was planning to use Capistrano to do the deployment, with Subversion as source code control. Dreamhost offers FastCGI, which was great.

The first indication of problem came when I was using Subversion. I struggled half a day to get it up and running ,but I put it down to my inexperience with SVN. Shrugging it off, I tried Capistrano, poring through the wiki and Googling like mad trying to understand and use Capistrano. Learning it was no big and it was easy to use. Using it on Dreamhost was a nightmare. After much creation and deletion of subdomains, I finally gave up on it.

Quite discouraged now, I abandoned Capistrano and manually checked it out from SVN into the directory. To my horror it now gave me a ‘not enough space on device’ error! I had 20GB (it said so in the control panel) but after 19MB I don’t have enough space?? Another flurry of file deletions. I removed my SVN directory to keep the files down to size and tried to upload the files directly from FTP. I uploaded the files successfully. (Later after reporting this error Dreamhost came back with an apology that it was their fault, they were clearing up some files or something).

You can guess how ‘eager’ I was to tackle the MySQL database migration. Fortunately a simple backup and create script did the job. Next thing –making the app work.

Following instructions from the wiki, I created a brand new Rails app from my shell login. Then I changed the settings at this new app to fit the required settings to run it on FastCGI in Dreamhost. Then I moved my code to the domain directory. Does it work? Yes!

Then, no. Randomly, somehow the application would go down in flames with the dreaded ‘Rails application failed to start properly’ error. More checking in the wiki and forums and all over the Web. Apparently Dreamhost randomly kills the dispatch.fcgi process like sitting ducks in a shooting gallery. What the — ?? Some code in the wiki gave a workaround to fix this (a hack, really — before in its last dying gasp, the process will spawn another process to take its place). It works, somewhat. However, some times my app will log me out halfway doing something. Still frustrating, still don’t know how to fix that.

Now, most of the application works. Except a couple of pages. Why? I checked the production log. No errors. Errors on the screen? Nothing. Pissed off now, I tried to run Webrick. Hey hey it works! I go to port 3000 and my app pops up! I go to the recalcitrant page. It works! What the –??

Thoroughly turned off now, I took my controller and view apart, line by line, commenting it and uncommenting it until I get something working and worked my way up from there. A few hours later, I found the problem.

I have this bad habit of putting debugging lines in my code, by printing out strings to the console. Fastest and laziest way of debugging. In other words, I used ‘puts’ or the shorter form — ‘p’. Apparently FastCGI doesn’t support Rails with ‘puts’ and it doesn’t give any error messages, it just says ‘Rails application fails to start properly’. I removed that and it worked!

Then another page failed to load at all. But by this time, my weekend was shot to pieces, and my patience was at its end. Time to sleep it off and fight another day.

About these ads

10 Responses

Subscribe to comments with RSS.

  1. Chu Yeow said, on August 15, 2006 at 10:55 pm

    I’ve was like you, tried to get Rails apps running on Dreamhost, but eventually stopped kidding myself that a shared hosting environment for $7.95 a month would be able to run anything serious on Rails. The main problem, I gathered, is database (MySQL) access – it’s just too slow on Dreamhost. Couple that with a shared hosting environment, limited RAM, and plain old FastCGI, I was getting 500s intermittently. Plus, the site turned out dead slow.

    I caved and got a VPS (again) with Rimuhosting, quite satisfied at the moment, until I start putting more apps on, of course. It’s Apache 2.2 + mod_proxy_balancer + Mongrel at the moment, but I’m still fine-tuning it.

  2. sausheong said, on August 15, 2006 at 11:49 pm

    Yes it sucks, the failed page suddenly turn up again and I have no idea why. I’m pretty bewildered now, but my current setup at the office is being constantly thrown around so I’ve no choice but to push it to Dreamhost.

    How’s Rimuhosting VPS? I’m tempted to go somewhere higher performing and doesn’t drag me halfway to hell and back again on systems stuff.

  3. Chu Yeow said, on August 16, 2006 at 12:04 am

    I think it’s pretty much down to limited resources on Dreamhost (Rails apps run pretty heavily on RAM). I’m on their cheapest VPS plan, but upgraded the RAM to a total of 160MB. With my current setup I still use up lots of memory with just 3 Mongrels (each one takes up 25-50MB of RAM). But I’m finding it very stable and very fast for my needs.

    Here’s the `top` on my site (self-refreshing version) if you’re interested. Pretty much topped out on RAM usage as you can see.

  4. Chu Yeow said, on August 16, 2006 at 12:05 am

    Bah, some errors in my last comment. I meant I was on Rimuhosting’s cheapest VPS plan. And there’s an unclosed <a> tag :/

  5. Alfred Toh said, on August 17, 2006 at 2:33 am

    Welcome to Dreamhost hell.. I was on Dreamhost for a while and finally gave up. I now host at Railsplayground.net and so far I can only say 2 thumbs up! and I get to run Mongrel with my site.

  6. Satish Talim said, on August 19, 2006 at 6:04 pm

    Sau, I wanted to contact you wrt some interviews I am doing on my site. I am unable to get your contact email id. Do write to me. Thanks.

    • Jaylene said, on April 13, 2011 at 12:00 pm

      That’s way more clever than I was eexpcitgn. Thanks!

  7. Aníbal Rojas said, on August 23, 2006 at 11:44 am

    I would recommend slingshothosting.com they are specialized in Rails hosting, and they know what they are doing becasue they are developers too.

    Off Topic: This is just a quick note to invite you to register at RubyCorner.com, a meeting place for people interested in the Ruby Programming Language or any of the related technologies. I would recommend suscribing with a Ruby/Rails filtered feed to “play fair” with the community ;-)

  8. Aníbal Rojas said, on August 23, 2006 at 11:44 am

    I would recommend slingshothosting.com they are specialized in Rails hosting, and they know what they are doing becasue they are developers too.

    Off Topic: This is just a quick note to invite you to register at RubyCorner.com, a meeting place for people interested in the Ruby Programming Language or any of the related technologies. I would recommend suscribing with a Ruby/Rails filtered feed to “play fair” with the community ;-)

  9. Erich Mestre said, on January 6, 2010 at 8:15 am

    I found this blog while I was searching yahoo on key term web host. I like information posted. Thanks


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 448 other followers

%d bloggers like this: