You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@couchdb.apache.org by "Bob Dionne (Commented) (JIRA)" <ji...@apache.org> on 2011/12/31 17:24:30 UTC

[jira] [Commented] (COUCHDB-1373) Time-order​ed document ids including the database identity

    [ https://issues.apache.org/jira/browse/COUCHDB-1373?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13178038#comment-13178038 ] 

Bob Dionne commented on COUCHDB-1373:
-------------------------------------

Nick,

  This seems reasonable, I'm sure there might be some issues to consider but if it's done the way the others were I don't see why not. I've run into this sort of thing before in systems where you want unique ids with a certain provenance so you assign each player an additional unique id that becomes part of the generated keys. 
  couch_uuids is a gen_server whose state is determined by an algorithm defined in the config file. I see no problem with adding another. If you could submit a patch it would be easier to assess or better yet a link to a source repo. 
   
Best,

Bob
                
> Time-order​ed document ids including the database identity
> ----------------------------------------------------------
>
>                 Key: COUCHDB-1373
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-1373
>             Project: CouchDB
>          Issue Type: Improvement
>          Components: Database Core
>            Reporter: Nick North
>            Priority: Minor
>              Labels: uuid
>
> This suggestion is for an enhancement to the document id generation algorithms in CouchDb. I am new to CouchDb, and this question addresses an old issue (https://issues.apache.org/jira/browse/COUCHDB-465) so please forgive me if I am retreading old ground.
> My application has a number of mutually replicating CouchDb instances and I would like document ids to be monotonically-increasing per-instance, and globally unique, and for the instance where the document was created to be determinable from the id. (To be more accurate - I don't need to know anything about the instance itself; just whether any two documents originated from the same instance.) The utc_random algorithm is not far from meeting these requirements, as ids are monotonic and almost certainly globally unique. However, the instance cannot be determined from the id, and there is a tiny chance of an id clash between two instances. Both of these issues could be solved if the random part of the id could be replaced with a suffix that is fixed in the ini file for each instance.
> To address this I have a modified version of couch_uuids.erl introducing a new utc_machine_id algorithm which reads a machine_id string from the ini file and then generates ids using an internal utc_suffix method that just appends the string to the usual utc 14-byte string. utc_random then also uses the utc_suffix method, but its suffix is the usual random byte string.
> However, it is obviously a nuisance to have to maintain a non-standard distribution, so I wondered if there is enough call for this sort of thing to make it a part of the standard distribution? If there is, I'd be very happy to make my code available for discussion/modification/inclusion. If there are good reasons why this is a bad idea, then I'd also be very interested to hear them so that I can rethink my ideas. (It happens that the privacy and guessability concerns raised in the original discussion do not apply in my case.) If this question has been beaten to death, then I'm sorry for bothering the group, and would be grateful if someone could point me to the discussions so that I can understand the issues.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

Re: CouchDB Module System

Posted by Bob Dionne <bo...@cloudant.com>.
Extensions

On Jan 23, 2012, at 4:33 AM, Paul Davis wrote:

> On Mon, Jan 23, 2012 at 3:03 AM, Randall Leeds <ra...@gmail.com> wrote:
>> On Sat, Dec 31, 2011 at 10:34, Jan Johannes <ja...@ntr.io> wrote:
>>> Dear favorite Document-database developer community :-)
>>> This is my first message to the mailing list, so please forgive me and
>>> gently correct me if i am breaking any communication standards whatsoeverŠ
>> 
>> Nope! You're just bringing up a deep topic with a lot of text.
>> I hope you didn't expect a speedy response! :)
>> 
>>> 
>>> I am currently working on a WebDAV interface for CouchDB, that now gets
>>> closer to its release date, somewhere in February or March and as i
>>> approach that, I want to package everything in a proper CouchDB Module
>>> format but the CouchDB Module system is, as i understood, in early
>>> development or pre-development phase and needs a bit of work.
>>> 
>>> So as i work on a CouchDB Module anyways i would like to contribute to the
>>> Module system or start kicking the work on that of.
>>> 
>>> Hence the following questions:
>>> 
>>> Who started working on such a system or would be interested in talking
>>> about the design decisions that need to be done before actual coding can
>>> start?
>>> (I know at least Jan Lehnardt expressed interest, but i can't quite
>>> remember if he started actual work or just had plans for that.)
>> 
>> Benoit is particularly interested and there is activity on the refuge
>> project mailing list about it from Nicolas Dufour.
>> I believe Jason Smith might be pretty interested since he's authored
>> some "plugins" already.
>> Others on the list are certainly interested.
>> I'm keen to get a good module system and it's why I was in favor of
>> the effort to get "couch-config" shipped as part of the install.
>> 
>>> 
>>> If there is any documentation on planning such a system, could someone
>>> please point me to the recourses?
>> 
>> There's an umbrella ticket I made for modularizing the code base more:
>> https://issues.apache.org/jira/browse/COUCHDB-1251
>> 
>> And these:
>> 
>> Utility to help plugin developers manage paths
>> https://issues.apache.org/jira/browse/COUCHDB-1012
>> 
>> support load of external erlang modules in couchdb.
>> https://issues.apache.org/jira/browse/COUCHDB-1046
>> 
>>> 
>>> Lastly here is my two cents on a few topics that need to be addressed:
>>> 
>>> - We should build the best module system there is for a database or
>>> content management system to gain back a bit of the traction we lost
>>> during the recent plateau phase of couchdb enthusiasm
>> 
>> I find it hard to judge enthusiasm from the inside, but, yeah... a
>> proper module system would rock.
>> One of the things CouchDB struggles with in terms of image, but excels
>> at in terms of function is scaling up and down. The only way to really
>> make one project move from mobile phone to datacenter cluster is to
>> modularize the build and deployment of key components. I think
>> everyone agrees about this. CouchDB is the Gentoo of document
>> databases in this way.
>> 
>>> 
>>> - I think "module" is the preferable term, as extension, plugin or the
>>> like sound like second class citizens, whereas module implies, that even a
>>> core component of the system can be made into such an instance (Any other
>>> suggestions?)
>> 
>> Module is a little bit confusing because it conflicts with Erlang's
>> definition. While the two would often be synonymous for many add-ons,
>> it's not necessarily the case.
>> I would go with calling them "applications" maybe. I've often thought
>> that each such thing could correspond well to a single Erlang
>> application and .app file, which Erlang has significant support and
>> prior art for loading and unloading on the fly. But really, I don't
>> care what color we paint this and long as it's neon awesome.
>> 
>>> 
>>> - A CouchDB module should be packaged as a stand alone couchdb-document,
>>> with the yet to be specified manifest beeing the json structure of the
>>> document and the files beeing the attachment.
>> 
>> I'm pretty sure I disagree here. I think this conflates two issues.
>> The first, to me, is a good hooks system from which more interactions
>> in the core could be scripted with sandboxed user code. Once again, I
>> know I've talked to Benoit about this. The second, though, is the more
>> first-class type of application that requires compiled Erlang
>> bytecode. While these have some degree of portability[1] I
>> instinctively cringe, from a security standpoint, at the idea of hot
>> loading code from a document into the VM. While the document-module
>> idea I find attractive from a share-ability and install-ability
>> standpoint, I don't think it befits the general purpose module system.
>> Although, a good hooks system may make certain kinds of modules work
>> this way.
>> 
>> [1] http://stackoverflow.com/questions/2255658/how-portable-are-erlang-beam-files
>> 
>>> 
>>> - Discovery, Installation, Enabling, Disabling, Module-Specific
>>> Configuration and Distribution should be part of Futon and introduce as
>>> little new interface concepts as possible, also the futon interface
>>> section "configuration" may be needed to be integrated and streamlined
>>> quite nicely
>> 
>> Again, this works the dynamic-language, hooks-based module, but I'm
>> not sure it works for all modules. Kanso [2] is doing this to a large
>> extent already, under the CouchApp frame, but I see no reason why a
>> hooks system couldn't accommodate a new, more powerful kind of Kanso
>> package.
>> 
>> [2] http://kan.so/
>> 
>>> 
>>> - Even if a module is not possible to completely install via this method
>>> (e.g. It depends on a os component, that is too low level etc.) such
>>> modules should be as tightly integrated into the system as possible and
>>> the manual admin installation steps should be documented in a way, so that
>>> in a normal case no place but the module system needs to be accessed
>> 
>> Agree.
>> 
>>> 
>>> - on the top level the system should be the same for all OSes
>>> 
>>> - The work packages i see at the moment for the structure i have in mind
>>> would be:
>>> 
>>>        - Module repository: A CouchDB Instance, that hosts a collection of
>>> CouchDB Modules
>> 
>> See Kanso, above.
>> 
>>>        - Futon User Interface to browse available Modules in the configured
>>> repositories, should be close to the Firefox plugin paradigms
>> 
>> That would be neat. Or a separate 'shopping' utility for CouchApps.
>> Sounds a bit like a combination between JChris' CouchApp Garden [3]
>> and Max Ogden's Chrome Couch application [4]. Crossing these would
>> Kanso would be really neat.
>> 
>> [3] https://github.com/jchris/garden
>> [4] https://github.com/maxogden/chromecouch
>> 
>>>        - Module Manifest: Descriptive CouchDoc, that references the attached
>>> files or git repository, how files need to be fetched, packaged and what
>>> goes where, also version                dependencies, description, rating, Module
>>> Category, needed system privileges (basically if you need to be a couch
>>> admin or if you need to be root on the os), needed              configuration, and
>>> basic description of the configuration parameters
>> 
>> I'd really prefer to punt on low-level privileges and just call this
>> two separate things. The way to unify them, in my mind, is to create a
>> hooks system and then to make a native module that listens for all
>> hooks and delegates processing to design documents that indicate they
>> handle certain hooks. In other words, build the un-privileged module
>> system on top of the privileged one. Let administrators worry about
>> file systems when installing the privileged ones. It's really not so
>> bad. Sysadmins have been installing things for years, and actually
>> probably prefer to install stuff on the command line than with a POST
>> to /_replicate. The couch-config utility is there to facilitate this.
>> What we probably need is an extra location for user-installed add-on
>> applications that need to be added to the Erlang library path and used
>> for loading configured applications.
>> 
>>>        - Futon User Interface to the installed modules, with options to enable,
>>> disable, uninstall, rate and configure
>> 
>> Yes again. I like the gist, but I don't know if it should be bound up
>> in Futon or not.
>> 
>>>        - The tools for installation/uninstallation and enabling/disabling as
>>> well as packaging and dependency resolution
>> 
>> That sounds like figuring out a good way to structure the
>> configuration sections for modules. See the JIRA tickets I referenced
>> for some discussion of that.
>> 
>>> 
>>>        Open questions: What existing projects could be made use of, maybe there
>>> is something great for the general erlang world, maybe there is a project
>>> like zero install, that         could be made use of, maybe that is not
>>> necessary, what are your thoughts?
>> 
>> I would also check out Agner: http://erlagner.org/
>> 
>> Basically, if we could get to the point where CouchDB administrators
>> could use Agner to install new pieces I'd consider that a huge win.
>> If, in the process, we get a modularized core and support for a
>> design-document-level hooks system I'd consider that an epic win. I
>> never say epic win. I would say it three times out loud.
>> 
>>> 
>>> I wish you all a happy new year!
>>> 
>>> 
>> 
>> Thanks :)
>> -Randall
> 
> +1 to pretty much everything Randall said.
> 
> Minor caveat: application is about as overloaded in Erlang as module
> (and process for that matter) when considering prior expectations of
> non-Erlangians. There should be a word for these things. Plug-ins has
> always been my word for them, but the second-class-ness that invokes
> is understandable. Perhaps there's a perfect word, but perhaps
> "component" is good enough?
> 
> My other reaction is that installing "whatevers/components/widgets"
> should *not* be a web thing. I understand the desire to make this user
> friendly and the such, but as Randall points out, putting random
> (fairly difficult to sandbox) code into a server/service environment
> seems quite ungood. This basically hearkens back to the
> disabled-by-default native view server. While its definitely
> "possible" to provide some sort of sandboxed thing for Erlang
> extensions, its a "plug all the leaks with fingers" type of possible.
> If we're interested in allowing code execution on the server it should
> be "here's you're iron box with carefully crafted ports of interaction
> to the world" type of sandboxing. Ie, AppEngine vs erm, not-AppEngine.
> 
> Other than that, yes. Erlang makes extensions super awesomely easy and
> we should be embracing that more loudly. Both with community resources
> for discovery as well as the technical adjustments to ease their
> usage.


Re: CouchDB Module System

Posted by Paul Davis <pa...@gmail.com>.
On Mon, Jan 23, 2012 at 3:03 AM, Randall Leeds <ra...@gmail.com> wrote:
> On Sat, Dec 31, 2011 at 10:34, Jan Johannes <ja...@ntr.io> wrote:
>> Dear favorite Document-database developer community :-)
>> This is my first message to the mailing list, so please forgive me and
>> gently correct me if i am breaking any communication standards whatsoeverŠ
>
> Nope! You're just bringing up a deep topic with a lot of text.
> I hope you didn't expect a speedy response! :)
>
>>
>> I am currently working on a WebDAV interface for CouchDB, that now gets
>> closer to its release date, somewhere in February or March and as i
>> approach that, I want to package everything in a proper CouchDB Module
>> format but the CouchDB Module system is, as i understood, in early
>> development or pre-development phase and needs a bit of work.
>>
>> So as i work on a CouchDB Module anyways i would like to contribute to the
>> Module system or start kicking the work on that of.
>>
>> Hence the following questions:
>>
>> Who started working on such a system or would be interested in talking
>> about the design decisions that need to be done before actual coding can
>> start?
>> (I know at least Jan Lehnardt expressed interest, but i can't quite
>> remember if he started actual work or just had plans for that.)
>
> Benoit is particularly interested and there is activity on the refuge
> project mailing list about it from Nicolas Dufour.
> I believe Jason Smith might be pretty interested since he's authored
> some "plugins" already.
> Others on the list are certainly interested.
> I'm keen to get a good module system and it's why I was in favor of
> the effort to get "couch-config" shipped as part of the install.
>
>>
>> If there is any documentation on planning such a system, could someone
>> please point me to the recourses?
>
> There's an umbrella ticket I made for modularizing the code base more:
> https://issues.apache.org/jira/browse/COUCHDB-1251
>
> And these:
>
> Utility to help plugin developers manage paths
> https://issues.apache.org/jira/browse/COUCHDB-1012
>
> support load of external erlang modules in couchdb.
> https://issues.apache.org/jira/browse/COUCHDB-1046
>
>>
>> Lastly here is my two cents on a few topics that need to be addressed:
>>
>> - We should build the best module system there is for a database or
>> content management system to gain back a bit of the traction we lost
>> during the recent plateau phase of couchdb enthusiasm
>
> I find it hard to judge enthusiasm from the inside, but, yeah... a
> proper module system would rock.
> One of the things CouchDB struggles with in terms of image, but excels
> at in terms of function is scaling up and down. The only way to really
> make one project move from mobile phone to datacenter cluster is to
> modularize the build and deployment of key components. I think
> everyone agrees about this. CouchDB is the Gentoo of document
> databases in this way.
>
>>
>> - I think "module" is the preferable term, as extension, plugin or the
>> like sound like second class citizens, whereas module implies, that even a
>> core component of the system can be made into such an instance (Any other
>> suggestions?)
>
> Module is a little bit confusing because it conflicts with Erlang's
> definition. While the two would often be synonymous for many add-ons,
> it's not necessarily the case.
> I would go with calling them "applications" maybe. I've often thought
> that each such thing could correspond well to a single Erlang
> application and .app file, which Erlang has significant support and
> prior art for loading and unloading on the fly. But really, I don't
> care what color we paint this and long as it's neon awesome.
>
>>
>> - A CouchDB module should be packaged as a stand alone couchdb-document,
>> with the yet to be specified manifest beeing the json structure of the
>> document and the files beeing the attachment.
>
> I'm pretty sure I disagree here. I think this conflates two issues.
> The first, to me, is a good hooks system from which more interactions
> in the core could be scripted with sandboxed user code. Once again, I
> know I've talked to Benoit about this. The second, though, is the more
> first-class type of application that requires compiled Erlang
> bytecode. While these have some degree of portability[1] I
> instinctively cringe, from a security standpoint, at the idea of hot
> loading code from a document into the VM. While the document-module
> idea I find attractive from a share-ability and install-ability
> standpoint, I don't think it befits the general purpose module system.
> Although, a good hooks system may make certain kinds of modules work
> this way.
>
> [1] http://stackoverflow.com/questions/2255658/how-portable-are-erlang-beam-files
>
>>
>> - Discovery, Installation, Enabling, Disabling, Module-Specific
>> Configuration and Distribution should be part of Futon and introduce as
>> little new interface concepts as possible, also the futon interface
>> section "configuration" may be needed to be integrated and streamlined
>> quite nicely
>
> Again, this works the dynamic-language, hooks-based module, but I'm
> not sure it works for all modules. Kanso [2] is doing this to a large
> extent already, under the CouchApp frame, but I see no reason why a
> hooks system couldn't accommodate a new, more powerful kind of Kanso
> package.
>
> [2] http://kan.so/
>
>>
>> - Even if a module is not possible to completely install via this method
>> (e.g. It depends on a os component, that is too low level etc.) such
>> modules should be as tightly integrated into the system as possible and
>> the manual admin installation steps should be documented in a way, so that
>> in a normal case no place but the module system needs to be accessed
>
> Agree.
>
>>
>> - on the top level the system should be the same for all OSes
>>
>> - The work packages i see at the moment for the structure i have in mind
>> would be:
>>
>>        - Module repository: A CouchDB Instance, that hosts a collection of
>> CouchDB Modules
>
> See Kanso, above.
>
>>        - Futon User Interface to browse available Modules in the configured
>> repositories, should be close to the Firefox plugin paradigms
>
> That would be neat. Or a separate 'shopping' utility for CouchApps.
> Sounds a bit like a combination between JChris' CouchApp Garden [3]
> and Max Ogden's Chrome Couch application [4]. Crossing these would
> Kanso would be really neat.
>
> [3] https://github.com/jchris/garden
> [4] https://github.com/maxogden/chromecouch
>
>>        - Module Manifest: Descriptive CouchDoc, that references the attached
>> files or git repository, how files need to be fetched, packaged and what
>> goes where, also version                dependencies, description, rating, Module
>> Category, needed system privileges (basically if you need to be a couch
>> admin or if you need to be root on the os), needed              configuration, and
>> basic description of the configuration parameters
>
> I'd really prefer to punt on low-level privileges and just call this
> two separate things. The way to unify them, in my mind, is to create a
> hooks system and then to make a native module that listens for all
> hooks and delegates processing to design documents that indicate they
> handle certain hooks. In other words, build the un-privileged module
> system on top of the privileged one. Let administrators worry about
> file systems when installing the privileged ones. It's really not so
> bad. Sysadmins have been installing things for years, and actually
> probably prefer to install stuff on the command line than with a POST
> to /_replicate. The couch-config utility is there to facilitate this.
> What we probably need is an extra location for user-installed add-on
> applications that need to be added to the Erlang library path and used
> for loading configured applications.
>
>>        - Futon User Interface to the installed modules, with options to enable,
>> disable, uninstall, rate and configure
>
> Yes again. I like the gist, but I don't know if it should be bound up
> in Futon or not.
>
>>        - The tools for installation/uninstallation and enabling/disabling as
>> well as packaging and dependency resolution
>
> That sounds like figuring out a good way to structure the
> configuration sections for modules. See the JIRA tickets I referenced
> for some discussion of that.
>
>>
>>        Open questions: What existing projects could be made use of, maybe there
>> is something great for the general erlang world, maybe there is a project
>> like zero install, that         could be made use of, maybe that is not
>> necessary, what are your thoughts?
>
> I would also check out Agner: http://erlagner.org/
>
> Basically, if we could get to the point where CouchDB administrators
> could use Agner to install new pieces I'd consider that a huge win.
> If, in the process, we get a modularized core and support for a
> design-document-level hooks system I'd consider that an epic win. I
> never say epic win. I would say it three times out loud.
>
>>
>> I wish you all a happy new year!
>>
>>
>
> Thanks :)
> -Randall

