Archive

Posts Tagged ‘multiple svn’

Managing multiple repositories in one subversion server

In my last post I have discussion how to setup a svnserver and create repository.Lets say the devolpers team in your company are working on different projects at the same time.So they need different repositories for different project.In this topic I will show you how to set up multiple repositories in single subvesrion server.

Scenario:-Lets say we have created a repository named repository for a project named project1 and repository name is also project1.Lets say the svn server has hostname svnserver and has user svn. So we can start the svn as

$ svnserve -d -r /project1

Now later project 2 and project 3 wanted to use subversion.These projects are unrelated to the project1 and therefore needs their own repository. So we have to setup multiple repositories.

How to Do?

I would recommend to backup the project1 repository before stepping further and then follow the steps mentioned below.

1.Create a new folder called repositories

$ ssh svn@svnserver
$ mkdir repositories
$ cd repositories

2.Inside the repositories folder create the repositories need for other projects.

$ svnadmin create roject2
$ svnadmin create project3

Now we should have a directory tree structure like below:


+---repositories
|   +---project2
|   |   +---conf
|   |   +---dav
|   |   +---db
|   |   +---hooks
|   |   \---locks
|   \---project3
|       +---conf
|       +---dav
|       +---db
|       +---hooks
|       \---locks
\---project1
    +---conf
    +---dav
    +---db
    +---hooks
    \---locks

Now all we need to do is move the project1 repository alongside the newer ones. For that we have to stop all instances of svnserve first, and of course notifying everyone working on the project1 project — but the move really will only take a few seconds.

Moving the old repository and restarting the server

$ killall svnserve
$ mv project1 repositories/project1
$ svnserve -d -r /home/svn/repositories

Inetd mode

If you’re using svnserve in inetd mode, most of the above applies directly — you simply adjust the svnserve configuration file in the obvious way to reflect the new repository root.

Repository URLs

The new repository URLs are:

  • svn://svnserver/project1
  • svn://svnserver/project2
  • svn://svnserver/project3

Note that the old URL for the project1 project was svn://svnserver/. This means that anyone with a project1 working copy will have to svn switch it.

$ svn switch --relocate svn://svnserver svn://svnserver/project1

Few TIPS:-

There may be a few scripts kicking around which need to be changed to reflect the new layout:

  • the repository backup script
  • any personal build scripts

Nothing should be hard, but with a very little forwarded planning you’ll see no loss of service. Once you’ve adjusted (if necessary) your backup script, I’d suggest now would be a good time to rehearse the recover-from-backup procedure.

Advertisements