home contents changes options help subscribe edit (external edit)

Some tips on making your ZODB appear as a local filesystem.

(17:57:03) dc0e: hey all, i've been away from zope for a while but am happily working again on some zope projects.  is it possible yet to mount the ZODB as a virtual filesystem so tools like grep, diff, etc. can be used?
(17:57:31) sm: hey dc0e, welcome back
(17:57:38) sm: I've just been working on that
(17:57:44) sm: on linux
(17:57:48) dc0e: good
(17:57:56) dc0e: got code?
(17:58:39) dc0e: read-only would be fine for what i need
(17:58:39) dc0e: (i.e. mount it read-only)
(17:58:43) sm: I mean I've been researching the current solutions.. unfortunately it's not looking good
(17:58:49) sm: ah, but read-only is easier
(17:59:17) sm: you can get read-only access via ftp with fuseftp, lufs, or lufis
(17:59:35) sm: lufs is probably the least buggy
(17:59:37) dc0e: ahh, good point
(17:59:44) dc0e: i knew that ;)
(17:59:49) sm: I see occasional hangs with all of them, not sure why
(18:00:07) sm: and via webdav there's davfs2 and wdfs which I haven't tried yet

Using FTP

FUSE and LUFS are probably not part of your linux kernel, on debian/ubuntu you can add them by installing the respective packages, the kernel headers and module-assistant and building the kernel modules. Something like:

module-assistant prepare
module-assistant build lufs
module-assistant install lufs
modprobe lufs

Once installed, here are the command lines that worked best for me; run as root:

#fuse+fuseftp
~/bin/fuseftp --passive --allow_other --cache=memory /mnt/host8021fuseftp user:pass@host#8021:/ &

#lufs+ftpfs
lufsmount ftpfs://user:pass@host:8021/ /mnt/host8021lufs -u 1000 -g 1000 -O -d 700 -f 700

#fuse+lufis+lufs+ftpfs
LD_LIBRARY_PATH=/usr/lib/lufs /usr/local/src/lufis-0.3/lufis  fs=ftpfs,host=host,port=8021,username=user,password=pass -o allow_other /mnt/host8021lufis -s

#to unmount
fusermount -u /mnt/host8021fuseftp
lufsumount    /mnt/host8021lufs
lufsumount    /mnt/host8021lufis

The fuseftp perl script had to be modified to take whatever's after # as the port. On windows & mac there may be other solutions.

Using Zope and WebDAV

Linux with GNOME

System -> Connect to server, select Zope and WebDAV, type the hostname, port number, username. Double-click on the new icon that appears on your desktop. Browse and edit to your heart's content.

Caveat: only GNOME applications are able to access the files this way, so you won't be able to open a terminal and find/grep/sed.

Linux with KDE

Seems to be built in, see http://docs.kde.org/stable/en/kdebase/kioslave/webdav.html and webdavs (webdav over https, next page from that one).

Linux command-line

Install davfs2 (on Debian/Ubuntu sudo apt-get install davfs2). Now you can mount the Zope server as any other filesystem, e.g. assuming your Zope and WebDAV port is 1980, do

sudo mount -t davfs http://localhost:1980/ /mnt/mnt

Caveat: davfs2 uses object titles for filenames. If you have two objects with the same title, only one will be visible on the filesystem. To fix this, edit /etc/davfs2/davfs2.conf and add

use_displayname 0

before you mount.

Warning: I was unable to edit any files on the mount point. My latest attempt resulted in the file I was trying to edit being deleted from Zope. Thanfully I was able to undo it from the ZMI.

I've tried fusedav as an alternative that doesn't require root access, but it failed to work with Zope -- apparently fusedav requires the server to support ranged GET, which Zope doesn't.

-- Marius Gedminas

Mac OS X

Also working fine is the built in Zope and WebDAV client of the Mac OS X Finder. To keep on with the previous example in the Finder's menu you choose "Go" -> "Connect to Server....", then enter http://localhost:1980 for the "Server Address". If you have Zope go through apache to serve https, you can even use Zope and WebDAV over https for extra security.



subject:
  ( 23 subscribers )