You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Ido Ran <id...@gmail.com> on 2011/10/17 00:14:08 UTC

Architecture Question

Hi,
I have an application that currently use RESTful web service that I'm
thinking to convert to use CouchDB to allow offline work.
I have an idea of what I need and how to do it but I would like to hear if
it is the right way and what problem it may bring along the way.

It this mailing list is the right and good place to ask such question?

Thank you,
Ido

Re: Architecture Question

Posted by Ido Ran <id...@gmail.com>.
Thank - that's help. 
Now, how to model the docs and handle security. 

Ido



ב-18 באוק 2011, בשעה 15:58, Dave Cottlehuber <da...@muse.net.nz> כתב/ה:

> On 18 October 2011 12:05, Ido Ran <id...@gmail.com> wrote:
>> Hello again,
>> 
>> I am developing a desktop application that run on Windows using WPF
>> interface. The application loading and saving data using RESTful web service
>> that is currently only a thin wrapper around relational database.
>> 
>> My design require the following things:
>> 
>>   1. Offline work - allow the users to work in offline mode when connection
>>   to the server is not working
>>   2. Sync between local and remote databases - Either online or manual sync
>>   between databases
>>   3. Conflict resolution - Both offline and sync may cause conflicts so I
>>   need a way to resolve them
>>   4. Security - I need to authenticate the user and authorize them
>>   according to security rules.
>> 
>> The first 3 requirements available in CouchDB out-of-the-box - the question
>> here is what data model to use in order to take advantage of those those
>> capabilities.
>> My model is close to the following (top to bottom):
>> 
>>   - ProcessGroup is a data entity with name and set of Processes
>>   - Process is a data entity with name and set of activities
>>   - Activity is a data entity with name and set of participants and set of
>>   properties
>> 
>> If I will create a document for ProcessGroup it will cause to much conflicts
>> even if two users change different activities. On the other hand if I model
>> each entity as it own document I can't be sure that when creating a Process
>> with 100 activities all of the activities will be added, for example a power
>> down in the middle of the process or CouchDB fail half way though the
>> addition. In other words there are no transaction out side a document.
> 
> The bulk docs API might be sufficient for your needs:
> 
> http://wiki.apache.org/couchdb/HTTP_Bulk_Document_API#Transactional_Semantics_with_Bulk_Updates
> 
> A+
> Dave

Re: Architecture Question

Posted by Dave Cottlehuber <da...@muse.net.nz>.
On 18 October 2011 12:05, Ido Ran <id...@gmail.com> wrote:
> Hello again,
>
> I am developing a desktop application that run on Windows using WPF
> interface. The application loading and saving data using RESTful web service
> that is currently only a thin wrapper around relational database.
>
> My design require the following things:
>
>   1. Offline work - allow the users to work in offline mode when connection
>   to the server is not working
>   2. Sync between local and remote databases - Either online or manual sync
>   between databases
>   3. Conflict resolution - Both offline and sync may cause conflicts so I
>   need a way to resolve them
>   4. Security - I need to authenticate the user and authorize them
>   according to security rules.
>
> The first 3 requirements available in CouchDB out-of-the-box - the question
> here is what data model to use in order to take advantage of those those
> capabilities.
> My model is close to the following (top to bottom):
>
>   - ProcessGroup is a data entity with name and set of Processes
>   - Process is a data entity with name and set of activities
>   - Activity is a data entity with name and set of participants and set of
>   properties
>
> If I will create a document for ProcessGroup it will cause to much conflicts
> even if two users change different activities. On the other hand if I model
> each entity as it own document I can't be sure that when creating a Process
> with 100 activities all of the activities will be added, for example a power
> down in the middle of the process or CouchDB fail half way though the
> addition. In other words there are no transaction out side a document.

The bulk docs API might be sufficient for your needs:

http://wiki.apache.org/couchdb/HTTP_Bulk_Document_API#Transactional_Semantics_with_Bulk_Updates

A+
Dave

Re: Architecture Question

Posted by Ido Ran <id...@gmail.com>.
Hello again,

I am developing a desktop application that run on Windows using WPF
interface. The application loading and saving data using RESTful web service
that is currently only a thin wrapper around relational database.

My design require the following things:

   1. Offline work - allow the users to work in offline mode when connection
   to the server is not working
   2. Sync between local and remote databases - Either online or manual sync
   between databases
   3. Conflict resolution - Both offline and sync may cause conflicts so I
   need a way to resolve them
   4. Security - I need to authenticate the user and authorize them
   according to security rules.

