Ruby on Rails
HowToDeployYourRailsAppFromSubversion

Somewhat inspired by this thread on the TextDrive forums: http://forum.textdrive.com/viewtopic.php?id=4199

You can deploy the latest version of your Rails app to your remote host directly from Subversion, provided of course that you have a hosting company that allows SSH access to the server (like TextDrive).

Before starting this you should be comfortable with setting up your application with Subversion (as described here – HowtoUseRailsWithSubversion), and with deploying Rails applications generally on your remote host (one way is like this – LighttpdThePainlessWay, but the following procedure works equally well for applications deployed using Apache)

Once you have developed a production ready version of your application, and committed this version into Subversion, you should:

The export command checks out the latest revision of your application, but with all of the Subversion specific directories removed from the directory tree.

Now all that needs to be done is to make sure your configuration is set up properly.

Once that’s all done your application should be ready to be deployed using Lighttpd or Apache. This can be quite an involved process, but there’s lots of documentation detailing the necessary steps.

An alternative scenario to that described above would be; instead of exporting your application from Subversion, you could check out a working copy. This would have the advantage that once you have made changes to your app, you could simple update the working copy, and save having to shuffle your old version about. The only disadvantage of this is that every directory will contain the Subversion meta information directories.

If you choose to do this, you’d enter this instead of the “Export” command:

svn checkout http://path_to_your_repository/app_name/trunk app_name

Then, every time you want to deploy the new code, simply cd to your app_name folder and execute:
svn up

…which will — whammo! — give you the latest code.



What about permissions? These are lost with the export, or can they be preserved in subversion?