File subversion.README.SuSE of Package subversion.939


1. backup and restore your repository data
2. create svn user/group for svnserve
3. mini-howto for 2 projects


1. backup and restore your repository data

subversion repositories use either the Berkeley Database system libraries,
or the FSFS database format which comes with the subversion package.
Since the BDB system libraries often introduce a new incompatible format during
version upgrade, a backup/restore of all the subversion repositories must be
performed _BEFORE_ doing such a system upgrade.
'svnadmin dump' will write the repository to stdout in a 'dumpfile' format.
This dumpfile can be loaded later with 'svnadmin load'.

2. create svn user/group for svnserve

subversion repositories can be served either via http, or via the svnserve
daemon and a special network protocol. svnserve should not run as root user.
The startup script rcsvnserve expects a user/group named 'svn', configureable
via /etc/sysconfig/svnserve.

But this user/group must be created before first use:

	groupadd svn
	useradd  -d /srv/svn -s /bin/false -g svn svn

3. mini-howto for 2 projects

To run a subversion server, you need to configure apache2 to load two apache2
modules: mod_dav and mod_dav_svn. (mod_dav is needed by mod_dav_svn, it is
installed together with apache2.)

This is done by adding the dav and dav_svn modules to the apache2 configuration
(a2enmod dav; a2enmod dav_svn), and restarting the server.

A default/example configuration of the dav_svn module can be found in
/etc/apache2/conf.d/subversion.conf. With more recent apache
packages, this configuration is *not* loaded automatically by
the apache server, since many people configure virtual hosts
and it is unlikely that the repositories shall be available
from any virtual host. To load the configuration for a certain
virtual host, add 
  Include /etc/apache2/conf.d/subversion.conf
  Include /path/to/your_subversion_configuration
in the respective virtual host configuration. This *may* be done in the default
virtual host (/etc/apache2/default-server.conf).


The plan:

host 2 source projects with subversion
both must have anonymous read access
both must have limited write access for a few users
they are accessed only via HTTP, not (!) locally
they will be reachable via:


Both will have the official version of the source tree and our modified
version for the distribution. Projects in question are:

The realisation:

find a machine to host the projects. Keep backup (and restore!) in mind
when hunting for hardware.

install needed packages
(you might check for update packages on )

rpm -Uvh \
	apache2 \
	apache2-doc \
	apache2-prefork \
	libapr1 \
	libapr-util1 \
	neon \
	subversion \
	subversion-doc \

# Update /etc/sysconfig/apache2 by
# adding 'dav dav_svn' to $APACHE_MODULES:
a2enmod dav
a2enmod dav_svn

create a few directories:
mkdir -p /srv/svn/repos
mkdir -p /srv/svn/user_access
mkdir -p /srv/svn/html

Add the http repository data to /etc/apache2/conf.d/subversion.conf:
# project related HTML files
<IfModule mod_alias.c>
Alias /repos	"/srv/svn/html"
<Directory /srv/svn/html>
	Options		+Indexes +Multiviews -FollowSymLinks
	IndexOptions	FancyIndexing \
			ScanHTMLTitles \
			NameWidth=* \
			DescriptionWidth=* \
			SuppressLastModified \

	order allow,deny
	allow from all

# project repository files for project1
<Location /repos/project1>
	DAV svn
	SVNPath /srv/svn/repos/project1

	# Limit write access to certain people
	AuthType Basic
	AuthName "Authorization for project1 required"
	AuthUserFile /srv/svn/user_access/project1_passwdfile
	AuthGroupFile /srv/svn/user_access/project1_groupfile
	Require group project1_committers

	# Limit read access to certain people
	Require group project1_committers
	Require group project1_readers


# project repository files for project2
<Location /repos/project2>
	DAV svn
	SVNPath /srv/svn/repos/project2

	# Limit write permission to list of valid users.
		# Require SSL connection for password protection.
		# SSLRequireSSL

		AuthType Basic
		AuthName "Authorization for project2 required"
		AuthUserFile /srv/svn/user_access/project2_passwdfile
		Require valid-user

create the repositories itself:
cd /srv/svn/repos
svnadmin create project1
chown -R wwwrun:www project1/{dav,db,locks}
svnadmin create project2
chown -R wwwrun:www project2/{dav,db,locks}

The webserver must be (re)started:
rcapache2 restart

Now create the user access files:
project1 is a restricted project.
read access requires a password
write access is limited to a few users
touch /srv/svn/user_access/project1_passwdfile
chown root:www /srv/svn/user_access/project1_passwdfile
chmod 640 /srv/svn/user_access/project1_passwdfile

htpasswd2 /srv/svn/user_access/project1_passwdfile olaf
htpasswd2 /srv/svn/user_access/project1_passwdfile olh

this is the group file for project1:
project1_committers: olh
project1_readers: olaf olh

project2 is world readable, but only a few can commit to the sources.
touch /srv/svn/user_access/project2_passwdfile
chown root:www /srv/svn/user_access/project2_passwdfile
chmod 640 /srv/svn/user_access/project2_passwdfile
htpasswd2 /srv/svn/user_access/project2_passwdfile olaf 

You should be able to connect to the server:

Now import the data, e.g.
svn import /path/to/project2-tree http://host/repos/project2
openSUSE Build Service is sponsored by