The first 3 requirements available in CouchDB out-of-the-box - the question
here is what data model to use in order to take advantage of those those
capabilities.
My model is close to the following (top to bottom):

   - ProcessGroup is a data entity with name and set of Processes
   - Process is a data entity with name and set of activities
   - Activity is a data entity with name and set of participants and set of
   properties

If I will create a document for ProcessGroup it will cause to much conflicts
even if two users change different activities. On the other hand if I model
each entity as it own document I can't be sure that when creating a Process
with 100 activities all of the activities will be added, for example a power
down in the middle of the process or CouchDB fail half way though the
addition. In other words there are no transaction out side a document.

Thank you all for the help,
Ido

On Mon, Oct 17, 2011 at 3:54 PM, Robert Wadholm <rw...@maf.org> wrote:

> If you are building a CouchApp, for simplicity, you can also maybe checkout
> Ryan Ramage's CouchApp Takeout:
> https://github.com/ryanramage/couchapp-takeout
> It will install CouchDB on Macs and PCs in the background (as well as your
> CouchApp) as long as the user has the latest Java. It'll install your
> CouchApp as a native looking app, and run it in the user's default browser.
> You can get CouchDB running on a user's machine in about 2-6 minutes
> (depending on download speed) without them having to know they have
> installed anything but your app. And CouchApp Takeout is extremely easy to
> set up (it's a CouchApp itself, so you just replicate it to your db, and
> make a few minor changes to JSON and two images).
>
> Bob
> rwadholm@maf.org<ma...@maf.org>
>
>
> On Oct 17, 2011, at 3:42 AM, Ido Ran wrote:
>
> Many thanks
>
> On Mon, Oct 17, 2011 at 10:36 AM, Dave Cottlehuber <dave@muse.net.nz
> <ma...@muse.net.nz>> wrote:
>
> On 17 October 2011 07:16, Ido Ran <ido.ran@gmail.com<mailto:
> ido.ran@gmail.com>> wrote:
> Thank you all. I'm targeting Windows platform - so I'll be glad to hear
> how can I run the database there.
> It's not going to be in-process but I do need a seamless way to run it
> without the client install it manually.
>
> Thanks
>
> You can bundle couchdb inside another windows app without users
> needing to install it separately. Check
> http://wiki.apache.org/couchdb/Quirks_on_Windows "Integrating CouchDB
> into your Windows Applications", and make sure you include the
> appropriate VC runtimes either in your app or as a dependency.
>
> I've found that you can also remove the two erl.ini files completely
> and Erlang/CouchDB seems to run just fine without them. You'll still
> need to fiddle your local.ini files for the correct paths of course.
>
> A+
> Dave
>
>
>

Re: Architecture Question

Posted by Robert Wadholm <rw...@maf.org>.
If you are building a CouchApp, for simplicity, you can also maybe checkout Ryan Ramage's CouchApp Takeout:
https://github.com/ryanramage/couchapp-takeout
It will install CouchDB on Macs and PCs in the background (as well as your CouchApp) as long as the user has the latest Java. It'll install your CouchApp as a native looking app, and run it in the user's default browser. You can get CouchDB running on a user's machine in about 2-6 minutes (depending on download speed) without them having to know they have installed anything but your app. And CouchApp Takeout is extremely easy to set up (it's a CouchApp itself, so you just replicate it to your db, and make a few minor changes to JSON and two images).

Bob
rwadholm@maf.org<ma...@maf.org>


On Oct 17, 2011, at 3:42 AM, Ido Ran wrote:

Many thanks

On Mon, Oct 17, 2011 at 10:36 AM, Dave Cottlehuber <da...@muse.net.nz>> wrote:

On 17 October 2011 07:16, Ido Ran <id...@gmail.com>> wrote:
Thank you all. I'm targeting Windows platform - so I'll be glad to hear
how can I run the database there.
It's not going to be in-process but I do need a seamless way to run it
without the client install it manually.

Thanks

You can bundle couchdb inside another windows app without users
needing to install it separately. Check
http://wiki.apache.org/couchdb/Quirks_on_Windows "Integrating CouchDB
into your Windows Applications", and make sure you include the
appropriate VC runtimes either in your app or as a dependency.

I've found that you can also remove the two erl.ini files completely
and Erlang/CouchDB seems to run just fine without them. You'll still
need to fiddle your local.ini files for the correct paths of course.

A+
Dave



Re: Architecture Question

Posted by Ido Ran <id...@gmail.com>.
Many thanks

On Mon, Oct 17, 2011 at 10:36 AM, Dave Cottlehuber <da...@muse.net.nz> wrote:

