cozy-labs / cozy-light

Personal Server Made Easy
http://cozy-labs.github.io/cozy-light/
GNU Affero General Public License v3.0
104 stars 13 forks source link

configHelpers.copyDependency #40

Closed maboiteaspam closed 9 years ago

maboiteaspam commented 10 years ago

Hello,

I ve noticed this method while reviewing. It says it copies dependencies to avoid rebuild and improve install duration.

I have few questions about it,

My opinion being that it will be a problem to copy dependencies on the fly without strong package versionning when more time has spend.

frankrousseau commented 10 years ago

Yeah it's a little bit dirty. I made that to make the app installation time shorter (because of leveldown build). What you describe is good but it looks a lot like the Cozy Data System. I'm not sure that it is what we want in the light version.

maboiteaspam commented 10 years ago

indeed about Cozy data system.

In regards of current solution, we should try http://stackoverflow.com/a/15639076 with various versions. I believe everything is handled under the hood by npm.

frankrousseau commented 10 years ago

Yep, it looks like we could handle it properly with NPM.

There is one more reason about not having an API to manage data. Developers of Cozy Light application should not have to install any development environment to start coding their app (except Node.js of course). That's why I prefer they deal only with a local PouchDB instance.

maboiteaspam commented 10 years ago

There is one more reason about not having an API to manage data. Developers of Cozy Light application should not have to install any development environment to start coding their app (except Node.js of course). That's why I prefer they deal only with a local PouchDB instance.

yeah. I totally agree with you. In beginning i investigated this problem, i found out using waterline orm layer could be great, because it abstract this function, and provide on file or on db storage. That way, the dev could use on file storage for development and testing purpose. Then, the idea, was that the app would scale the db according to the end-user availability. A master admin that can install a couchdb instance, great let s use it. A co-developer that just want to test your app will be happy to go with an on-file storage.

This said,if i remember correctly, pouchdb has some quiet interesting sync functions and the overall setup is still much easier.

maboiteaspam commented 10 years ago

Just to post a note about something i think is a trap to mistake for developer, and eventually aslo for debug purpose. Also this is related to the way dependencies and setup are done.

In maboiteaspam/cozy-dashboard, i did a require('cozy-light'); At first, i also have set it up as dependency of the package. So, the require within dashboard was resolved in regard of that local package. It was not resolved in regard of the global package install, the one that is summoned to intialize the cozy-light singleton from command line. Thus, their was two singletons living in the same node process, one with all the data correctly setup, the other one which was not yet initialized, and would probably never been initialized.

It s not abvious at all. that s the point i wanted to emphase.

Now, besides the solution quoted previsouly, i wonder if the peerDependencies are not there to solve especially those situations, https://www.npmjs.org/doc/files/package.json.html#peerdependencies

Alternatively, we may also re factor the app handlers signature (start/stop) to pass the cozyLight singleton. It seems quiet workable solution too.

frankrousseau commented 9 years ago

About the ORM, apps are already based on that one:

https://npmjs.org/package/jugglingdb

And we use that adapter:

https://npmjs.org/package/jugglingdb-pouchdb-adapter

But we are thinking about rewriting it to make it simpler and more Pouch/Couch oriented. I will keep you informed about it.

frankrousseau commented 9 years ago

One last remark about npm link: it requires super user rights. And Cozy Light should be able to run without that super user rights.

maboiteaspam commented 9 years ago

on mac it won t work, as far as i know, the sudo less capability.

Also not sure you can bind 0.0.0.0 or wan IP without sudo capability.

frankrousseau commented 9 years ago

Ok so let's close this issue. Cozy Light should be able to run without super user rights.