+1 to pretty much everything Randall said.

Minor caveat: application is about as overloaded in Erlang as module
(and process for that matter) when considering prior expectations of
non-Erlangians. There should be a word for these things. Plug-ins has
always been my word for them, but the second-class-ness that invokes
is understandable. Perhaps there's a perfect word, but perhaps
"component" is good enough?

My other reaction is that installing "whatevers/components/widgets"
should *not* be a web thing. I understand the desire to make this user
friendly and the such, but as Randall points out, putting random
(fairly difficult to sandbox) code into a server/service environment
seems quite ungood. This basically hearkens back to the
disabled-by-default native view server. While its definitely
"possible" to provide some sort of sandboxed thing for Erlang
extensions, its a "plug all the leaks with fingers" type of possible.
If we're interested in allowing code execution on the server it should
be "here's you're iron box with carefully crafted ports of interaction
to the world" type of sandboxing. Ie, AppEngine vs erm, not-AppEngine.

Other than that, yes. Erlang makes extensions super awesomely easy and
we should be embracing that more loudly. Both with community resources
for discovery as well as the technical adjustments to ease their
usage.

Re: CouchDB Module System

Posted by Randall Leeds <ra...@gmail.com>.
Add this one to the pile:

Improve config file write-back behavior.
https://issues.apache.org/jira/browse/COUCHDB-1086

