.TH "FSVS - Master/Local HOWTO" 5 "11 Mar 2010" "Version trunk:2424" "fsvs" \" -*- nroff -*- .ad l .nh .SH NAME HOWTO: Master/Local repositories \- .PP This HOWTO describes how to use a single working copy with multiple repositories. This HOWTO describes how to use a single working copy with multiple repositories. Please read the \fBHOWTO: Backup\fP first, to know about basic steps using FSVS. .SH "Rationale" .PP If you manage a lot of machines with similar or identical software, you might notice that it's a bit of work keeping them all up-to-date. Sure, automating distribution via rsync or similar is easy; but then you get identical machines, or you have to play with lots of exclude patterns to keep the needed differences. .PP Here another way is presented; and even if you don't want to use FSVS for distributing your files, the ideas presented here might help you keep your machines under control. .SH "Preparation, repository layout" .PP In this document the basic assumption is that there is a group of (more or less identical) machines, that share most of their filesystems. .PP Some planning should be done beforehand; while the ideas presented here might suffice for simple versioning, your setup can require a bit of thinking ahead. .PP This example uses some distinct repositories, to achieve a bit more clarity; of course these can simply be different paths in a single repository (see \fBUsing a single repository\fP for an example configuration). .PP Repository in URL \fCbase:\fP .PP .nf trunk/ bin/ ls true lib/ libc6.so modules/ sbin/ mkfs usr/ local/ bin/ sbin/ tags/ branches/ .fi .PP .PP Repository in URL \fCmachine1\fP (similar for machine2): .PP .nf trunk/ etc/ HOSTNAME adjtime network/ interfaces passwd resolv.conf shadow var/ log/ auth.log messages tags/ branches/ .fi .PP .SS "User data versioning" If you want to keep the user data versioned, too, a idea might be to start a new working copy in \fBevery\fP home directory; this way .IP "\(bu" 2 the system- and (several) user-commits can be run in parallel, .IP "\(bu" 2 the intermediate \fChome\fP directory in the repository is not needed, and .IP "\(bu" 2 you get a bit more isolation (against FSVS failures, out-of-space errors and similar). .IP "\(bu" 2 Furthermore FSVS can work with smaller file sets, which helps performance a bit (less dentries to cache at once, less memory used, etc.). .PP .PP .PP .nf A/ Andrew/ .bashrc .ssh/ .kde/ Alexander/ .bashrc .ssh/ .kde/ B/ Bertram/ .fi .PP .PP A cronjob could simply loop over the directories in \fC/home\fP, and call fsvs for each one; giving a target URL name is not necessary if every home-directory is its own working copy. .PP \fBNote:\fP .RS 4 URL names can include a forward slash \fC/\fP in their name, so you might give the URLs names like \fChome/Andrew\fP - although that should not be needed, if every home directory is a distinct working copy. .RE .PP .SH "Using master/local repositories" .PP Imagine having 10 similar machines with the same base-installation. .PP Then you install one machine, commit that into the repository as \fCbase/trunk\fP, and make a copy as \fCbase/released\fP. .PP The other machines get \fCbase/released\fP as checkout source, and another (overlaid) from eg. \fCmachine1/trunk\fP. .br Per-machine changes are always committed into the \fCmachineX/trunk\fP of the per-machine repository; this would be the host name, IP address, and similar things. .PP On the development machine all changes are stored into \fCbase/trunk\fP; if you're satisfied with your changes, you merge them (see \fBBranching, tagging, merging\fP) into \fCbase/released\fP, whereupon all other machines can update to this latest version. .PP So by looking at \fCmachine1/trunk\fP you can see the history of the machine-specific changes; and in \fCbase/released\fP you can check out every old version to verify problems and bugs. .PP \fBNote:\fP .RS 4 You can take this system a bit further: optional software packages could be stored in other subtrees. They should be of lower priority than the base tree, so that in case of conflicts the base should always be preferred (but see \fB1\fP). .RE .PP Here is a small example; \fCmachine1\fP is the development machine, \fCmachine2\fP is a \fIclient\fP. .PP .nf machine1$ fsvs urls name:local,P:200,svn+ssh://lserver/per-machine/machine1/trunk machine1$ fsvs urls name:base,P:100,http://bserver/base-install1/trunk # Determine differences, and commit them machine1$ fsvs ci -o commit_to=local /etc/HOSTNAME /etc/network/interfaces /var/log machine1$ fsvs ci -o commit_to=base / .fi .PP .PP Now you've got a base-install in your repository, and can use that on the other machine: .PP .nf machine2$ fsvs urls name:local,P:200,svn+ssh://lserver/per-machine/machine2/trunk machine2$ fsvs urls name:base,P:100,http://bserver/base-install1/trunk machine2$ fsvs sync-repos # Now you see differences of this machines' installation against the other: machine2$ fsvs st # You can see what is different: machine2$ fsvs diff /etc/X11/xorg.conf # You can take the base installations files: machine2$ fsvs revert /bin/ls # And put the files specific to this machine into its repository: machine2$ fsvs ci -o commit_to=local /etc/HOSTNAME /etc/network/interfaces /var/log .fi .PP .PP Now, if this machine has a harddisk failure or needs setup for any other reason, you boot it (eg. via PXE, Knoppix or whatever), and do (\fB3\fP) .PP .nf # Re-partition and create filesystems (if necessary) machine2-knoppix$ fdisk ... machine2-knoppix$ mkfs ... # Mount everything below /mnt machine2-knoppix$ mount /mnt/[...] machine2-knoppix$ cd /mnt # Do a checkout below /mnt machine2-knoppix$ fsvs co -o softroot=/mnt .fi .PP .SH "Branching, tagging, merging" .PP Other names for your branches (instead of \fCtrunk\fP, \fCtags\fP and \fCbranches\fP) could be \fCunstable\fP, \fCtesting\fP, and \fCstable\fP; your production machines would use \fCstable\fP, your testing environment \fCtesting\fP, and in \fCunstable\fP you'd commit all your daily changes. .PP \fBNote:\fP .RS 4 Please note that there's no merging mechanism in FSVS; and as far as I'm concerned, there won't be. Subversion just gets automated merging mechanisms, and these should be fine for this usage too. (\fB4\fP) .RE .PP .SS "Thoughts about tagging" Tagging works just like normally; although you need to remember to tag more than a single branch. Maybe FSVS should get some knowledge about the subversion repository layout, so a \fCfsvs tag\fP would tag all repositories at once? It would have to check for duplicate tag-names (eg. on the \fCbase\fP -branch), and just keep it if it had the same copyfrom-source. .PP But how would tags be used? Define them as source URL, and checkout? Would be a possible case. .PP Or should \fCfsvs tag\fP do a \fImerge\fP into the repository, so that a single URL contains all files currently checked out, with copyfrom-pointers to the original locations? Would require using a single repository, as such pointers cannot be across different repositories. If the committed data includes the \fC$FSVS_CONF/\fP.../Urls file, the original layout would be known, too - although to use it a \fBsync-repos\fP would be necessary. .SH "Using a single repository" .PP A single repository would have to be partitioned in the various branches that are needed for bookkeeping; see these examples. .PP Depending on the number of machines it might make sense to put them in a 1- or 2 level deep hierarchy; named by the first character, like .PP .PP .nf machines/ A/ Axel/ Andreas/ B/ Berta/ G/ Gandalf/ .fi .PP .SS "Simple layout" Here only the base system gets branched and tagged; the machines simply backup their specific/localized data into the repository. .PP .PP .nf # For the base-system: trunk/ bin/ usr/ sbin/ tags/ tag-1/ branches/ branch-1/ # For the machines: machines/ machine1/ etc/ passwd HOSTNAME machine2/ etc/ passwd HOSTNAME .fi .PP .SS "Per-area" Here every part gets its \fCtrunk\fP, \fCbranches\fP and \fCtags:\fP .PP .PP .nf base/ trunk/ bin/ sbin/ usr/ tags/ tag-1/ branches/ branch-1/ machine1/ trunk/ etc/ passwd HOSTNAME tags/ tag-1/ branches/ machine2/ trunk/ etc/ passwd HOSTNAME tags/ branches/ .fi .PP .SS "Common trunk, tags, and branches" Here the base-paths \fCtrunk\fP, \fCtags\fP and \fCbranches\fP are shared: .PP .PP .nf trunk/ base/ bin/ sbin/ usr/ machine2/ etc/ passwd HOSTNAME machine1/ etc/ passwd HOSTNAME tags/ tag-1/ branches/ branch-1/ .fi .PP .SH "Other notes" .PP .SS "1" Conflicts should not be automatically merged. If two or more trees bring the same file, the file from the \fIhighest\fP tree wins - this way you always know the file data on your machines. It's better if a single software doesn't work, compared to a machine that no longer boots or is no longer accessible (eg. by SSH)). .PP So keep your base installation at highest priority, and you've got good chances that you won't loose control in case of conflicting files. .SS "2" If you don't know which files are different in your installs, .IP "\(bu" 2 install two machines, .IP "\(bu" 2 commit the first into fsvs, .IP "\(bu" 2 do a \fBsync-repos\fP on the second, .IP "\(bu" 2 and look at the \fBstatus\fP output. .PP .SS "3" As debian includes FSVS in the near future, it could be included on the next KNOPPIX, too! .PP Until then you'd need a custom boot CD, or copy the absolute minimum of files to the harddisk before recovery. .PP There's a utility \fCsvntar\fP available; it allows you to take a snapshot of a subversion repository directly into a \fC\fP.tar -file, which you can easily export to destination machine. (Yes, it knows about the meta-data properties FSVS uses, and stores them into the archive.) .SS "4" Why no file merging? Because all real differences are in the per-machine files -- the files that are in the \fCbase\fP repository are changed only on a single machine, and so there's an unidirectional flow. .PP BTW, how would you merge your binaries, eg. \fC/bin/ls\fP? .SH "Feedback" .PP If you've got any questions, ideas, wishes or other feedback, please tell us in the mailing list \fCusers [at] fsvs.tigris.org\fP. .PP Thank you! .SH "Author" .PP Generated automatically by Doxygen for fsvs from the source code.