build an autoversioning filesystem with apache2

49
Build a Versioning File System using WebDAV and Subversion [email protected] 20120103 http://slideshare.net/codehead BCN Sudoers

Upload: javier-arturo-rodriguez

Post on 12-May-2015

2.958 views

Category:

Technology


1 download

TRANSCRIPT

Page 1: Build an autoversioning filesystem with Apache2

Build a Versioning File Systemusing WebDAV and Subversion

[email protected] 20120103

http://slideshare.net/codehead

BCN Sudoers

Page 2: Build an autoversioning filesystem with Apache2

● RFC4918: HTTP Extensions for Web Distributed Authoring and Versioning (WebDAV)

● http://www.webdav.org/

WebDAV

Page 3: Build an autoversioning filesystem with Apache2

WebDAV Methods

● PROPFIND● PROPPATCH● MKCOL● COPY● MOVE● LOCK● UNLOCK

WEBDAV METHODS

Page 4: Build an autoversioning filesystem with Apache2

Windows

● May use HTTP or HTTPS as transport layer● Use existing infrastructure

● Binary transparent● Can be used as a remote filesystem

WHATS the BIG DEAL?'

Page 5: Build an autoversioning filesystem with Apache2

Web Browser

filesystem

HTTP Apa

che

http

d

Page 6: Build an autoversioning filesystem with Apache2

WebDAV Client

filesystem

HTTP

WebDAV

Apa

che

http

d

Page 7: Build an autoversioning filesystem with Apache2

Windows

● Mount as a filesystem

● FTP-like interface

WEBDAV CLIENTS

Page 8: Build an autoversioning filesystem with Apache2

Windows

● Native “Web Folders” (Mostly broken)

● Xythos Drive

● MS Office● Bit Kinex● CyberDuck● WebDrive $● GoodSync $

WINDOWS

Page 9: Build an autoversioning filesystem with Apache2

Mac

● Native Finder● MacFUSE

● iWork● CyberDuck

MAC

Page 10: Build an autoversioning filesystem with Apache2

Linux

● davfs2● fusedav

● KDE konqueror● KDE dolphin● Gnome Nautilus● cadaver

LINUX

Page 11: Build an autoversioning filesystem with Apache2

SubversionRecipe 1

WebDAV server using Apache2

Page 12: Build an autoversioning filesystem with Apache2

Dependencies

● Mandatory● apache2-mpm-prefork

● Optional● libapache2-mod-auth-*

Ingredients

Page 13: Build an autoversioning filesystem with Apache2

<VirtualHost _default_:443> ServerAdmin webmaster@localhost DocumentRoot /var/www <Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory /var/www/> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all </Directory>

ErrorLog ${APACHE_LOG_DIR}/error.log LogLevel warn CustomLog ${APACHE_LOG_DIR}/ssl_access.log combined

SSLEngine on SSLCertificateFile /etc/ssl/certs/webdav.pem SSLCertificateKeyFile /etc/ssl/private/webdav.key

BrowserMatch "MSIE [2-6]" \ nokeepalive ssl-unclean-shutdown \ downgrade-1.0 force-response-1.0 BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown</VirtualHost>

Hello, mod-ssl

Page 14: Build an autoversioning filesystem with Apache2

# a2enmod ssl dav_svn dav_fs# mkdir /var/lib/webdav# chown -R www-data.www-data /var/lib/webdav

Alias /webdav/ /var/lib/webdav/ <Location /webdav> DAV On AuthBasicProvider file AuthType Basic AuthUserFile htpasswd AuthName "WebDAV" require valid-user Options +Indexes DirectoryIndex </Location>

Enable webdav

Page 15: Build an autoversioning filesystem with Apache2

# a2enmod ssl dav_svn dav_fs# mkdir /var/lib/webdav# chown -R www-data.www-data /var/lib/webdav

Alias /webdav/ /var/lib/webdav/ <Location /webdav> DAV On AuthBasicProvider file AuthType Basic AuthUserFile htpasswd AuthName "WebDAV" require valid-user Options +Indexes DirectoryIndex </Location>

Enable webdav

Specify a real path

Page 16: Build an autoversioning filesystem with Apache2

