How To Deploy Rails with SVN and Capistrano to a Secondary Domain on TextDrive

I just deployed my first rails app to one of my secondary domains on TextDrive’s shared hosting space.

If that sounds like a recipe for disaster….you’re right!

While Rails is a great development tool, there’s lots of work to do in simplifying, stabilizing, and documenting the deployment process. The app in question is very, very tiny for the express purpose of getting deployment nailed. In fact, it’s taken me longer to deploy than to develop.

For you, and Future Garrick, here’s the process.

  1. Freeze Rails so you’re not plagued with different-version-itis:
    rake rails:freeze:edge TAG=rel_-2-3
  2. Create an Subversion repository in your primary domain,
    Not in your secondary domain. If the repository is in a secondary domain, your primary account can’t see it. Using your primary domain and primary account is easier – if not as tidy as I’d like.
  3. Give your primary account access to the new Subversion repository.
  4. Grab the TextDrive deploy.rb from nuby on rails. Verify deploy_to and server.document-root are /web and /web/public respectively.
  5. Do the initial import into the repository and an initial checkout back to your local machine.
  6. cd to your local app and run cap setup. Confirm you now have a /web/shared directory. It should contain the following directories: log, pids, and system. In log you should have at least production.log and fastcgi.crash.log. Create and chmod them to 666 if they don’t exist.
  7. Follow TextDrive’s instructions for setting up lighttpd, rails, and a proxy.
  8. Change the /web/public/ paths in APPNAME.conf and rails.sh to /web/current/public/
  9. Follow TextDrive’s instructions to start up lighttpd and rails.
    Running their rails.sh file didn’t work for me, editing and manually running the script did.

After all this, cap deploy will deploy your app for you as advertised.

After I tweak a couple more dials and flip a couple more switches I’ll point you to the app.

2 thoughts on “How To Deploy Rails with SVN and Capistrano to a Secondary Domain on TextDrive

  1. Hi Garrick,

    Thanks for writing this up! I have some questions for you if you don’t mind.

    The shovel script you reference says that it creates a “sites” directory that will hold installations of deployed websites. But, you aren’t using this feature, right?

    Aren’t you just installing inside the /web and /web/public folders of a domain you created on textdrive?

    How did you get around all the little differences the shovel script has from how textdrive tell you to set things up?

    Thanks!

  2. Jon,
    Thanks for the comment, and yes you’re correct. The article actually describes how I reconciled the differences between the shovel script and textdrive (changing directory paths to /web and /web/public, ect.)

Comments are closed.