On Mon, Jan 23, 2012 at 01:03, Randall Leeds <ra...@gmail.com> wrote:
> On Sat, Dec 31, 2011 at 10:34, Jan Johannes <ja...@ntr.io> wrote:
>> Dear favorite Document-database developer community :-)
>> This is my first message to the mailing list, so please forgive me and
>> gently correct me if i am breaking any communication standards whatsoeverŠ
>
> Nope! You're just bringing up a deep topic with a lot of text.
> I hope you didn't expect a speedy response! :)
>
>>
>> I am currently working on a WebDAV interface for CouchDB, that now gets
>> closer to its release date, somewhere in February or March and as i
>> approach that, I want to package everything in a proper CouchDB Module
>> format but the CouchDB Module system is, as i understood, in early
>> development or pre-development phase and needs a bit of work.
>>
>> So as i work on a CouchDB Module anyways i would like to contribute to the
>> Module system or start kicking the work on that of.
>>
>> Hence the following questions:
>>
>> Who started working on such a system or would be interested in talking
>> about the design decisions that need to be done before actual coding can
>> start?
>> (I know at least Jan Lehnardt expressed interest, but i can't quite
>> remember if he started actual work or just had plans for that.)
>
> Benoit is particularly interested and there is activity on the refuge
> project mailing list about it from Nicolas Dufour.
> I believe Jason Smith might be pretty interested since he's authored
> some "plugins" already.
> Others on the list are certainly interested.
> I'm keen to get a good module system and it's why I was in favor of
> the effort to get "couch-config" shipped as part of the install.
>
>>
>> If there is any documentation on planning such a system, could someone
>> please point me to the recourses?
>
> There's an umbrella ticket I made for modularizing the code base more:
> https://issues.apache.org/jira/browse/COUCHDB-1251
>
> And these:
>
> Utility to help plugin developers manage paths
> https://issues.apache.org/jira/browse/COUCHDB-1012
>
> support load of external erlang modules in couchdb.
> https://issues.apache.org/jira/browse/COUCHDB-1046
>
>>
>> Lastly here is my two cents on a few topics that need to be addressed:
>>
>> - We should build the best module system there is for a database or
>> content management system to gain back a bit of the traction we lost
>> during the recent plateau phase of couchdb enthusiasm
>
> I find it hard to judge enthusiasm from the inside, but, yeah... a
> proper module system would rock.
> One of the things CouchDB struggles with in terms of image, but excels
> at in terms of function is scaling up and down. The only way to really
> make one project move from mobile phone to datacenter cluster is to
> modularize the build and deployment of key components. I think
> everyone agrees about this. CouchDB is the Gentoo of document
> databases in this way.
>
>>
>> - I think "module" is the preferable term, as extension, plugin or the
>> like sound like second class citizens, whereas module implies, that even a
>> core component of the system can be made into such an instance (Any other
>> suggestions?)
>
> Module is a little bit confusing because it conflicts with Erlang's
> definition. While the two would often be synonymous for many add-ons,
> it's not necessarily the case.
> I would go with calling them "applications" maybe. I've often thought
> that each such thing could correspond well to a single Erlang
> application and .app file, which Erlang has significant support and
> prior art for loading and unloading on the fly. But really, I don't
> care what color we paint this and long as it's neon awesome.
>
>>
>> - A CouchDB module should be packaged as a stand alone couchdb-document,
>> with the yet to be specified manifest beeing the json structure of the
>> document and the files beeing the attachment.
>
> I'm pretty sure I disagree here. I think this conflates two issues.
> The first, to me, is a good hooks system from which more interactions
> in the core could be scripted with sandboxed user code. Once again, I
> know I've talked to Benoit about this. The second, though, is the more
> first-class type of application that requires compiled Erlang
> bytecode. While these have some degree of portability[1] I
> instinctively cringe, from a security standpoint, at the idea of hot
> loading code from a document into the VM. While the document-module
> idea I find attractive from a share-ability and install-ability
> standpoint, I don't think it befits the general purpose module system.
> Although, a good hooks system may make certain kinds of modules work
> this way.
>
> [1] http://stackoverflow.com/questions/2255658/how-portable-are-erlang-beam-files
>
>>
>> - Discovery, Installation, Enabling, Disabling, Module-Specific
>> Configuration and Distribution should be part of Futon and introduce as
>> little new interface concepts as possible, also the futon interface
>> section "configuration" may be needed to be integrated and streamlined
>> quite nicely
>
> Again, this works the dynamic-language, hooks-based module, but I'm
> not sure it works for all modules. Kanso [2] is doing this to a large
> extent already, under the CouchApp frame, but I see no reason why a
> hooks system couldn't accommodate a new, more powerful kind of Kanso
> package.
>
> [2] http://kan.so/
>
>>
>> - Even if a module is not possible to completely install via this method
>> (e.g. It depends on a os component, that is too low level etc.) such
>> modules should be as tightly integrated into the system as possible and
>> the manual admin installation steps should be documented in a way, so that
>> in a normal case no place but the module system needs to be accessed
>
> Agree.
>
>>
>> - on the top level the system should be the same for all OSes
>>
>> - The work packages i see at the moment for the structure i have in mind
>> would be:
>>
>>        - Module repository: A CouchDB Instance, that hosts a collection of
>> CouchDB Modules
>
> See Kanso, above.
>
>>        - Futon User Interface to browse available Modules in the configured
>> repositories, should be close to the Firefox plugin paradigms
>
> That would be neat. Or a separate 'shopping' utility for CouchApps.
> Sounds a bit like a combination between JChris' CouchApp Garden [3]
> and Max Ogden's Chrome Couch application [4]. Crossing these would
> Kanso would be really neat.
>
> [3] https://github.com/jchris/garden
> [4] https://github.com/maxogden/chromecouch
>
>>        - Module Manifest: Descriptive CouchDoc, that references the attached
>> files or git repository, how files need to be fetched, packaged and what
>> goes where, also version                dependencies, description, rating, Module
>> Category, needed system privileges (basically if you need to be a couch
>> admin or if you need to be root on the os), needed              configuration, and
>> basic description of the configuration parameters
>
> I'd really prefer to punt on low-level privileges and just call this
> two separate things. The way to unify them, in my mind, is to create a
> hooks system and then to make a native module that listens for all
> hooks and delegates processing to design documents that indicate they
> handle certain hooks. In other words, build the un-privileged module
> system on top of the privileged one. Let administrators worry about
> file systems when installing the privileged ones. It's really not so
> bad. Sysadmins have been installing things for years, and actually
> probably prefer to install stuff on the command line than with a POST
> to /_replicate. The couch-config utility is there to facilitate this.
> What we probably need is an extra location for user-installed add-on
> applications that need to be added to the Erlang library path and used
> for loading configured applications.
>
>>        - Futon User Interface to the installed modules, with options to enable,
>> disable, uninstall, rate and configure
>
> Yes again. I like the gist, but I don't know if it should be bound up
> in Futon or not.
>
>>        - The tools for installation/uninstallation and enabling/disabling as
>> well as packaging and dependency resolution
>
> That sounds like figuring out a good way to structure the
> configuration sections for modules. See the JIRA tickets I referenced
> for some discussion of that.
>
>>
>>        Open questions: What existing projects could be made use of, maybe there
>> is something great for the general erlang world, maybe there is a project
>> like zero install, that         could be made use of, maybe that is not
>> necessary, what are your thoughts?
>
> I would also check out Agner: http://erlagner.org/
>
> Basically, if we could get to the point where CouchDB administrators
> could use Agner to install new pieces I'd consider that a huge win.
> If, in the process, we get a modularized core and support for a
> design-document-level hooks system I'd consider that an epic win. I
> never say epic win. I would say it three times out loud.
>
>>
>> I wish you all a happy new year!
>>
>>
>
> Thanks :)
> -Randall

