build an autoversioning filesystem with apache2

Post on 12-May-2015

2.959 Views

Category:

Technology

1 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Build a Versioning File Systemusing WebDAV and Subversion

javier@rodriguez.org.mx 20120103

http://slideshare.net/codehead

BCN Sudoers

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

● http://www.webdav.org/

WebDAV

WebDAV Methods

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

WEBDAV METHODS

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?'

Web Browser

filesystem

HTTP Apa

che

http

d

WebDAV Client

filesystem

HTTP

WebDAV

Apa

che

http

d

Windows

● Mount as a filesystem

● FTP-like interface

WEBDAV CLIENTS

Windows

● Native “Web Folders” (Mostly broken)

● Xythos Drive

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

WINDOWS

Mac

● Native Finder● MacFUSE

● iWork● CyberDuck

MAC

Linux

● davfs2● fusedav

● KDE konqueror● KDE dolphin● Gnome Nautilus● cadaver

LINUX

SubversionRecipe 1

WebDAV server using Apache2

Dependencies

● Mandatory● apache2-mpm-prefork

● Optional● libapache2-mod-auth-*

Ingredients

<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

# 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

# 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

# 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

# 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

TEST webdav

Web Browser

filesystem

HTTP Apa

che

http

d

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

TEST webdav

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

Subversion

● Delta-V WebDAV Versioning Extension (RFC3253)

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

subversion

Subversion

svn server using Apache2

RECIPE 2

Dependencies

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

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

Ingredients

# 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

# 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

# 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

# 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)

TEST SUBVERSION

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

Web Browser

filesystem

libsvn

HTTP

WebDAV

Delta-V

Apa

che

http

d

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

TEST SUBVERSION

versioning

backup

vs

WHEN

should I create

a new version?

SubversionRecipe 3

autoversioning filesystem

# 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

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

SVN Client

filesystem

libsvn

HTTP

WebDAV

Delta-V

Apa

che

http

d

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

TEST autoversioning

Further Resources

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

MORE RESOURCES

ALL QUESTIONS W

ELCOME

javier@rodriguez.org.mx @codehead

BCN Sudoers

SVN Client

filesystem

libsvn

HTTP

WebDAV

Delta-V

Apa

che

http

d

<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>

Web Browser

WebDAV Client

SVN Client

filesystem

libsvn

HTTP

WebDAV

Delta-V

Apa

che

http

d

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

Web Browser

filesystem

libsvn

HTTP

WebDAV

Delta-V

ApacheWebDAV Client

SVN Client

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

Autoversioning

Web Browser

filesystem

libsvn

HTTP

WebDAV

Delta-V

ApacheWebDAV Client

SVN Client

<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>

Client Software

top related