librelist archives

« back to archive

This is a little like shouting into a dark basement, isn't it?

This is a little like shouting into a dark basement, isn't it?

From:
Matt Dawson
Date:
2010-02-27 @ 04:00
Hey list!

Not knowing who's on this list sure does make for a unique vibe. Hope
everyone's well.

If I *don't* know you, my name's Matt. I'm a web developer at Category
4 doing a lot of front end and CMS integration during the working
hours and a lot of random and assorted hacking in the evenings.
Fortunately, I'm finding more and more opportunities to pull the
programming bits of that into my workaday.

The past couple days I've been exploring CouchDB via O'Reilly's
somewhat uneven guide (http://books.couchdb.org/relax/). In
particular, I'm looking to use python-couchdb and web.py to build some
toys. If anyone's used python-couchdb, I'd be interested to hear your
thoughts. Right now, I'm trying to suss out whether I'm gaining
anything by using Python (a language I'm increasingly comfortable
with) as opposed to Javascript (where I always feel like I'm on loose
footing). The design docs and views so far look fairly easy to grok -
but I'm not doing anything crazy yet.

Anyone have a personal opinion?

Hope to see some of you at beSwarm tomorrow!

Best,
Matt

Re: [cville] This is a little like shouting into a dark basement, isn't it?

From:
Ron DuPlain
Date:
2010-02-27 @ 11:46
Hi Matt,

I'm very interested in CouchDB.  I haven't done any big project or
production work in CouchDB yet... mostly just reading and poking
around with futon and couchapp.  I would be interested in some CouchDB
hacknights.

See you at beSwarm,

Ron


On Fri, Feb 26, 2010 at 11:00 PM, Matt Dawson <matthewtdawson@gmail.com> wrote:
> Hey list!
>
> Not knowing who's on this list sure does make for a unique vibe. Hope
> everyone's well.
>
> If I *don't* know you, my name's Matt. I'm a web developer at Category
> 4 doing a lot of front end and CMS integration during the working
> hours and a lot of random and assorted hacking in the evenings.
> Fortunately, I'm finding more and more opportunities to pull the
> programming bits of that into my workaday.
>
> The past couple days I've been exploring CouchDB via O'Reilly's
> somewhat uneven guide (http://books.couchdb.org/relax/). In
> particular, I'm looking to use python-couchdb and web.py to build some
> toys. If anyone's used python-couchdb, I'd be interested to hear your
> thoughts. Right now, I'm trying to suss out whether I'm gaining
> anything by using Python (a language I'm increasingly comfortable
> with) as opposed to Javascript (where I always feel like I'm on loose
> footing). The design docs and views so far look fairly easy to grok -
> but I'm not doing anything crazy yet.
>
> Anyone have a personal opinion?
>
> Hope to see some of you at beSwarm tomorrow!
>
> Best,
> Matt
>

Re: [cville] This is a little like shouting into a dark basement, isn't it?

From:
Matt Dawson
Date:
2010-03-02 @ 05:34
Just in case anyone's interested, I thought I'd post some of my fun
experiments with CouchDB since my first email. Since I'm most
interested in CouchDB's replication abilities, that's what I've been
focusing on. I've only barely touched on views and view servers or
actually working with the data.

If you don't know much about CouchDB, O'Reilly's started the official
book. It's rife with typos and very unclear at points, but it's better
than nothing: http://books.couchdb.org/relax/

What I first wanted to see was how easy it would be to set up a public
database (in my case, a VM at Rackspace) that syncs automatically with
an arbitrary number of local machines. The answer: really friggin'
easy.

I'm using the couchdb-python library
(http://code.google.com/p/couchdb-python/) to interact with servers
and databases. I have one couchdb server running on my desktop, one on
a cloud server at Rackspace, and one on my laptop. Here's the code I
ran from a terminal on my desktop to create databases and start up
replication between the desktop and the cloud server:

>>> import couchdb
>>> import uuid
>>> s = couchdb.Server() # Server() defaults to localhost, so this is my desktop
>>> s2 = couchdb.Server('http://cloudserver.dev:5984')
>>> db = s.create('addressbook') # create a db on the local server
>>> db[uuid.uuid4().hex] = {'first_name': 'Matt', 'last_name': 'Dawson'} #
create the first document on the local server
>>> s2.create('addressbook-public') # create a db on the remote server
>>> s.replicate('addressbook', 
'http://cloudserver.dev:5984/addressbook-public', continuous=True)
>>> s.replicate('http://cloudserver.dev:5984/addressbook-public', 
'addressbook', continuous=True)

By default in CouchDB, replicate() is a one-off action. It just says
"move data from this database to that one". Adding the "continuous"
flag means that a save on the local server automatically triggers an
update to the remote server. We run two replicate calls with the
target and source switched to make the updates bi-directional. That
is, I can now make an update on either the cloud server on on the
local machine, and
either way, both machines get updated.

Now I open a terminal on my laptop, create a database, and do another
bi-directional sync to the cloud server:

>>> import couchdb
>>> s = couchdb.Server()
>>> db = s.create('addressbook')
>>> s.replicate('addressbook', 
'http://cloudserver.dev:5984/addressbook-public', continuous=True)
>>> s.replicate('http://cloudserver.dev:5984/addressbook-public', 
'addressbook', continuous=True)

The absolute coolest part about this is that if I make an update to
the database on my desktop, it automatically propagates to my laptop.
Even *cooler* is that the update happens even if my laptop's been
asleep. As soon as my laptop wakes and I go to check that local
version of the db, CouchDB automatically phones home before showing me
the results.

It's worth noting that CouchDB is written on a RESTful API, so this
whole process could have been done with curl. But I like Python much
better.

Very, very cool stuff.

Matt

On Sat, Feb 27, 2010 at 6:46 AM, Ron DuPlain <ron.duplain@gmail.com> wrote:
> Hi Matt,
>
> I'm very interested in CouchDB.  I haven't done any big project or
> production work in CouchDB yet... mostly just reading and poking
> around with futon and couchapp.  I would be interested in some CouchDB
> hacknights.
>
> See you at beSwarm,
>
> Ron
>
>
> On Fri, Feb 26, 2010 at 11:00 PM, Matt Dawson <matthewtdawson@gmail.com> wrote:
>> Hey list!
>>
>> Not knowing who's on this list sure does make for a unique vibe. Hope
>> everyone's well.
>>
>> If I *don't* know you, my name's Matt. I'm a web developer at Category
>> 4 doing a lot of front end and CMS integration during the working
>> hours and a lot of random and assorted hacking in the evenings.
>> Fortunately, I'm finding more and more opportunities to pull the
>> programming bits of that into my workaday.
>>
>> The past couple days I've been exploring CouchDB via O'Reilly's
>> somewhat uneven guide (http://books.couchdb.org/relax/). In
>> particular, I'm looking to use python-couchdb and web.py to build some
>> toys. If anyone's used python-couchdb, I'd be interested to hear your
>> thoughts. Right now, I'm trying to suss out whether I'm gaining
>> anything by using Python (a language I'm increasingly comfortable
>> with) as opposed to Javascript (where I always feel like I'm on loose
>> footing). The design docs and views so far look fairly easy to grok -
>> but I'm not doing anything crazy yet.
>>
>> Anyone have a personal opinion?
>>
>> Hope to see some of you at beSwarm tomorrow!
>>
>> Best,
>> Matt
>>
>

Re: [cville] This is a little like shouting into a dark basement, isn't it?

From:
Ron DuPlain
Date:
2010-03-02 @ 14:29
Responses in-line below.  Note I have this habit of pruning message
threads.  Sorry if that bugs you.

On Tue, Mar 2, 2010 at 12:34 AM, Matt Dawson <matthewtdawson@gmail.com> wrote:
> Since I'm most
> interested in CouchDB's replication abilities, that's what I've been
> focusing on. I've only barely touched on views and view servers or
> actually working with the data.
>

Beyond the "relax" philosophy of CouchDB (which is awesome), I'm
primarily interested in CouchDB for it's replication features (+1) and
seamless offline support.  I haven't done any production work in
CouchDB yet, but I am always looking for a good excuse to do so.


> If you don't know much about CouchDB, O'Reilly's started the official
> book. It's rife with typos and very unclear at points, but it's better
> than nothing: http://books.couchdb.org/relax/
>

I think the published book is a pretty big delta from the online book.
 It's certainly more polished.

http://oreilly.com/catalog/9780596155902

Safari Books Online users can read it without buying it, and if you
have access to UVA's network, you can read it for free:

http://proquest.safaribooksonline.com/9780596158156


> What I first wanted to see was how easy it would be to set up a public
> database (in my case, a VM at Rackspace) that syncs automatically with
> an arbitrary number of local machines. The answer: really friggin'
> easy.
>
> I'm using the couchdb-python library
> (http://code.google.com/p/couchdb-python/) to interact with servers
> and databases.

For those new to CouchDB, you are likely to find a good library in
your favorite language.  I'd recommend starting to interact using curl
(http://curl.haxx.se/) and the built-in admin interface, Futon.


> By default in CouchDB, replicate() is a one-off action. It just says
> "move data from this database to that one". Adding the "continuous"
> flag means that a save on the local server automatically triggers an
> update to the remote server. We run two replicate calls with the
> target and source switched to make the updates bi-directional. That
> is, I can now make an update on either the cloud server on on the
> local machine, and
> either way, both machines get updated.
>

When was continuous replication added? 0.10.0?


> The absolute coolest part about this is that if I make an update to
> the database on my desktop, it automatically propagates to my laptop.
> Even *cooler* is that the update happens even if my laptop's been
> asleep. As soon as my laptop wakes and I go to check that local
> version of the db, CouchDB automatically phones home before showing me
> the results.
>

I installed CouchDB on my Android G1 for exactly this reason.  Might
be fun.  Haven't done anything with it yet.

> It's worth noting that CouchDB is written on a RESTful API, so this
> whole process could have been done with curl. But I like Python much
> better.
>

+1 - REST db is awesome

> Very, very cool stuff.
>
> Matt
>

Thanks for sharing.  When do you want to get together to hit up
CouchDB?  I'll gladly sponsor some OpenSpace time if you want to have
a hack night.

-Ron

Re: [cville] This is a little like shouting into a dark basement, isn't it?

From:
Matt Dawson
Date:
2010-03-03 @ 05:01
> When was continuous replication added? 0.10.0?

I couldn't find any notes in the changelog about when that happened -
granted I didn't look that hard - but I do think it was recent. Here's
the big caveat I left out: continuous replicate commands don't live on
after server restart. The team apparently says that's a high priority
feature, but for now, you have to use your own tool to reconnect
databases on server restart.

> Thanks for sharing.  When do you want to get together to hit up
> CouchDB?  I'll gladly sponsor some OpenSpace time if you want to have
> a hack night.

I'd be down for some evening next week. Maybe Wednesday the 10th?
Really, it could be any day though. Anyone else interested?

Matt

Re: [cville] This is a little like shouting into a dark basement, isn't it?

From:
Ron DuPlain
Date:
2010-03-03 @ 13:24
On Wed, Mar 3, 2010 at 12:01 AM, Matt Dawson <matthewtdawson@gmail.com> wrote:
>> When was continuous replication added? 0.10.0?
>
> I couldn't find any notes in the changelog about when that happened -
> granted I didn't look that hard - but I do think it was recent. Here's
> the big caveat I left out: continuous replicate commands don't live on
> after server restart. The team apparently says that's a high priority
> feature, but for now, you have to use your own tool to reconnect
> databases on server restart.
>

Ah, that's why I didn't think continuous replication was added.  Have
you found it a pain to reconnect databases after server restart?


>> Thanks for sharing.  When do you want to get together to hit up
>> CouchDB?  I'll gladly sponsor some OpenSpace time if you want to have
>> a hack night.
>
> I'd be down for some evening next week. Maybe Wednesday the 10th?
> Really, it could be any day though. Anyone else interested?
>

Wednesday night works for me.  If you want to dine & hack, my house is open.

-Ron

Re: [cville] This is a little like shouting into a dark basement, isn't it?

From:
Matt Dawson
Date:
2010-03-08 @ 20:47
> Ah, that's why I didn't think continuous replication was added.  Have
> you found it a pain to reconnect databases after server restart?

As I've only sandboxed this stuff so far, I haven't had to deal with
it. I can tell you it already annoys me. I'm hoping the CouchDB guys
work this in soon.

Re: [cville] This is a little like shouting into a dark basement, isn't it?

From:
Ron DuPlain
Date:
2010-03-08 @ 20:54
On Mon, Mar 8, 2010 at 3:47 PM, Matt Dawson <matthewtdawson@gmail.com> wrote:
>> Ah, that's why I didn't think continuous replication was added.  Have
>> you found it a pain to reconnect databases after server restart?
>
> As I've only sandboxed this stuff so far, I haven't had to deal with
> it. I can tell you it already annoys me. I'm hoping the CouchDB guys
> work this in soon.
>

The book ("Relax") suggested it's on the way.  Would be a nice
feature, and the workaround isn't that bad.  Just use @reboot cron.

-Ron