joaomgcd / node-red-contrib-join-joaoapps

Node-Red nodes for Join by JoaoApps
37 stars 5 forks source link

join-server unable to create local storage (NodeRed via Docker) #10

Open jasonalsing opened 5 years ago

jasonalsing commented 5 years ago

I have node-red installed via Docker and my data directory is configured to use host volume. eg:

node-red:
    container_name: node-red
    restart: always
    image: nodered/node-red-docker
    user: ${PUID}
    volumes:
      - ${USERDIR}/docker/node-red:/data

When I install the join module via the palette, the "Join Server" component creates a EEACCES: permission denied, mkdir('/usr/src/node-red') line 11

but all the node files are downloaded where there supposed to be in {USERDIR}/docker/node-red which is mounted via /data in the container.

I see in join-server.js line 11 it attempts to create the directory via the localStorage node(?) which is downloaded as part of the join package.

var localStorage = new LocalStorage('./joinserver');

I think it's trying to create this in the wrong location. It should not be in /usr/src/node-red, it should be in the data directory of course. If I change the entry in join-server.js to:

var localStorage = new LocalStorage("/data/node_modules/node-red-contrib-join-joaoapps/joinserver");

And restart node-red all the components load and I can configure the Join Server in Node-Red.

joaomgcd commented 5 years ago

Thanks for the report! But then that would make it not work on Windows devices, right?

ctechols commented 5 years ago

I'm not a node-red developer, but it looks like there is a RED.settings.userDir property that points to a safe place for modules to write data.

https://nodered.org/blog/2015/02/25/changing-where-node-red-stores-data

The only docs I can find for it are buried in this github issue: https://github.com/node-red/node-red/issues/1543