In previous articles in the RANCID series I described:

So, we have RANCID collecting configuration from network devices to repository with version control. Only question is how to get access and make use of information collected there.

In this part of RANCID stories I will show how to install and configure WebSVN to access RANCID repository via web browser.

Downloading and extracting WebSVN

WebSVN web page is available here. Direct link to WebSVN package is available here.

Below is command line dump from Lab environment in which I did installation:

lab-gw-01:~ # mkdir websvn
lab-gw-01:~ # cd websvn
lab-gw-01:~/websvn # wget http://websvn.tigris.org/files/documents/1380/49056/websvn-2.3.3.tar.gz
asking libproxy about url 'http://websvn.tigris.org/files/documents/1380/49056/websvn-2.3.3.tar.gz'
libproxy suggest to use 'direct://'--2012-02-20 19:14:06--  http://websvn.tigris.org/files/documents/1380/49056/websvn-2.3.3.tar.gz
Resolving websvn.tigris.org... 204.16.104.146
Connecting to websvn.tigris.org|204.16.104.146|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 882779 (862K) [application/x-gzip]
Saving to: `websvn-2.3.3.tar.gz'
100%[============================================>] 882,779      162K/s   in 5.5s
2012-02-20 19:14:22 (155 KB/s) - `websvn-2.3.3.tar.gz' saved [882779/882779]
lab-gw-01:~/websvn #

Once archive is downloaded we need to extract files:

lab-gw-01:~/websvn # tar -xvf websvn-2.3.3.tar.gz
websvn-2.3.3/
websvn-2.3.3/include/
websvn-2.3.3/include/version.php
websvn-2.3.3/include/configclass.php
websvn-2.3.3/include/template.php
websvn-2.3.3/include/header
websvn-2.3.3/include/svnlook.php
websvn-2.3.3/include/bugtraq.php
websvn-2.3.3/include/diff_inc.php
websvn-2.3.3/include/utils.php
websvn-2.3.3/include/setup.php
websvn-2.3.3/include/distconfig.php
websvn-2.3.3/include/command.php
websvn-2.3.3/include/accessfile.php
websvn-2.3.3/include/auth.php
websvn-2.3.3/include/diff_util.php
websvn-2.3.3/dl.php
websvn-2.3.3/log.php
......
websvn-2.3.3/languages/russian.php
websvn-2.3.3/languages/slovenian.php
websvn-2.3.3/languages/portuguese.php
websvn-2.3.3/languages/uzbek.php
websvn-2.3.3/filedetails.php
websvn-2.3.3/cache/
websvn-2.3.3/cache/tmp
lab-gw-01:~/websvn #

Adding WebSVN to Apache2

Next step is to place WebSVN in apropriate folder, which in my case is /srv/www/websvn.

lab-gw-01:~/websvn # cp -R websvn-2.3.3 /srv/www/websvn
lab-gw-01:~/websvn # cd /srv/www
lab-gw-01:/srv/www # ls -l
total 12
drwxr-xr-x 2 root root 4096 Feb 18  2011 cgi-bin
drwxr-xr-x 2 root root 4096 Feb 18  2011 htdocs
drwxr-xr-x 9 root root 4096 Feb 20 19:25 websvn
lab-gw-01:/srv/www # cp websvn/include/distconfig.php websvn/include/config.php
lab-gw-01:/srv/www #

Once all files are in right place we can add configuration to Apache2 web server.

/etc/apache2/conf.d/websvn.conf

# WEBSVN CONFIG SNIPPETS FOR APACHE WEB SERVER
# Last Modified: 2012-02-20
Alias /websvn "/srv/www/websvn"
<Directory "/srv/www/websvn">
    Options None
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>

Once additional configuration file for Apache2 is created we can restart or reload Apache2 configuration and test access to WebSVN:

lab-gw-01:/etc/apache2/conf.d # service apache2 reload
Reload httpd2 (graceful restart)                  done
lab-gw-01:/etc/apache2/conf.d #

We just confirmed that Apache2 has proper configuration and we can access WebSVN. One missing piece is to point WebSVN to location where our RANCID repository sits, so WebSVN can display its content.


Configuring WebSVN to display RANCID repositories

/srv/www/websvn/include/config.php

// Local repositories (without and with optional group):
//
$config->addRepository('LAB', 'file:///var/lib/rancid/SVN');

Now we can test is RANCID repository is available for us by going to http://172.16.90.5/websvn. Results should be as below :)


Reference materials

Articles which might be helpful in LAB environment preparation and/or RANCID deployment:

Enjoy! :)