Find a Better Front End
ViewCVS was originally written for CVS. However, because CVS and SVN are so similar in functionality, it works just as well for SVN. You can run most of the above examples easily from ViewCVS, making it a convenient, portable way to view files.
Install ViewCVS, and set up Apache to use the
viewcvs.cgi as a path. You'll need to add these lines to your
httpd.conf file:
ScriptAlias /viewcvs /path/to/your/viewcvs/cgi/viewcvs.cgi
Next, you need to make sure that the
viewcvs path has permissions to run properly:
<Directory "/path/to/your/viewcvs/cgi/viewcvs.cgi">
AllowOverride None
Options +ExecCGI
Order allow,deny
Allow from all
AuthType Basic
AuthName "Authorization Realm"
AuthUserFile /srv/svn/user_access/passwd
Require valid-user
# Require SSL connection for password protection.
# SSLRequireSSL
</Directory>
In the installation root of ViewCVS, there's a file called
viewcvs.conf. Make sure that
cvs_roots is commented out, and the following directives are enabled:
svn_roots:
base_depot : /opt/svn/depot
svn_parent_path = /opt/svn/depot
default_root = base_depot
Finally, you'll need to run
apachectl configtest and then
apachectl restart. Now, go to
http:///viewcvs on your Web browser, and a nice Web-based version (see
Figure 2) of some of what you've previously done should appear.
 | |
| Figure 2. Repository View: By navigating to the viewcvs page of your server, you'll see a nice browser-based view of the items in the repository. |
Populating the Repository
As I mentioned previously, there are two major ways that the repository can be updated. The first method is fairly simplesimply run a cron job at regular intervals. The downside to this method is that the routers may not have the absolute most up-to-date revision of the configuration; however, it's very easy to configure. The second method is to set up your Cisco router to send SNMP traps to a host whenever configuration changes happen. The host will then retrieve the latest configuration and upload it into the repository automatically.
Cron-Based updates
You'll need to
download the sample script (
snmp-conf.pl), and configure your routers towards the bottom of the script. Next, you'll need to paste the following code into a script at
/usr/local/bin/router-cron.sh, and then run the command
chmod 755 /usr/local/bin/router-cron.sh.
</b>#!/bin/sh
# set these for your environment
SVN=/usr/local/bin/svn
NOW=`date`
CMD=/usr/local/bin/snmp-conf.pl
# check out the configs
cd /tmp; $SVN co http://<yourhost>/depot/routers
# edit the following line to contain the
# IP addresses of your
routers
for ROUTER in '10.0.0.1 10.0.1.1 10.0.2.1'
do
$CMD -t ${ROUTER} -o /tmp/routers
done
# update the repository
cd /tmp/routers; $SVN update
# commit the changes
cd /tmp/routers; $SVN commit --message
"Auto update on $NOW"
Then, set up the cron job. The following example causes the configurations to be backed up every Thursday at midnight:
0 0 * * 5 /usr/local/bin/router-cron.sh
If you've decided to use the cron method, ignore the next section of this article and skip to the section titled "
Configuring the Initial Repository." You need to take some steps to ensure the proper functionality of the Subversion repository.