Rails 3.0 App Deployment

I have a Rails 3.0 App ready to be deployed on a production server; but as you all might know getting all the gems you need (including Rails 3.0) on a shared hosting is nearly impossible. So here is what need help with:

  1. Can I freeze my app with all the necessary gems and deploy it on Fast CGI?
  2. If yes how do I freeze a Rails 3.0 app?
  3. How do I deploy it on Fast CGI?

I know this is an easy task but I would really appreciate the help.

Thanks, Tsega

I have a Rails 3.0 App ready to be deployed on a production server; but as you all might know getting all the gems you need (including Rails 3.0) on a shared hosting is nearly impossible. So here is what need help with:

  1. Can I freeze my app with all the necessary gems and deploy it on Fast CGI?
  2. If yes how do I freeze a Rails 3.0 app?
  3. How do I deploy it on Fast CGI?

With rails3 you use bundler to manage gems.

You can run bundle package to cache them all inside your app, although you probably don’t need to do this - in production bundler by default installs a copy of gems private to the app (no root access required)

Don’t know what the fastcgi story is these days.

Fred

Thanks Fred, I was just looking into the bundler thing, I tried to run

rake rails:freeze:gems

but the reply was that the command is depricated and I should try the

bundler install

command instead. I get what that does and it runs perfectly on my machine, but that’s because everything is installed on the normal gems folder,

/usr/lib/ruby/gems/1.8/gems

However, the freezing process was need because it copies these gems to my applications 'vendor ’ directory. So when you say

You can run bundle package to cache them all inside your app, although you probably don’t need to do this - in production bundler by default installs a copy of gems private to the app (no root access required)

I would assume that it means bundler does the same thing of moving my gems to somewhere in the application’s directory. So in short my question to you would be: how do I do that?

Thanks for the help.

I guess I should have dug a little deeper at http://gembundler.com before I posted my last request. The

bundle package

command does the trick! Now to the next issue at hand the Fast CGI deployment!

Thanks Fred.

Ok I’ve packed (not frozen) my app using bundler, and here is what I’ve done on the server:

  1. Created a directory to upload my files to.
  2. Using a web interface I managed to create a symlink to my application directory

Now what should I do next?

Thanks, Tsega

Anyone?

Ok I've packed (not frozen) my app using bundler, and here is what I've done on the server:

1. Created a directory to upload my files to. 2. Using a web interface I managed to create a symlink to my application directory

Now what should I do next?

Do you have to use fastcgi? It fell out of favour a long time ago (last time i used fastcgi was back in 2006) Rails used to autogenerate a dispatch.fcgi and an htaccess file that were setup to work with apache, however i don't think it does anymore. Your life will be a whole lot easier if you can switch to passenger (as far as I'm aware that's what most shared hosting companies used too since it's a lot easier for them too).

Fred

I think you need rvm, it lets you create a .rvmrc file which specifies which gem set to use, it works like magic, you can have one gem set for each project and even a different ruby version for each, you will fall in love with it.

http://railscasts.com/episodes/200-rails-3-beta-and-rvm

Thanks radhames, but I think RVM is for your local machine, I’m trying to deploy my app on to a public shared hosting server, which I have no control over. So RVM is not an option. Thanks for your help though.

Regards, Tsega

Hi Fred,

Thanks for you help again, I wish I could try passenger but I’m making this app for a client and he insisted on sticking with this particular host company since they have been doing business for a long time. Talk about customer loyalty!

Anyways, where does rails keep the dispatch.fcgi and .htaccess files ? Of course what are their contents? Is it the same as suggested by this guy on github.com https://github.com/dre3k/rails3_fcgi ? He is saying that it should be in the public folder.

Thanks, Tsega

I think you will find that even if you get it going that rails is not reliable with fcgi. My hosting company moved to passenger a long time ago to get away from such problems.

Colin

Hi Fred,

Thanks for you help again, I wish I could try passenger but I'm making this app for a client and he insisted on sticking with this particular host company since they have been doing business for a long time. Talk about customer loyalty!

Anyways, where does rails keep the dispatch.fcgi and .htaccess files ? Of course what are their contents? Is it the same as suggested by this guy on github.comhttps://github.com/dre3k/rails3_fcgi? He is saying that it should be in the public folder.

They should indeed be in the public folder. That repository you linked to looks reasonable at first glance - worth a go I'd say.

Fred

Thanks radhames, but I think RVM is for your local machine, I’m trying to deploy my app on to a public shared hosting server, which I have no control over. So RVM is not an option. Thanks for your help though.

Regards,

Tsega

You received this message because you are subscribed to the Google Groups “Ruby on Rails: Talk” group.

To post to this group, send email to rubyonrails-talk@googlegroups.com.

To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No rvm is not for local machines , is easier the complete opposite, you cant have a serve without it.

OT, bundler has

$ bundle package

it will install everything on the plugins directory

If you don’t mind me asking… What hosting are you using? I am looking for a hosting provider offering passenger…

Any suggestions?

Jaz if you are looking for a hosting plan that is affordable, has a good deal of features on a shared server. You should look into site5.com . They offer a solid service, I use them for hosting a Spree (E-commerce Ruby on Rails app ) based website. As Colin suggested they use passenger(I think they even have git integration) so you can give them a try.

Hey Fred,

I have finally given up, I mean on getting rails to work on this hosting account, I think I would have to use another programming language to make the app, or may be I 'll use CMS like Drupal. Believe me I am already dreading the decision but I have no time to fiddle with the server, my client is getting a little impatient so I would need to act soon. Thanks a lot for all he help, hope to see you here every once in a while.

Regards, Tsega

For future readers of this thread,

Don’t deploy a Rails app on a shared server. It’s not worth the hassle and your hands will be bound. Rails is designed to work with VPS and dedicated servers.