# a2enmod ssl dav_svn dav_fs# mkdir /var/lib/webdav# chown -R www-data.www-data /var/lib/webdav

Alias /webdav/ /var/lib/webdav/ <Location /webdav> DAV On AuthBasicProvider file AuthType Basic AuthUserFile htpasswd AuthName "WebDAV" require valid-user Options +Indexes DirectoryIndex </Location>

Enable webdav

Turn DAV on

Page 17: Build an autoversioning filesystem with Apache2

# a2enmod ssl dav_svn dav_fs# mkdir /var/lib/webdav# chown -R www-data.www-data /var/lib/webdav

Alias /webdav/ /var/lib/webdav/ <Location /webdav> DAV On AuthBasicProvider file AuthType Basic AuthUserFile htpasswd AuthName "WebDAV" require valid-user Options +Indexes DirectoryIndex </Location>

Enable webdav

Season to taste

Page 18: Build an autoversioning filesystem with Apache2

TEST webdav

Page 19: Build an autoversioning filesystem with Apache2

Web Browser

filesystem

HTTP Apa

che

http

d

# curl --insecure --user testuser https://sandbox.ascii164.com/webdav/

TEST webdav

Page 20: Build an autoversioning filesystem with Apache2

WebDAV Client

filesystem

HTTP

WebDAV

Apa

che

http

d

# mkdir /mnt/dav# mount -t davfs https://sandbox.ascii164.com/webdav/ /mnt/dav# mount# ls /mnt/dav

TEST webdav

Page 21: Build an autoversioning filesystem with Apache2

Subversion

● Delta-V WebDAV Versioning Extension (RFC3253)

● CollabNet Apache Software Foundation→● http://subversion.apache.org/

subversion

Page 22: Build an autoversioning filesystem with Apache2

Subversion

svn server using Apache2

RECIPE 2

Page 23: Build an autoversioning filesystem with Apache2

Dependencies

● Mandatory● apache2-mpm-prefork● libapache2-svn● subversion

● Optional● libapache2-mod-dnssd● libapache2-mod-auth-*

Ingredients

Page 24: Build an autoversioning filesystem with Apache2

# mkdir /var/lib/svn# svnadmin create /var/lib/svn/repo# chown -R www-data.www-data /var/lib/svn

<Location /svn> DAV svn SVNParentPath /var/lib/svn AuthBasicProvider file AuthType Basic AuthUserFile htpasswd AuthName "Subversion" require valid-user Options +Indexes DirectoryIndex </Location>

Enable SUBVERSION

Page 25: Build an autoversioning filesystem with Apache2

# mkdir /var/lib/svn# svnadmin create /var/lib/svn/repo# chown -R www-data.www-data /var/lib/svn

<Location /svn> DAV svn SVNParentPath /var/lib/svn AuthBasicProvider file AuthType Basic AuthUserFile htpasswd AuthName "Subversion" require valid-user Options +Indexes DirectoryIndex </Location>

Enable SUBVERSION

Virtual Path

Page 26: Build an autoversioning filesystem with Apache2

# mkdir /var/lib/svn# svnadmin create /var/lib/svn/repo# chown -R www-data.www-data /var/lib/svn

<Location /svn> DAV svn SVNParentPath /var/lib/svn AuthBasicProvider file AuthType Basic AuthUserFile htpasswd AuthName "Subversion" require valid-user Options +Indexes DirectoryIndex </Location>

Enable SUBVERSION

svn DAV File System

Page 27: Build an autoversioning filesystem with Apache2

# mkdir /var/lib/svn# svnadmin create /var/lib/svn/repo# chown -R www-data.www-data /var/lib/svn

<Location /svn> DAV svn SVNParentPath /var/lib/svn AuthBasicProvider file AuthType Basic AuthUserFile htpasswd AuthName "Subversion" require valid-user Options +Indexes DirectoryIndex </Location>

Enable SUBVERSION

Repo Root(Use SVNPath

for a single repo)

Page 28: Build an autoversioning filesystem with Apache2

TEST SUBVERSION

Page 29: Build an autoversioning filesystem with Apache2

SVN Client

filesystem

libsvn

HTTP

WebDAV

Delta-V

Apa

che

http

d