> On 17 October 2011 07:16, Ido Ran <id...@gmail.com> wrote:
> > Thank you all. I'm targeting Windows platform - so I'll be glad to hear
> how can I run the database there.
> > It's not going to be in-process but I do need a seamless way to run it
> without the client install it manually.
> >
> > Thanks
>
> You can bundle couchdb inside another windows app without users
> needing to install it separately. Check
> http://wiki.apache.org/couchdb/Quirks_on_Windows "Integrating CouchDB
> into your Windows Applications", and make sure you include the
> appropriate VC runtimes either in your app or as a dependency.
>
> I've found that you can also remove the two erl.ini files completely
> and Erlang/CouchDB seems to run just fine without them. You'll still
> need to fiddle your local.ini files for the correct paths of course.
>
> A+
> Dave
>

Re: Architecture Question

Posted by Dave Cottlehuber <da...@muse.net.nz>.
On 17 October 2011 07:16, Ido Ran <id...@gmail.com> wrote:
> Thank you all. I'm targeting Windows platform - so I'll be glad to hear how can I run the database there.
> It's not going to be in-process but I do need a seamless way to run it without the client install it manually.
>
> Thanks

You can bundle couchdb inside another windows app without users
needing to install it separately. Check
http://wiki.apache.org/couchdb/Quirks_on_Windows "Integrating CouchDB
into your Windows Applications", and make sure you include the
appropriate VC runtimes either in your app or as a dependency.

I've found that you can also remove the two erl.ini files completely
and Erlang/CouchDB seems to run just fine without them. You'll still
need to fiddle your local.ini files for the correct paths of course.

A+
Dave

Re: Architecture Question

Posted by Ido Ran <id...@gmail.com>.
Thank you all. I'm targeting Windows platform - so I'll be glad to hear how can I run the database there. 
It's not going to be in-process but I do need a seamless way to run it without the client install it manually. 

Thanks



ב-17 באוק 2011, בשעה 05:19, Kwasi Gyasi - Agyei <kw...@4things.co.za> כתב/ה:

> For mac you can install through macports 'sudo port selfipdate' 'sudo port
> install couchdb'
> On Oct 17, 2011 2:08 AM, "Andrey Cherkashin" <an...@gmail.com> wrote:
> 
>> It is possible on Mac OS X, iOS and Android.
>> On Oct 16, 2011, at 5:03 PM, Mark Hahn wrote:
>> 
>>> Yes, this is a fine place to discuss it.
>>> 
>>> If you are asking about running couchdb as a server on the local client
>> then
>>> that has been discussed several times.  Check the archives.
>>> 
>>> In particular, people have asked for ways to do this without the user
>> having
>>> to install couchdb themselves.  I don't think this is possible yet.
>>> 
>>> On Sun, Oct 16, 2011 at 3:14 PM, Ido Ran <id...@gmail.com> wrote:
>>> 
>>>> Hi,
>>>> I have an application that currently use RESTful web service that I'm
>>>> thinking to convert to use CouchDB to allow offline work.
>>>> I have an idea of what I need and how to do it but I would like to hear
>> if
>>>> it is the right way and what problem it may bring along the way.
>>>> 
>>>> It this mailing list is the right and good place to ask such question?
>>>> 
>>>> Thank you,
>>>> Ido
>>>> 
>> 
>> 

Re: Architecture Question

Posted by Jan Lehnardt <ja...@apache.org>.
On Oct 17, 2011, at 05:19 , Kwasi Gyasi - Agyei wrote:

> For mac you can install through macports 'sudo port selfipdate' 'sudo port
> install couchdb'

I'd recommend Homebrew though :)

  brew install couchdb

http://mxcl.github.com/homebrew/

Cheers
Jan 
-- 



> On Oct 17, 2011 2:08 AM, "Andrey Cherkashin" <an...@gmail.com> wrote:
> 
>> It is possible on Mac OS X, iOS and Android.
>> On Oct 16, 2011, at 5:03 PM, Mark Hahn wrote:
>> 
>>> Yes, this is a fine place to discuss it.
>>> 
>>> If you are asking about running couchdb as a server on the local client
>> then
>>> that has been discussed several times.  Check the archives.
>>> 
>>> In particular, people have asked for ways to do this without the user
>> having
>>> to install couchdb themselves.  I don't think this is possible yet.
>>> 
>>> On Sun, Oct 16, 2011 at 3:14 PM, Ido Ran <id...@gmail.com> wrote:
>>> 
>>>> Hi,
>>>> I have an application that currently use RESTful web service that I'm
>>>> thinking to convert to use CouchDB to allow offline work.
>>>> I have an idea of what I need and how to do it but I would like to hear
>> if
>>>> it is the right way and what problem it may bring along the way.
>>>> 
>>>> It this mailing list is the right and good place to ask such question?
>>>> 
>>>> Thank you,
>>>> Ido
>>>> 
>> 
>> 


