subversion, webdav, and apache http server 2 2003... · mod_dav_svn example # must be after...

32
Justin R. Erenkrantz University of California, Irvine [email protected] Slides: http://www.erenkrantz.com/oscon/ Subversion, WebDAV, and Apache HTTP Server 2.0

Upload: others

Post on 17-Jun-2020

9 views

Category:

Documents


0 download

TRANSCRIPT

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

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

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

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

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

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

“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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

‘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

‘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

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

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

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

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

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

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