# svn mkdir https://sandbox.ascii164.com/svn/repo/trunk/ \ https://sandbox.ascii164.com/svn/repo/tags/ \ https://sandbox.ascii164.com/svn/repo/branches/ # svn ls https://sandbox.ascii164.com/svn/repo/

TEST SUBVERSION

Page 30: Build an autoversioning filesystem with Apache2

Web Browser

filesystem

libsvn

HTTP

WebDAV

Delta-V

Apa

che

http

d

# curl --insecure --user testuser https://sandbox.ascii164.com/svn/repo/

TEST SUBVERSION

Page 31: Build an autoversioning filesystem with Apache2

versioning

backup

vs

Page 32: Build an autoversioning filesystem with Apache2

WHEN

should I create

a new version?

Page 33: Build an autoversioning filesystem with Apache2

SubversionRecipe 3

autoversioning filesystem

Page 34: Build an autoversioning filesystem with Apache2

# mkdir /var/lib/svn# svnadmin create /var/lib/svn/documents# chown -R www-data.www-data /var/lib/svn

<Location /documents> DAV svn SVNPath /var/lib/svn/documents SVNAutoVersioning on ModMimeUsePathInfo on AuthBasicProvider file AuthType Basic AuthUserFile htpasswd AuthName "Documents" require valid-user Options +Indexes DirectoryIndex </Location>

Enable autoversioning

Page 35: Build an autoversioning filesystem with Apache2

WebDAV Client

filesystem

libsvn

HTTP

WebDAV

Delta-V

Apa

che

http

d

TEST autoversioning

# mkdir /mnt/docs# mount -t davfs https://sandbox.ascii164.com/documents/ \ /mnt/docs# mount# ls /mnt/docs

Page 36: Build an autoversioning filesystem with Apache2

SVN Client

filesystem

libsvn

HTTP

WebDAV

Delta-V

Apa

che

http

d

# svn ls https://sandbox.ascii164.com/documents/

TEST autoversioning

Page 37: Build an autoversioning filesystem with Apache2

Further Resources

● http://svnbook.red-bean.com/

MORE RESOURCES

Page 38: Build an autoversioning filesystem with Apache2

ALL QUESTIONS W

ELCOME

Page 39: Build an autoversioning filesystem with Apache2

[email protected] @codehead

BCN Sudoers

Page 40: Build an autoversioning filesystem with Apache2

SVN Client

filesystem

libsvn

HTTP

WebDAV

Delta-V

Apa

che

http

d

Page 41: Build an autoversioning filesystem with Apache2

<Location /svn>

DAV svn

SVNParentPath /var/lib/svn

AuthBasicProvider ldap

AuthzLDAPAuthoritative off

AuthType Basic

AuthName "Document Repository"

AuthLDAPURL ldap://localhost/ou=Users,dc=company,dc=com?uid?sub?

require valid-user

</Location>

Page 42: Build an autoversioning filesystem with Apache2

Web Browser

WebDAV Client

SVN Client

filesystem

libsvn

HTTP

WebDAV

Delta-V

Apa

che

http

d

Page 43: Build an autoversioning filesystem with Apache2

svn ls https://sandbox.company.com/svn/repo/

Page 44: Build an autoversioning filesystem with Apache2

Web Browser

filesystem

libsvn

HTTP

WebDAV

Delta-V

ApacheWebDAV Client

SVN Client

Page 45: Build an autoversioning filesystem with Apache2

curl https://sandbox.company.com/svn/repo/

Page 46: Build an autoversioning filesystem with Apache2

Autoversioning

Page 47: Build an autoversioning filesystem with Apache2

Web Browser

filesystem

libsvn

HTTP

WebDAV

Delta-V

ApacheWebDAV Client

SVN Client

Page 48: Build an autoversioning filesystem with Apache2

<Location /documents>

DAV svn

SVNPath /var/lib/svn/docrepo

SVNAutoVersioning on

ModMimeUsePathInfo on

AuthBasicProvider ldap

AuthzLDAPAuthoritative off

AuthType Basic

AuthName "Document Repository"

AuthLDAPURL ldap://localhost/ou=Users,dc=company,dc=com?uid?sub?

require valid-user

</Location>

Page 49: Build an autoversioning filesystem with Apache2

Client Software