Re: CouchDB Module System

Posted by Randall Leeds <ra...@gmail.com>.
On Sat, Dec 31, 2011 at 10:34, Jan Johannes <ja...@ntr.io> wrote:
> Dear favorite Document-database developer community :-)
> This is my first message to the mailing list, so please forgive me and
> gently correct me if i am breaking any communication standards whatsoeverŠ

Nope! You're just bringing up a deep topic with a lot of text.
I hope you didn't expect a speedy response! :)

>
> I am currently working on a WebDAV interface for CouchDB, that now gets
> closer to its release date, somewhere in February or March and as i
> approach that, I want to package everything in a proper CouchDB Module
> format but the CouchDB Module system is, as i understood, in early
> development or pre-development phase and needs a bit of work.
>
> So as i work on a CouchDB Module anyways i would like to contribute to the
> Module system or start kicking the work on that of.
>
> Hence the following questions:
>
> Who started working on such a system or would be interested in talking
> about the design decisions that need to be done before actual coding can
> start?
> (I know at least Jan Lehnardt expressed interest, but i can't quite
> remember if he started actual work or just had plans for that.)

Benoit is particularly interested and there is activity on the refuge
project mailing list about it from Nicolas Dufour.
I believe Jason Smith might be pretty interested since he's authored
some "plugins" already.
Others on the list are certainly interested.
I'm keen to get a good module system and it's why I was in favor of
the effort to get "couch-config" shipped as part of the install.

