Subversion, WebDAV, and Apache HTTP Server 2 2003... · mod_dav_svn Example # Must be after...
Transcript of Subversion, WebDAV, and Apache HTTP Server 2 2003... · mod_dav_svn Example # Must be after...
![Page 1: Subversion, WebDAV, and Apache HTTP Server 2 2003... · mod_dav_svn Example # Must be after mod_dav.so if it exists as a DSO LoadModule dav_svn_module modules/mod_dav_svn.so](https://reader035.fdocuments.in/reader035/viewer/2022070809/5f07dfdb7e708231d41f2fc0/html5/thumbnails/1.jpg)
Justin R. Erenkrantz University of California, Irvine
[email protected]: http://www.erenkrantz.com/oscon/
Subversion, WebDAV,
and Apache HTTP Server 2.0
![Page 2: Subversion, WebDAV, and Apache HTTP Server 2 2003... · mod_dav_svn Example # Must be after mod_dav.so if it exists as a DSO LoadModule dav_svn_module modules/mod_dav_svn.so](https://reader035.fdocuments.in/reader035/viewer/2022070809/5f07dfdb7e708231d41f2fc0/html5/thumbnails/2.jpg)
Did you miss ‘Subversion: Version Control Rethought’?http://subversion.tigris.org/A compelling replacement to CVS0.25.0 was released this morning
Expect a release every two-three weeks
What is Subversion?
![Page 3: Subversion, WebDAV, and Apache HTTP Server 2 2003... · mod_dav_svn Example # Must be after mod_dav.so if it exists as a DSO LoadModule dav_svn_module modules/mod_dav_svn.so](https://reader035.fdocuments.in/reader035/viewer/2022070809/5f07dfdb7e708231d41f2fc0/html5/thumbnails/3.jpg)
Currently alpha Extremely conservative approachSubversion is self-hosting
But, don’t take our word for ithttp://subversion.tigris.org/svn-repositories.html
Expect 1.0 ‘soon-ish’ - beta in 2-3 months
What is Subversion?
![Page 4: Subversion, WebDAV, and Apache HTTP Server 2 2003... · mod_dav_svn Example # Must be after mod_dav.so if it exists as a DSO LoadModule dav_svn_module modules/mod_dav_svn.so](https://reader035.fdocuments.in/reader035/viewer/2022070809/5f07dfdb7e708231d41f2fc0/html5/thumbnails/4.jpg)
A mechanism for distributed authoringSpecified in RFC 2518A lot of software now supports WebDAVForgot about versioning in RFC 2518
DeltaV - RFC 3253Subversion partially implements DeltaV
What is WebDAV?
![Page 5: Subversion, WebDAV, and Apache HTTP Server 2 2003... · mod_dav_svn Example # Must be after mod_dav.so if it exists as a DSO LoadModule dav_svn_module modules/mod_dav_svn.so](https://reader035.fdocuments.in/reader035/viewer/2022070809/5f07dfdb7e708231d41f2fc0/html5/thumbnails/5.jpg)
mod_dav_svnmod_authz_svnAutoversioningra_svn basicssvnadmin basicsBindings and Hooks
Overview
![Page 6: Subversion, WebDAV, and Apache HTTP Server 2 2003... · mod_dav_svn Example # Must be after mod_dav.so if it exists as a DSO LoadModule dav_svn_module modules/mod_dav_svn.so](https://reader035.fdocuments.in/reader035/viewer/2022070809/5f07dfdb7e708231d41f2fc0/html5/thumbnails/6.jpg)
“Why do what others have done?”Portability used by using APRSubversion includes an httpd 2.x module
Built on top of mod_davCan browse repository over HTTP
Need WebDAV client to make changes Simply add mod_ssl to use SSL
Subversion + WebDAV
![Page 7: Subversion, WebDAV, and Apache HTTP Server 2 2003... · mod_dav_svn Example # Must be after mod_dav.so if it exists as a DSO LoadModule dav_svn_module modules/mod_dav_svn.so](https://reader035.fdocuments.in/reader035/viewer/2022070809/5f07dfdb7e708231d41f2fc0/html5/thumbnails/7.jpg)
Ways to talk to a repository in Subversionra_local - Local file-based
file://ra_svn - Custom protocol
svn:// or svn+ssh://ra_dav - WebDAV-based
http:// or https://
Subversion Remote Access
![Page 8: Subversion, WebDAV, and Apache HTTP Server 2 2003... · mod_dav_svn Example # Must be after mod_dav.so if it exists as a DSO LoadModule dav_svn_module modules/mod_dav_svn.so](https://reader035.fdocuments.in/reader035/viewer/2022070809/5f07dfdb7e708231d41f2fc0/html5/thumbnails/8.jpg)
Apache module for SubversionRequires httpd-2.0 (or greater)Uses mod_dav included with 2.0Use --with-apxs=/path/to/httpd/apxs when configuring SubversionClients require Neon to use ra_dav client
mod_dav_svn
![Page 9: Subversion, WebDAV, and Apache HTTP Server 2 2003... · mod_dav_svn Example # Must be after mod_dav.so if it exists as a DSO LoadModule dav_svn_module modules/mod_dav_svn.so](https://reader035.fdocuments.in/reader035/viewer/2022070809/5f07dfdb7e708231d41f2fc0/html5/thumbnails/9.jpg)
Uses a subset of WebDAV/DeltaVEach file is retrieved via GETProperties retrieved via PROPFINDTransactions done via MKACTIVITYFinally MERGE backSee notes/webdav-general-summary
mod_dav_svn/ra_dav Protocol
![Page 10: Subversion, WebDAV, and Apache HTTP Server 2 2003... · mod_dav_svn Example # Must be after mod_dav.so if it exists as a DSO LoadModule dav_svn_module modules/mod_dav_svn.so](https://reader035.fdocuments.in/reader035/viewer/2022070809/5f07dfdb7e708231d41f2fc0/html5/thumbnails/10.jpg)
mod_dav_svn Example
# Must be after mod_dav.so if it exists as a DSOLoadModule dav_svn_module modules/mod_dav_svn.so
<Location /svn/repos> DAV svn SVNPath /absolute/path/to/repository</Location>
If you want authentication and a group of repositories:<Location /svn/repos> DAV svn SVNParentPath /absolute/path/to AuthType Basic AuthName “Subversion repository” AuthUserFile /my/svn/user/passwd/file</Location>
![Page 11: Subversion, WebDAV, and Apache HTTP Server 2 2003... · mod_dav_svn Example # Must be after mod_dav.so if it exists as a DSO LoadModule dav_svn_module modules/mod_dav_svn.so](https://reader035.fdocuments.in/reader035/viewer/2022070809/5f07dfdb7e708231d41f2fc0/html5/thumbnails/11.jpg)
Path-based authorizationAllow user Joe to access /joe onlyAllow group committers write-accessInherit permissions from parent
File-based configurationOther RA layers will not use this now!
mod_authz_svn
![Page 12: Subversion, WebDAV, and Apache HTTP Server 2 2003... · mod_dav_svn Example # Must be after mod_dav.so if it exists as a DSO LoadModule dav_svn_module modules/mod_dav_svn.so](https://reader035.fdocuments.in/reader035/viewer/2022070809/5f07dfdb7e708231d41f2fc0/html5/thumbnails/12.jpg)
mod_authz_svn Syntax
[groups]<groupname> = <user>[,<user>...]...
[<path in repository>]@<group> = [rw|r]<user> = [rw|r]* = [rw|r]
* = Everyoner = GET, PROPFIND, REPORT, OPTIONSw = MKCOL, DELETE, PUT, PROPPATCH, CHECKOUT, MERGE, MKACTIVITY...COPY and MOVE require at least w on destination
![Page 13: Subversion, WebDAV, and Apache HTTP Server 2 2003... · mod_dav_svn Example # Must be after mod_dav.so if it exists as a DSO LoadModule dav_svn_module modules/mod_dav_svn.so](https://reader035.fdocuments.in/reader035/viewer/2022070809/5f07dfdb7e708231d41f2fc0/html5/thumbnails/13.jpg)
mod_authz_svn Example
Add to your Location block:AuthzSVNAccessFile /path/to/access/fileRequire valid-user
/path/to/access/file contains:[groups]branchonly=john,mary,alicewriters=bob,jones,scotty[/]*=r@writers=rw[/branches]@branchonly=rw
![Page 14: Subversion, WebDAV, and Apache HTTP Server 2 2003... · mod_dav_svn Example # Must be after mod_dav.so if it exists as a DSO LoadModule dav_svn_module modules/mod_dav_svn.so](https://reader035.fdocuments.in/reader035/viewer/2022070809/5f07dfdb7e708231d41f2fc0/html5/thumbnails/14.jpg)
Not all clients will be Subversion clientsAllows WebDAV-only clients to modify
No need for custom clients!Generic log message used on commits
Autoversioning
<Location /svn/repos> DAV svn SVNPath /absolute/path/to/repository SVNAutoversioning on</Location>
![Page 15: Subversion, WebDAV, and Apache HTTP Server 2 2003... · mod_dav_svn Example # Must be after mod_dav.so if it exists as a DSO LoadModule dav_svn_module modules/mod_dav_svn.so](https://reader035.fdocuments.in/reader035/viewer/2022070809/5f07dfdb7e708231d41f2fc0/html5/thumbnails/15.jpg)
See subversion/notes/autoversion-compatibility.txt
Autoversioning Example
Add to your Location block:SVNAutoversioning On
Tested Clients:Nautilus 2.xWindows WebFoldersMac OS X FinderLinux davfs2Macromedia DreamweaverDAVExplorer
![Page 16: Subversion, WebDAV, and Apache HTTP Server 2 2003... · mod_dav_svn Example # Must be after mod_dav.so if it exists as a DSO LoadModule dav_svn_module modules/mod_dav_svn.so](https://reader035.fdocuments.in/reader035/viewer/2022070809/5f07dfdb7e708231d41f2fc0/html5/thumbnails/16.jpg)
Some WebDAV clients are ‘class 2’MacOS X’s FinderRequire LOCK support from repository
Subversion does not have this directlyOnly httpd 2.1 includes mod_dav_lockUse DavGenericLockDB directive
mod_dav_lock
![Page 17: Subversion, WebDAV, and Apache HTTP Server 2 2003... · mod_dav_svn Example # Must be after mod_dav.so if it exists as a DSO LoadModule dav_svn_module modules/mod_dav_svn.so](https://reader035.fdocuments.in/reader035/viewer/2022070809/5f07dfdb7e708231d41f2fc0/html5/thumbnails/17.jpg)
Full configuration example
<Location /svn/repos> DAV svn SVNPath /absolute/path/to/repository SVNAutoversioning on DAVGenericLockDB logs/repos-locks AuthType Basic AuthName “Subversion repository” AuthUserFile /my/svn/user/dir/passwd
AuthzSVNAccessFile /my/svn/user/dir/access Require valid-user</Location>
![Page 18: Subversion, WebDAV, and Apache HTTP Server 2 2003... · mod_dav_svn Example # Must be after mod_dav.so if it exists as a DSO LoadModule dav_svn_module modules/mod_dav_svn.so](https://reader035.fdocuments.in/reader035/viewer/2022070809/5f07dfdb7e708231d41f2fc0/html5/thumbnails/18.jpg)
Not everyone trusts Apache!ra_svn was introducedAllows for tunneling
May require local accountssvnserve daemon
Anonymous/read-only access
ra_svn
![Page 19: Subversion, WebDAV, and Apache HTTP Server 2 2003... · mod_dav_svn Example # Must be after mod_dav.so if it exists as a DSO LoadModule dav_svn_module modules/mod_dav_svn.so](https://reader035.fdocuments.in/reader035/viewer/2022070809/5f07dfdb7e708231d41f2fc0/html5/thumbnails/19.jpg)
ra_svn Tunnels
% svn checkout svn+ssh://hostname/usr/local/svn/repository
Opens a remote connectionExecutes svnserve -t on the other endUses ‘svn+<tunnel>’
Configured in ~/.subversion/configDefault of svn+ssh exist
![Page 20: Subversion, WebDAV, and Apache HTTP Server 2 2003... · mod_dav_svn Example # Must be after mod_dav.so if it exists as a DSO LoadModule dav_svn_module modules/mod_dav_svn.so](https://reader035.fdocuments.in/reader035/viewer/2022070809/5f07dfdb7e708231d41f2fc0/html5/thumbnails/20.jpg)
Allows for management of repositoryRecoverBackup/RestoreArchive
Only works with local file accessNo remote administration yet
svnadmin
![Page 21: Subversion, WebDAV, and Apache HTTP Server 2 2003... · mod_dav_svn Example # Must be after mod_dav.so if it exists as a DSO LoadModule dav_svn_module modules/mod_dav_svn.so](https://reader035.fdocuments.in/reader035/viewer/2022070809/5f07dfdb7e708231d41f2fc0/html5/thumbnails/21.jpg)
Built on top of Berkeley DB 4.xAll data is stored in Berkeley DB tablesEnsures the integrity of the system (ACID)However, may require some maintaining
Subversion and Berkeley DB
![Page 22: Subversion, WebDAV, and Apache HTTP Server 2 2003... · mod_dav_svn Example # Must be after mod_dav.so if it exists as a DSO LoadModule dav_svn_module modules/mod_dav_svn.so](https://reader035.fdocuments.in/reader035/viewer/2022070809/5f07dfdb7e708231d41f2fc0/html5/thumbnails/22.jpg)
You may see, “Need to run recovery”Chances are it is not really corruptRun ‘svnadmin recover /path/to/repos’Ensure that there are no open processes
httpd, svnserve, etc.
Recovering ‘corrupted’ database
![Page 23: Subversion, WebDAV, and Apache HTTP Server 2 2003... · mod_dav_svn Example # Must be after mod_dav.so if it exists as a DSO LoadModule dav_svn_module modules/mod_dav_svn.so](https://reader035.fdocuments.in/reader035/viewer/2022070809/5f07dfdb7e708231d41f2fc0/html5/thumbnails/23.jpg)
Berkeley DB creates log filesAllows complete playbackCan grow very large
Usually, not all log files are neededAs of 0.25.0, ‘svnadmin archive’ cleans up‘db_archive | xargs rm’ also works
Berkeley DB log files
![Page 24: Subversion, WebDAV, and Apache HTTP Server 2 2003... · mod_dav_svn Example # Must be after mod_dav.so if it exists as a DSO LoadModule dav_svn_module modules/mod_dav_svn.so](https://reader035.fdocuments.in/reader035/viewer/2022070809/5f07dfdb7e708231d41f2fc0/html5/thumbnails/24.jpg)
Subversion has its own archive formatPlain text format with MIME-like headersBerkeley DB is not really portable
If switch endianness, need to recreateRequired on repository format updates
‘dump/load cycle’
Subversion dump format
![Page 25: Subversion, WebDAV, and Apache HTTP Server 2 2003... · mod_dav_svn Example # Must be after mod_dav.so if it exists as a DSO LoadModule dav_svn_module modules/mod_dav_svn.so](https://reader035.fdocuments.in/reader035/viewer/2022070809/5f07dfdb7e708231d41f2fc0/html5/thumbnails/25.jpg)
‘svnadmin dump /path/to/repos’Defaults to stdoutOptions
-rX:Y - specify ranges to dump--incremental
Loading into created repository
svnadmin dump
![Page 26: Subversion, WebDAV, and Apache HTTP Server 2 2003... · mod_dav_svn Example # Must be after mod_dav.so if it exists as a DSO LoadModule dav_svn_module modules/mod_dav_svn.so](https://reader035.fdocuments.in/reader035/viewer/2022070809/5f07dfdb7e708231d41f2fc0/html5/thumbnails/26.jpg)
‘svnadmin load /path/to/repos’Reads from stdinRepository must already be createdUUIDs
For future distributed repositoriesUse, ignore, or create on load
svnadmin load
![Page 27: Subversion, WebDAV, and Apache HTTP Server 2 2003... · mod_dav_svn Example # Must be after mod_dav.so if it exists as a DSO LoadModule dav_svn_module modules/mod_dav_svn.so](https://reader035.fdocuments.in/reader035/viewer/2022070809/5f07dfdb7e708231d41f2fc0/html5/thumbnails/27.jpg)
Ability to tweak a dump fileReads dump from stdinNew file on stdoutExclude or include paths in dumpRenumber ‘missing’ revisions
Poor man’s ‘svn obliterate’
svndumpfilter
![Page 28: Subversion, WebDAV, and Apache HTTP Server 2 2003... · mod_dav_svn Example # Must be after mod_dav.so if it exists as a DSO LoadModule dav_svn_module modules/mod_dav_svn.so](https://reader035.fdocuments.in/reader035/viewer/2022070809/5f07dfdb7e708231d41f2fc0/html5/thumbnails/28.jpg)
C and SWIG-centric bindingsSubversion has lots of little librariesUtilize SWIG to target multiple languages
Python is the main supported targetAutomatically in-sync with C API
mailer.py and ViewCVS use SWIG binding
Bindings
![Page 29: Subversion, WebDAV, and Apache HTTP Server 2 2003... · mod_dav_svn Example # Must be after mod_dav.so if it exists as a DSO LoadModule dav_svn_module modules/mod_dav_svn.so](https://reader035.fdocuments.in/reader035/viewer/2022070809/5f07dfdb7e708231d41f2fc0/html5/thumbnails/29.jpg)
Each repository has a hooks directoryScripts can be placed in thereCan be called at various points
Server-side onlycommit: pre-, start-, post- hooksrevprop changes: pre-, post-
Hooks
![Page 30: Subversion, WebDAV, and Apache HTTP Server 2 2003... · mod_dav_svn Example # Must be after mod_dav.so if it exists as a DSO LoadModule dav_svn_module modules/mod_dav_svn.so](https://reader035.fdocuments.in/reader035/viewer/2022070809/5f07dfdb7e708231d41f2fc0/html5/thumbnails/30.jpg)
Current development snapshot of ViewCVS supports SubversionAllows viewing of revisions other than the latest onemailer.py
Post-commit hook that sends diff emails
ViewCVS and mailer.py
![Page 31: Subversion, WebDAV, and Apache HTTP Server 2 2003... · mod_dav_svn Example # Must be after mod_dav.so if it exists as a DSO LoadModule dav_svn_module modules/mod_dav_svn.so](https://reader035.fdocuments.in/reader035/viewer/2022070809/5f07dfdb7e708231d41f2fc0/html5/thumbnails/31.jpg)
Subversion plays well with WebDAVPath-based authorization availableAutoversioning allows for non-Subversion clients to access the repositorysvnadmin is an essential tools for admins
Conclusion
![Page 32: Subversion, WebDAV, and Apache HTTP Server 2 2003... · mod_dav_svn Example # Must be after mod_dav.so if it exists as a DSO LoadModule dav_svn_module modules/mod_dav_svn.so](https://reader035.fdocuments.in/reader035/viewer/2022070809/5f07dfdb7e708231d41f2fc0/html5/thumbnails/32.jpg)
Upcoming O’Reilly BookSubversion: The Definitive GuideSee http://svnbook.red-bean.com/Included with Subversion source, tooReal-time help: irc.freenode.net #svnMailing list: [email protected]
The Final Word