cozy / cozy-proxy

This repository was part of CozyV2 which has been deprecated - Cozy authentication and routing layer
https://blog.cozycloud.cc/post/2016/11/21/On-the-road-to-Cozy-version-3
GNU Affero General Public License v3.0
26 stars 31 forks source link

Add a replication route #94

Open paultranvan opened 9 years ago

paultranvan commented 9 years ago

For now it is not possible for an app to request its proxy for a replication with a remote target. External clients like cozy-desktop or cozy-mobile can request a replication on a local database, e.g. PouchDB and establish the sync with cozy through the device interface. But a cozy app cannot access the CouchDB replication. Adding a replication route would enable at least 2 things : the possibility for an app to share data with a remote cozy the possibility to create backup apps

The proxy should check that the request is correctly authenticated before routing the request to CouchDB. The remote authentication on the other hand is probably an other issue (User/Sharer doctype with specific rights?).

frankrousseau commented 9 years ago

+1 for that feature request.

One more use case: write client-only apps based on Pouch that syncs with the Couch.

aenario commented 9 years ago

@frankrousseau this is already possible through the device API and wont be possible using this approach.

To put it simply, it is already possible to replicate to & from the cozy's couchdb if the replication is managed from the outside (see cozy-mobile & cozy-desktop) What is not possible is to POST localhost:5984/_replication to ask the cozy's couchdb to initiate and manage a replication

So from my point of view, it would make more sense for this to be an API of the DS rather than the proxy. So a cozy app could say : "OK cozy, do a replication to/from this remote" (where the remote could be another cozy). Of course @Gara64 , this depends of the architecture of the solution (ie. is there an app in the cozy ?).

frankrousseau commented 9 years ago

@aenario I don't think. There is an authentication process specific to devices that allows it. For an app, it would mean to register as a device.

I agree it should be part of the DS to manage properly authentication and filters.

paultranvan commented 9 years ago

Yes that would definitely be better as an API in the DS. However in a first step, maybe it would be simplier and faster to do it in the proxy?