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:
- How-to : Adding devices to RANCID
- How to : Install RANCID on openSUSE 11.4 “Celadon”
- How-to : VMware Workstation 8 and GNS3 integration
Enjoy! π
Hello,
Thanks for the good tutorial!
I have a problem with websvn.
after adding the repository it gives me a error http://localhost/websvn
Error running this command: svn – non-interactive – config-dir / tmp list – xml ‘file :/ / / var / lib / rancid / SVN / @’
Unable to open an URL to ra_local session
Unable to open repository ‘file :/ / / var / lib / rancid / SVN’
Can not open file ‘/ var / lib / rancid / SVN / format: Permission denied
What exact rights should I add?
Please review this post https://blog.skufel.net/2011/11/how-to-rancid-installation-on-opensuse-11-4-celadon/ and check if all permissions to RANCID folders are set similar way as this might be cause.
When you verify that and still no joy then we have a look into websvn.conf file to figure out if all paths are set correctly.
thanks for your answer!
I find my problem, I added the apache user rights. that was why.
Now I see all the folders and files on websvn, but when I click on are empty. While the root file contains the configuration.
I put all of these rights to a file, but it did not change anything.
Have you any idea?
Quick question If I MAY, the lab-net-01 , address that shows in the example, does that correspond to a specific hostname/IP address that is configured some other place out of this toturial? Thanks and great tut by the way!!
lab-net-01 is same system as lab-gw-01. Just typo on screenshot.
Hi Pierra, I have problem like you, What is your solution for this error ?
Error running this command: svn β non-interactive β config-dir / tmp list β xml βfile :/ / / var / lib / rancid / SVN / @β
Unable to open an URL to ra_local session
Unable to open repository βfile :/ / / var / lib / rancid / SVNβ
Can not open file β/ var / lib / rancid / SVN / format: Permission denied
Please help. I have this same problem and for the life of me i can not figure it out.
I did a chown for www-data to the SVN directory and it fixed it. not sure if this was the best way to do it but I havent figured out if it broke anything yet. I think it should probably be done with a group so that rancid, svn and apache all have access to the folder…