>
> If there is any documentation on planning such a system, could someone
> please point me to the recourses?

There's an umbrella ticket I made for modularizing the code base more:
https://issues.apache.org/jira/browse/COUCHDB-1251

And these:

Utility to help plugin developers manage paths
https://issues.apache.org/jira/browse/COUCHDB-1012

support load of external erlang modules in couchdb.
https://issues.apache.org/jira/browse/COUCHDB-1046

>
> Lastly here is my two cents on a few topics that need to be addressed:
>
> - We should build the best module system there is for a database or
> content management system to gain back a bit of the traction we lost
> during the recent plateau phase of couchdb enthusiasm

I find it hard to judge enthusiasm from the inside, but, yeah... a
proper module system would rock.
One of the things CouchDB struggles with in terms of image, but excels
at in terms of function is scaling up and down. The only way to really
make one project move from mobile phone to datacenter cluster is to
modularize the build and deployment of key components. I think
everyone agrees about this. CouchDB is the Gentoo of document
databases in this way.

>
> - I think "module" is the preferable term, as extension, plugin or the
> like sound like second class citizens, whereas module implies, that even a
> core component of the system can be made into such an instance (Any other
> suggestions?)

Module is a little bit confusing because it conflicts with Erlang's
definition. While the two would often be synonymous for many add-ons,
it's not necessarily the case.
I would go with calling them "applications" maybe. I've often thought
that each such thing could correspond well to a single Erlang
application and .app file, which Erlang has significant support and
prior art for loading and unloading on the fly. But really, I don't
care what color we paint this and long as it's neon awesome.