Re: Architecture Question

Posted by Kwasi Gyasi - Agyei <kw...@4things.co.za>.
For mac you can install through macports 'sudo port selfipdate' 'sudo port
install couchdb'
On Oct 17, 2011 2:08 AM, "Andrey Cherkashin" <an...@gmail.com> wrote:

> It is possible on Mac OS X, iOS and Android.
> On Oct 16, 2011, at 5:03 PM, Mark Hahn wrote:
>
> > Yes, this is a fine place to discuss it.
> >
> > If you are asking about running couchdb as a server on the local client
> then
> > that has been discussed several times.  Check the archives.
> >
> > In particular, people have asked for ways to do this without the user
> having
> > to install couchdb themselves.  I don't think this is possible yet.
> >
> > On Sun, Oct 16, 2011 at 3:14 PM, Ido Ran <id...@gmail.com> wrote:
> >
> >> Hi,
> >> I have an application that currently use RESTful web service that I'm
> >> thinking to convert to use CouchDB to allow offline work.
> >> I have an idea of what I need and how to do it but I would like to hear
> if
> >> it is the right way and what problem it may bring along the way.
> >>
> >> It this mailing list is the right and good place to ask such question?
> >>
> >> Thank you,
> >> Ido
> >>
>
>

Re: Architecture Question

Posted by Kwasi Gyasi - Agyei <kw...@4things.co.za>.
Yes, it is possible , I think there are examples on couchbase.com
On Oct 17, 2011 2:08 AM, "Andrey Cherkashin" <an...@gmail.com> wrote:

> It is possible on Mac OS X, iOS and Android.
> On Oct 16, 2011, at 5:03 PM, Mark Hahn wrote:
>
> > Yes, this is a fine place to discuss it.
> >
> > If you are asking about running couchdb as a server on the local client
> then
> > that has been discussed several times.  Check the archives.
> >
> > In particular, people have asked for ways to do this without the user
> having
> > to install couchdb themselves.  I don't think this is possible yet.
> >
> > On Sun, Oct 16, 2011 at 3:14 PM, Ido Ran <id...@gmail.com> wrote:
> >
> >> Hi,
> >> I have an application that currently use RESTful web service that I'm
> >> thinking to convert to use CouchDB to allow offline work.
> >> I have an idea of what I need and how to do it but I would like to hear
> if
> >> it is the right way and what problem it may bring along the way.
> >>
> >> It this mailing list is the right and good place to ask such question?
> >>
> >> Thank you,
> >> Ido
> >>
>
>

Re: Architecture Question

Posted by Andrey Cherkashin <an...@gmail.com>.
It is possible on Mac OS X, iOS and Android.  
On Oct 16, 2011, at 5:03 PM, Mark Hahn wrote:

> Yes, this is a fine place to discuss it.
> 
> If you are asking about running couchdb as a server on the local client then
> that has been discussed several times.  Check the archives.
> 
> In particular, people have asked for ways to do this without the user having
> to install couchdb themselves.  I don't think this is possible yet.
> 
> On Sun, Oct 16, 2011 at 3:14 PM, Ido Ran <id...@gmail.com> wrote:
> 
>> Hi,
>> I have an application that currently use RESTful web service that I'm
>> thinking to convert to use CouchDB to allow offline work.
>> I have an idea of what I need and how to do it but I would like to hear if
>> it is the right way and what problem it may bring along the way.
>> 
>> It this mailing list is the right and good place to ask such question?
>> 
>> Thank you,
>> Ido
>> 


Re: Architecture Question

Posted by Mark Hahn <ma...@boutiquing.com>.
Yes, this is a fine place to discuss it.

If you are asking about running couchdb as a server on the local client then
that has been discussed several times.  Check the archives.

In particular, people have asked for ways to do this without the user having
to install couchdb themselves.  I don't think this is possible yet.

On Sun, Oct 16, 2011 at 3:14 PM, Ido Ran <id...@gmail.com> wrote:

> Hi,
> I have an application that currently use RESTful web service that I'm
> thinking to convert to use CouchDB to allow offline work.
> I have an idea of what I need and how to do it but I would like to hear if
> it is the right way and what problem it may bring along the way.
>
> It this mailing list is the right and good place to ask such question?
>
> Thank you,
> Ido
>