Difference between revisions of "Configure SVN"

From Organic Design wiki
(WebSVN: modding syntax highlighting)
(Configuring local access)
Line 55: Line 55:
  
 
Note that you will be required to enter your SSH password for every transaction with the svn repository, so the following steps are required to get rid of this annoying problem.
 
Note that you will be required to enter your SSH password for every transaction with the svn repository, so the following steps are required to get rid of this annoying problem.
 +
 +
== Configuring local root access ==
 +
To create working copies of repositories on the same server that the repositories are hosted on we need to be able to checkout under the root user, so that all users with root access can update the running scripts. The problem with this though is that we use svn+ssh but ssh access is not permitted for the root user. To get round this the ''/etc/ssh/sshd_config'' file can be modified slightly to allow root logins, but only from localhost.
 +
{{code|<pre>
 +
AllowUsers root@localhost bob tabatha
 +
PermitRootLogin yes
 +
</pre>}}
 +
 +
 +
To checkout a working copy on the localhost, use the syntax in the following example:
 +
{{code|<pre>
 +
svn co svn+od://localhost/svn/extensions
 +
</pre>}}
  
 
== WebSVN ==
 
== WebSVN ==

Revision as of 04:15, 28 January 2010

Procedure.svg Configure SVN
Organic Design procedure

Setting up the SVN repository

The necessary packages should already have been installed as part of the organicdesign-server package, but if not, you'll need to apt-get install subversion libapache2-svn. Then the first step is to create the repositories as in the following example.

mkdir /svn
svnadmin create --fs-type fsfs /svn/extensions
svnadmin create --fs-type fsfs /svn/tools


Next create a subversion group and add your developers to it:

groupadd subversion

addgroup earl subversion
addgroup tabatha subversion

chown -R www-data:subversion /svn/*
chmod -R 775 /svn/* 

Logging Commits

Create a post-commit hook in your /svn/REPO/hooks/post-commit (change REPO accordingly) file containing the following:

#!/bin/sh
echo "$1 repo updated to revision $2" >> /var/log/svn.log


Create a file to log the commits to and set permissions of the log and hook script:

chmod 775 /svn/REPO/hooks
chown www-data:subversion /svn/REPO/hooks
touch /var/log/svn.log
chmod 660 /var/log/svn.log
chown www-data:subversion /var/log/svn.log

Configuring client access

The first issue with client access over SSH is that we use a non-standard port, but there is no svn switch to set this, so we need to create a specific tunnel in the subversion configuration for our server with the correct port set. Add the following to the tunnels section of ~/.subversion/config file using your own servers name and SSH port.

od = /usr/bin/ssh -p 1729


You will now be able to check out a repository or branch using the following syntax (the USER@ portion is only required if you are connecting from root or another users shell session).

svn co svn+od://USER@svn.organicdesign.co.nz/svn/foo/bar /my/local/path/to/foo/bar


Note that you will be required to enter your SSH password for every transaction with the svn repository, so the following steps are required to get rid of this annoying problem.

Configuring local root access

To create working copies of repositories on the same server that the repositories are hosted on we need to be able to checkout under the root user, so that all users with root access can update the running scripts. The problem with this though is that we use svn+ssh but ssh access is not permitted for the root user. To get round this the /etc/ssh/sshd_config file can be modified slightly to allow root logins, but only from localhost.

AllowUsers root@localhost bob tabatha
PermitRootLogin yes


To checkout a working copy on the localhost, use the syntax in the following example:

svn co svn+od://localhost/svn/extensions

WebSVN

MediaWiki uses viewvc for web viewing of their svn repositories, but the installation and configuration are a bit of a pain since its a Python CGI script rather than PHP like all our other web applications. So for this reason we're using the PHP websvn from Tigris instead.

Installation of websvn is a simple matter of downloading into /var/www/domains/websvn and creating a sub-domain and virtual host entry for it as for any other PHP web application. Next make a copy of the default config file:

cd /var/www/domains/websvn/include
cp distconfig.php config.php


And add a single entry in the repositories section pointing at the parent directory of your repositories, for example:

$config->parentPath('/svn');


You may want to add or adjust the file extensions used for syntax highlighting, each language is an array key with an array of file-extensions as its value. For example, we wanted our wikid.conf.sample file to be highlighted as Perl, so we added the following line to add "sample" to the extensions list under the "perl" key:

$extGeshi['perl'][] = 'sample';


And that's all there is to it! no simply browse to your sub-domain, ours is http://svn.organicdesign.co.nz

Doxygen