Welcome Guest | Login

How to use Capistrano to deploy addon domains

Hi, I'm a bit of a newbie with Rails infrastructure issues, so I was hoping someone could help me out with a (hopefully simple) question.

I followed the tutorial located at http://www.hostingrails.com/forums/wiki_thread/6 to set up multiple domains, and then I followed the tutorial at http://www.hostingrails.com/forums/wiki_thread/46 to start working with Capistrano 2.  I fully understood the first, though still iffy with the second.  I've also set up multi-user SVN.

My goal is to use Capistrano to deploy my addon domain, which is located at /home/#{hostingrails_username}/apps/addon-domain-folder.  When going through the Capistrano tutorial, I tried to reconfigure the relevant sections to work with my situation, unfortunately I couldn't get it working.

Searching and browsing the forums did not bring up anything that I could use, so I'm wondering if anyone has a tutorial or walkthrough that discusses how to deploy *addon* domains, as opposed to the main domain.

Many thanks

2007-08-31 05:12 PM

Deploy your app just like a normal app, except you will want something like this in your deploy.rb file (or Capfile if using Capistrano 2.0)

run "rm -rf /home/#{user}/public_html/<addon_domain>;ln -s #{current_path}/public /home/#{user}/public_html/<addon_domain>"

2007-08-31 06:45 PM

Thanks for the quick response, after playing around a bit I was able to figure that out.  I am having another issue now that may or may not be related to deployment and this previous task.

I have an app that runs fine locally, but when using Capistrano to deploy it, I try to hit the site on the Internet, and Firefox responds with a popup dialog box saying the server has responded with a document of type application/cgi.  When I try to save this document to my desktop, I receive an empty document named with a random sequence of letters and characters (different every time).  I ran an experiment where I created an index.html file in my deployment folder, and that file was returned back to my browser without a problem, so it must be a Rails configuration issue, but I can't say what it is...  

Unfortunately, the deployed app has no logs (the log folder itself is symlinked to the "shared" directory in the deployment location).

Thanks again for any advice.

2007-08-31 07:47 PM

Did you comment out the line AddHandler fastcgi-script .fcgi in your .htaccess file?

2007-08-31 11:24 PM

I didn't realize I had to do that.  Regardless, after reading your post I just tried it (in both the .htaccess files for my addon domain as well as my main domain) and was still getting the same result.

I looked at the HTTP headers coming back from the server and there was a 500 error with a 0 length application/cgi response.

2007-08-31 11:53 PM

You need to configure your app in production mode in your environment.rb and connect it to the production database . Make sure that you have configured your database.yml properly for the production mode. I hope our tutorial link below would be helpful with this.
http://www.hostingrails.com/forums/wiki_thread/1#

2007-09-01 01:17 AM

Thank you very much, I just had to go back and re-read those threads to find the things that I overlooked.  It's up and running now.

2007-09-01 11:17 AM


Hello Guest! In order to post you must be an active client with us, please log in or sign up.