cozy-dev icon indicating copy to clipboard operation
cozy-dev copied to clipboard

cozy-dev deploy with client-side apps

Open Phyks opened this issue 8 years ago • 4 comments

Hi,

I am trying to use cozy-dev with a client-side app. As far as I understood the deploy documentation, I should run

$ cozy-dev deploy dist

from the root of my application (typically the root of https://github.com/Phyks/cozy-RSVP) and where dist is the place where my built files reside in my app folder.

However, I get a

path.js:7
    throw new TypeError('Path must be a string. Received ' + inspect(path));
    ^

TypeError: Path must be a string. Received null
  at assertPath (path.js:7:11)
  at Object.relative (path.js:1228:5)
  at /home/phyks/Code/cozy/cozy-dev/lib/application.js:306:39
  at /home/phyks/Code/cozy/cozy-dev/node_modules/parentpath/lib/parentpath.js:45:13
  at FSReqWrap.oncomplete (fs.js:123:15)

The app is installed in my cozy-dev VM, but gets a 404 not found whenever I try to open it.

Thanks

Phyks avatar Nov 06 '16 03:11 Phyks

Hi @Phyks ,

Cozy-dev deploy only work for server-side application.

To test client-side application, the easiest way is to use the cozy-dev client-app-proxy <url> command with an online cozy. (like cd my-app && cozy-dev client-app-proxy https://mycozy.cozycloud.cc)

Due to a bug, it unfortunately does not work with the dev VM. We will fix this soon.

Thanks, Romain

aenario avatar Nov 07 '16 09:11 aenario

@aenario Thanks for the input, however I still did not manage to get it working ='(

  • First, the doc for the deploy command states:

    deploy [slug] Push code and deploy app located in current directory to your virtualbox. Argument port correspond to port used by your application, or to the path containing your built static assets for a server-less app.

Not sure what this was supposed to mean, but it made me think I should use the command in my first post for a client app ("server-less"). I think this string should be updated if this is not the case :)

  • client-app-proxy is not available in the NPM version of cozy-dev. I cloned the repository and built it, and when starting it, I got a "Not found" in the newly opened browser window. I guess this is because my package.json is at the root of the repo but the built files (and hence the app) are under dist, and I cannot specify it where to look for those files.

If you need to have a deeper look at my app structure (maybe I missed something and it is not supposed to have this layout), it is at https://github.com/Phyks/cozy-RSVP.

  • (Related) having a link to these in https://dev.cozy.io/clientsideapp.html#create-a-client-side-application-for-cozy would be really helpful !

Thanks!

Phyks avatar Nov 07 '16 14:11 Phyks

@aenario @m4dz So, I managed to get the deploy working with a client-side app (cozy-music). The issue was that the Vagrantfile was not in one of the parent directory. I think there should be some doc on it and a more explicit error here if dir is undefined/null.

Everything seems to be working fine except the undeploy which is without any effect. I also got a bunch of "an update is available" notifications for the deployed app, but I am not sure where this is coming from.

EDIT: It seems one has to reboot the VM to get the deploy working though.

Phyks avatar Nov 07 '16 18:11 Phyks

Thanks a lot @Phyks, I dully note it for my current work on cozy-dev proxy 😉

m4dz avatar Nov 08 '16 08:11 m4dz