>
> - A CouchDB module should be packaged as a stand alone couchdb-document,
> with the yet to be specified manifest beeing the json structure of the
> document and the files beeing the attachment.

I'm pretty sure I disagree here. I think this conflates two issues.
The first, to me, is a good hooks system from which more interactions
in the core could be scripted with sandboxed user code. Once again, I
know I've talked to Benoit about this. The second, though, is the more
first-class type of application that requires compiled Erlang
bytecode. While these have some degree of portability[1] I
instinctively cringe, from a security standpoint, at the idea of hot
loading code from a document into the VM. While the document-module
idea I find attractive from a share-ability and install-ability
standpoint, I don't think it befits the general purpose module system.
Although, a good hooks system may make certain kinds of modules work
this way.

[1] http://stackoverflow.com/questions/2255658/how-portable-are-erlang-beam-files

>
> - Discovery, Installation, Enabling, Disabling, Module-Specific
> Configuration and Distribution should be part of Futon and introduce as
> little new interface concepts as possible, also the futon interface
> section "configuration" may be needed to be integrated and streamlined
> quite nicely

Again, this works the dynamic-language, hooks-based module, but I'm
not sure it works for all modules. Kanso [2] is doing this to a large
extent already, under the CouchApp frame, but I see no reason why a
hooks system couldn't accommodate a new, more powerful kind of Kanso
package.

