icelava.net

Re-wiring the brain, re-defining the human workflow
Welcome to icelava.net Sign in | Help
in Search

Setting up Subversion repository as background service in Windows

Last post 06-23-2007, 6:10 by icelava. 1 replies.
Sort Posts: Previous Next
  •  05-12-2005, 16:44 1013

    Setting up Subversion repository as background service in Windows

    By far the smoothest (notice I don't use "best") SCM client interface I have come across has to be TortoiseSVN. Its seamless integration into the Windows Explorer shell make it an ease to work with.

    Of course, no wonderful client alone is gonna do much good unless it has a repository server to work with. Subversion, the SCM system that TortoiseSVN checks against, is an adaptive software with different modes of deployment. Here I will focus on how get Windows 2003 to run its own proprietary service svnserve.exe as a true-blue Windows Service.

    True to its Unix roots, Subversion administration is handled by an array of command line tools. While its implementation for Windows is pretty decent, svnserve.exe is not installed as a Windows Service (again remaining true to Unix, which easily runs command line programs in background). So after setting up a repository, for example

    svnadmin.exe create F:\Repo\First --fs-type fsfs

    One still has to activate the service in an interactive desktop session

    svnserve.exe -d -r F:\Repo

    which will leave a blank console prompt window hanging perpetually until one decides to close it or logout. Not a good deal for [smart] administrators who don't like logging on to perform manual tasks.

    The good news for Windows 2003 administrators is the Server Resource Kit is available for download, packing some very useful programs that will grant +1 to 5 power-up in administration capabilities. Can be worn on any finger. But require at least Level 20 experience due to the usual Microsoft support policy (or lack thereof) and frequent recommendations to visit the dungeon known as the Registry. This exercise will bring you there as well, so stock up on health potions backup your system.

    Critical to this issue are two tools: instsrv.exe and srvany.exe. The former is used to register any executable as a Windows Service. Once that is done it will appear in the Services MMC. So registration syntax follows the likes of

    instsrv.exe SubversionRepository "C:\Program Files\Windows Resource Kits\Tools\srvany.exe"

    That's right, you saw it correctly, no mistake - the latter tool is being registered as the executable for the service named SubversionRepository (you can call it something else if you want). Srvany.exe is a wrapper executable, providing the necessary behaviour required of a real Windows Service program, which the actual intended program may not. In this case, svnserve.exe. So how does srvany.exe know what to wrap and run in the first place? Time to put on your armour, cast the buffs, and launch regedit.exe.
    1. Navigate down to HKLM\SYSTEM\CurrentControlSet\Services\SubversionRepository, which is what instsrv.exe wrote into the Registry, but only with the bare essentials.
    2. Under this key, create a new sub-key called "Parameters". Do so by right-clicking and selecting New > Key from the context menu.
    3. Within this sub-key two new string values have to be placed, so again right-click and New > String Value twice.
    4. Rename the first one "Application" and modify its value to "C:\Program Files\Subversion\bin\svnserve.exe" (without quotes).
    5. Rename the second to "AppParameters" and modify its value to "-d  -r F:\Repo" (without quotes).
    Additionally, you may opt to be more security-minded and make use of NT AUTHORITY\NETWORK SERVICE to run the service. Which case, remember to grant NETWORK SERVICE Modify permissions to the repository root directory and Read permissions to the Subversion installation.

    Once the Registry is modified, the service can be started and you should well be on the way to accessing the Subersion repository via its proprietary protocol svn://machine/First/, without you having to logon.
    Filed under: ,
  •  06-23-2007, 6:10 1505 in reply to 1013

    Subversion 1.4 natively supports Windows service mode

    For those who dread downloading and installing the resource kit and doing extra work just to setup a Windows-based Subversion service, rejoice as svnserve.exe has a new --service parameter so it need not run only in blocking DOS mode.

    But, you are still gonna weep because there isn't a convenient and *pretty* GUI to install the service - still have to manually set it up to run as a service, with the following command:

    sc create SubversionNative binpath= "c:\program files\subversion\bin\svnserve.exe --service --root G:\repositories"
          displayname= "Subversion native"
          depend= Tcpip

    Exactly the same executable pointing to the same repository path as before; just a couple of steps less. Well, can't complain about something that is free, can we?

    Filed under: ,
View as RSS news feed in XML
Powered by Community Server, by Telligent Systems