Fork me on GitHub

couch-fuse

What

Couchfuse is a FUSE filesystem that exposes Couchdb databases as filesystem folder.

Why

Couchdb exposes an easy to use HTTP API however for some tasks using a filesystem UI is preferable, easy backup using rsync or text editing using your favorite text editor.

Usage

We start by mouting a db:

$ couchfuse -db db_name -path mount_path

Creating a new document is mkdir away:

$ mkdir mount_path/foo

Each document is represented by two folders, a content folder which contains attachments and a meta folder that hold the document json:

$ find mount_path/
    mount_path/.foo/foo.json
    mount_path/foo

In order to delete a document both content and meta folder should be cleared, starting with content folder first:

$ rm -r mount_path/.foo
  rm: cannot remove directory 'fake/.foo': Operation not permitted
# this will work
$ rm -r mount_path/foo && rm -r mount_path/.foo

Demo

Options

Options
  --run-valid   runs validation only                                            
  --host <arg>  Couchdb host name               [default http://127.0.0.1:5984/]
  --db <arg>    Couchdb db name                                                 
  --path <arg>  Mount path on local filesystem  
  --help        print options

Installing

$ wget http://github.com/downloads/narkisr/couch-fuse/couch-fuse_0.4.1-1_amd64.deb
$ sudo dpkg -i couch-fuse_0.4.1-1_amd64.deb
# if java and fuse-utils are not installed already (make sure to enable partner repo for java)
$ sudo apt-get -f install

Deb packages are available:

10.10-32bit 10.10-64bit

Building

On ubuntu 10.10 64 and 32 bit

$ sudo aptitude install dh-make libfuse-dev sun-java6-jdk maven2 ruby rake couchdb curl
$ git clone git://github.com/narkisr/fuse4j.git
$ cd fuse4j/maven
$ mvn clean install 
$ cd ..
$ git clone git://github.com/narkisr/couch-fuse.git
$ cd couch-fuse
$ rake deb

License

This code is free to use under the terms of the Apache License, Version 2.0.