[2] http://kan.so/

>
> - Even if a module is not possible to completely install via this method
> (e.g. It depends on a os component, that is too low level etc.) such
> modules should be as tightly integrated into the system as possible and
> the manual admin installation steps should be documented in a way, so that
> in a normal case no place but the module system needs to be accessed

Agree.

>
> - on the top level the system should be the same for all OSes
>
> - The work packages i see at the moment for the structure i have in mind
> would be:
>
>        - Module repository: A CouchDB Instance, that hosts a collection of
> CouchDB Modules

See Kanso, above.

>        - Futon User Interface to browse available Modules in the configured
> repositories, should be close to the Firefox plugin paradigms

That would be neat. Or a separate 'shopping' utility for CouchApps.
Sounds a bit like a combination between JChris' CouchApp Garden [3]
and Max Ogden's Chrome Couch application [4]. Crossing these would
Kanso would be really neat.

[3] https://github.com/jchris/garden
[4] https://github.com/maxogden/chromecouch

>        - Module Manifest: Descriptive CouchDoc, that references the attached
> files or git repository, how files need to be fetched, packaged and what
> goes where, also version                dependencies, description, rating, Module
> Category, needed system privileges (basically if you need to be a couch
> admin or if you need to be root on the os), needed              configuration, and
> basic description of the configuration parameters

