DCVS Installation in 30 Minutes Thank you for trying DCVS. With this guide, you should be able to set up DCVS by example in a matter of minutes. Let's assume your company's name is "ABC Software" and you want to use DCVS for revision control of your latest in-house project, an e-government platform called "e-gov". Early work on the project has started, so you already have some sources to import into a DCVS repository. Our example DCVS setup consists of three fictual machines: flubb.example.com, zoom.example.com, and wheee.example.com. flubb is situated in Belgium, zoom is situated in South Africa, and wheee is situated in Canada. Each machine will host a replication of the DCVS repository, so developers can always use a local copy for fast access. === INSTALLING DCVS =================================================== This step should not take long, given that binary packages are available for the operating systems running on flubb, zoom and wheee. The following operating systems are supported out of the box: Debian GNU/Linux FreeBSD Fedora Core Linux Solaris NetBSD MacOSX/Darwin (Fink package available only!) Microsoft Windows (Client only, so not relevant to this guide.) For each of these, you can download DCVS binary packages from http://www.elegosoft.com/dcvs Use the system's native package management tools to install DCVS. Note that for MacOSX/Darwin, you need to install Fink first if you don't have it already. Fink is free software. You can download it from the fink homepage: http://fink.sourceforge.net. Apart from installing the DCVS programs, the packages will also create a 'dcvs' user and a 'dcvs' group on your system. === CONFIGURING DCVS ================================================== First you need to find the directory where DCVS configuration files reside: Debian, Fedora: /etc/dcvs FreeBSD, Solaris: /usr/local/etc/dcvs NetBSD: /usr/pkg/etc/dcvs Darwin: /sw/etc/dcvs From now on I will refer to this directory as the "DCVS configuration directory". Go to the DCVS configuration directory and open the file dcvs_config. Our example configuration file looks like this: --- dcvs_config start ------------------------------------------------- # We start by defining several ranges, each consisting of 10000 possible # revision branch numbers. You usually do not need to change this; # only add new ranges when you need them for new servers. # # name branch numbers range r1 0..9999 range r2 10000..19999 range r3 20000..29999 # 'server' statements describe the servers involved. # # host host fqdn dcvsupd listening port server flubb flubb.example.com 44555 server zoom zoom.example.com 44555 server wheee wheee.example.com 44555 # 'collection' statements describe collections. # A collection statement consists of a path to a repository containing the # collection, a name, and a list that defines the ranges used by each host. # It is terminated by the keyword 'end'. # Put each of your projects into a single collection. # # path to repositories name of this collection collection /var/repositories/dcvs e-gov # Map ranges to hosts: flubb: r1 zoom: r2 wheee: r3 end --- dcvs_config end --------------------------------------------------- You can add more servers, ranges and/or collections later. The configuration file is the same for each host. You can create it on one host and copy it to the others as-is. Next, you need to carry out the following steps on each host: - Go to the DCVS configuration directory - Create the collection: cvsupadm -m ./dcvs_config create cvscoll e-gov \ /var/repositories/dcvs e-gov - Create dcvsupd configuration files: cvsupadm -m ./dcvs_config create dcvsupfiles - Create DCVS lock directories: dcvs_lock.sh create If your machines are not connected via an encrypted VPN, you can use SSH to encrypt data during replication. For SSH, you should create SSH keys for the 'dcvs' user on each machine. Password based login for the 'dcvs' user is disabled by default. So you need to su to root and then su to the dcvs user: su - su - dcvs Now create the key: ssh-keygen -t dsa Let's assume you will use an empty passphrase, in order to keep things less complicated for this test setup. Encrypting the key with a passphrase is a good idea though. In case an untrusted individual gets access to the private SSH key of your dcvs user, your key will still be protected by the passphrase. However, having a passphrase means that you have to run an SSH agent, unless you want to enter the passphrase manually each time the repositories are synchronized. For convinience, you could use a program like keychain, which requires you to enter the passphrase only should the system be rebooted. You can find more information about keychain at http://www.gentoo.org/proj/en/keychain/index.xml For each machine, copy the public ssh key of the dcvs user (~/.ssh/id_dsa.pub) into ~/.ssh/authorized_keys on all machines. Test your SSH setup by running following commands on each machine: ssh localhost id ssh flubb id ssh zoom id ssh wheee id Each command should print a line like: uid=1158(dcvs) gid=1158(dcvs) groups=1158(dcvs) without asking for a password. Now you should import the sources of e-gov. Suppose you have the current e-gov sources on flubb. On flubb, go to the top-level directory of the e-gov sources and run: dcvs import -d flubb.example.com:/var/repositories/dcvs import \ -m "Initial import of e-gov" e-gov ABC_SOFTWARE start Now we need to start the dcvsupd replication daemon on each host. Debian, Fedora, Solaris: /etc/init.d/dcvsupd start FreeBSD: cd /usr/local/etc/rc.d; chmod +x dcvsupd.sh; ./dcvsupd.sh start NetBSD: /usr/pkg/etc/rc.d/dcvsupd.sh start Darwin: /sw/sbin/dcvsupd.sh start To test the replication process, run the following commands on zoom and wheee: su - su - dcvs sdhcups.sh -h # note the name of the logfile that is printed sdcvsup.sh flubb.example.com tail If all goes well, you should see output like: Using DCVS configuration from /etc/dcvs/dcvs_config multi site server zoom.example.com DCVS update starting at Sat Nov 09 14:21:35 CET 2005 Connected to flubb.example.com Updating collection e-gov Finished successfully To automate the replication process, add the command 'sdcvsup.sh ' to the crontab of the 'dcvs' user. Now your developers can start programming, and manage the sources using either the 'dcvs' program or the standard 'cvs' command (only works if the environment variable CVS_SERVER is set to "dcvs"). Hint: If you have multiple administrators for your DCVS setup, and you do not want to hand out root passwords to all of them, you can simply make the DCVS configuration files writable by user and/or group dcvs and add your admins to the dcvs group. This way they can administrate the DCVS setup without knowing the root password.