How to setup a Linux web server using the command line, Part 4 : Subversion Repository Setup

#
# svn setup for Subversion+Capistrano Web Applications
#

If we’re going to be agile developers, we’ll want to employ Subversion and Capistrano to track versions and deploy our applications quickly.  Let’s setup a base repository for subversion to call home.  Then let’s create an svn repository shell for our project, which we’ll deploy with Capistrano in Part 5.  But first, go through these steps for each website’s apache vhost you’ve created in Part 3.


# on remote server

# create repositories base

mkdir -p /home/super/rep/{svn,crm,git}

# create svn project repositories

svnadmin create /home/super/rep/svn/myproject1

# create standard svn skeleton project

svn mkdir “file:///home/super/rep/svn/myproject1/branches” “file:///home/super/rep/svn/myproject1/tags” “file:///home/super/rep/svn/myproject1/trunk” -m “project start”

# output
> Committed revision 1.

# on local machine

# config ssh connection for svn

nano ~/.subversion/config
# add under [tunnels]
my_ssh = /usr/bin/ssh -p 33333 -l super

# checkout a working copy

svn co svn+my_ssh://111.222.333.444/home/super/rep/svn/myproject1/trunk ~/work/myproject1_work
# you should see output like this
Checked out revision 1.

# the above svn checkout command places the svn working copy in the (hidden) directory “.svn”.  To see this hidden folder, type:

ls -a ~/work/myproject1_work

# Cool. Now we have a bare-bones working copy so we can start or import our rails application(s)

# change directory to working copy root

cd ~/work/myproject1_work

# ignore certain files and folders

svn propset svn:ignore “*” log/
svn propset svn:ignore “*” tmp/
svn commit -m “set to ignore tmp/ and log/ directories”

# now you can make changes in the file content under

cd ~/work/myproject1_work

# when you come to a stopping point, you can force svn to add all the changes you’ve made
# to your application and commit them to the remote repository.

svn add –force .
svn commit -m “import some new changes”

Done!

Now on to Part 5 where we’ll capify our working copy for use with Capistrano, a very simple to use, automated web application deployment gem…

Leave a Comment

You must be logged in to post a comment.