I'd really prefer to punt on low-level privileges and just call this
two separate things. The way to unify them, in my mind, is to create a
hooks system and then to make a native module that listens for all
hooks and delegates processing to design documents that indicate they
handle certain hooks. In other words, build the un-privileged module
system on top of the privileged one. Let administrators worry about
file systems when installing the privileged ones. It's really not so
bad. Sysadmins have been installing things for years, and actually
probably prefer to install stuff on the command line than with a POST
to /_replicate. The couch-config utility is there to facilitate this.
What we probably need is an extra location for user-installed add-on
applications that need to be added to the Erlang library path and used
for loading configured applications.

>        - Futon User Interface to the installed modules, with options to enable,
> disable, uninstall, rate and configure

Yes again. I like the gist, but I don't know if it should be bound up
in Futon or not.

>        - The tools for installation/uninstallation and enabling/disabling as
> well as packaging and dependency resolution

That sounds like figuring out a good way to structure the
configuration sections for modules. See the JIRA tickets I referenced
for some discussion of that.

>
>        Open questions: What existing projects could be made use of, maybe there
> is something great for the general erlang world, maybe there is a project
> like zero install, that         could be made use of, maybe that is not
> necessary, what are your thoughts?

I would also check out Agner: http://erlagner.org/

Basically, if we could get to the point where CouchDB administrators
could use Agner to install new pieces I'd consider that a huge win.
If, in the process, we get a modularized core and support for a
design-document-level hooks system I'd consider that an epic win. I
never say epic win. I would say it three times out loud.

>
> I wish you all a happy new year!
>
>

Thanks :)
-Randall

CouchDB Module System

Posted by Jan Johannes <ja...@ntr.io>.
Dear favorite Document-database developer community :-)
This is my first message to the mailing list, so please forgive me and
gently correct me if i am breaking any communication standards whatsoeverŠ

I am currently working on a WebDAV interface for CouchDB, that now gets
closer to its release date, somewhere in February or March and as i
approach that, I want to package everything in a proper CouchDB Module
format but the CouchDB Module system is, as i understood, in early
development or pre-development phase and needs a bit of work.

So as i work on a CouchDB Module anyways i would like to contribute to the
Module system or start kicking the work on that of.

Hence the following questions:

Who started working on such a system or would be interested in talking
about the design decisions that need to be done before actual coding can
start? 
(I know at least Jan Lehnardt expressed interest, but i can't quite
remember if he started actual work or just had plans for that.)

If there is any documentation on planning such a system, could someone
please point me to the recourses?

Lastly here is my two cents on a few topics that need to be addressed:

- We should build the best module system there is for a database or
content management system to gain back a bit of the traction we lost
during the recent plateau phase of couchdb enthusiasm

- I think "module" is the preferable term, as extension, plugin or the
like sound like second class citizens, whereas module implies, that even a
core component of the system can be made into such an instance (Any other
suggestions?)

- A CouchDB module should be packaged as a stand alone couchdb-document,
with the yet to be specified manifest beeing the json structure of the
document and the files beeing the attachment.

- Discovery, Installation, Enabling, Disabling, Module-Specific
Configuration and Distribution should be part of Futon and introduce as
little new interface concepts as possible, also the futon interface
section "configuration" may be needed to be integrated and streamlined
quite nicely

- Even if a module is not possible to completely install via this method
(e.g. It depends on a os component, that is too low level etc.) such
modules should be as tightly integrated into the system as possible and
the manual admin installation steps should be documented in a way, so that
in a normal case no place but the module system needs to be accessed

- on the top level the system should be the same for all OSes

- The work packages i see at the moment for the structure i have in mind
would be:
	
	- Module repository: A CouchDB Instance, that hosts a collection of
CouchDB Modules
	- Futon User Interface to browse available Modules in the configured
repositories, should be close to the Firefox plugin paradigms
	- Module Manifest: Descriptive CouchDoc, that references the attached
files or git repository, how files need to be fetched, packaged and what
goes where, also version 		dependencies, description, rating, Module
Category, needed system privileges (basically if you need to be a couch
admin or if you need to be root on the os), needed 		configuration, and
basic description of the configuration parameters
	- Futon User Interface to the installed modules, with options to enable,
disable, uninstall, rate and configure
	- The tools for installation/uninstallation and enabling/disabling as
well as packaging and dependency resolution

	Open questions: What existing projects could be made use of, maybe there
is something great for the general erlang world, maybe there is a project
like zero install, that 	could be made use of, maybe that is not
necessary, what are your thoughts?

I wish you all a happy new year!