I’m trying to create my own Dockerfile bundling my custom-built nodes into the image following the npm link tutorial I found. Locally, it works. But when I deploy it, binding a volume to N8N_USER_FOLDER it seems like there’s issues with the symlinks and volumes. And since the /nodes folder to execute the npm link is there, it won’t work.
Can I change the $N8N_USER_FOLDER/nodes to another path? Or can I load the custom nodes from another path somehow?
Is there any other way of doing this?
I’m aware of the `N8N_CUSTOM_EXTENSIONS, but the problems is that using it the prefix of all your nodes is “CUSTOM” always, so I can’t import my existing, locally developed flows. If there’s a way to change this, I’m also fine.
I would try copying the node folder into nodes/node_name and maybe updating the package.json as well so it knows it is there and see if that works.
The other option would be to create your own n8n fork and add your nodes directly to n8n, Unless you plan to publish the nodes to npm then it becomes easier.
TLDR:Used pnpm without symlinks on the startup script, as volumes would replace anything within the image.
The problem was having symlinks (from npm or pnpm) within a mounted on a Volume of type cifs (Whichs is an NTFSv3 volume mounted on linux) with the flag noperm. That prevented all the files from having the correct user:group and were presented as nobody:nobody which renders symlinks non functional.
As I work around, I switched to pnpm with the following settings in the Dockerfile:
RUN pnpm config set node-linker hoisted
RUN pnpm config set symlink false
And then, in the startup script (ENTRYPOINT) I installed my package (instead of using link) like this:
All of this happened as I was running n8n on an Azure AppService Linux Container App using Azure FileShare for persistence. Once we scale and switch to k8s, this won’t be a problem anymore.
I leave this here with all the keywords in case anyone faces the same problem.
P.D.:@Jon It would be interesting indead to be able to save all the non-data folders to a separate location. That will prevent having a whole node_modules folder in a persisted mounted volume and backups. Surely you can mount the /.n8n and then the /.n8n/nodes folder apart but it’s harder. Also it would be interesting to write this down in the on-premise guides if it’s not there (I couldn’t find it).