Local file trigger - Ubuntu

Describe the issue/error/question

Sorry for the noob question, however I couldnt find a definitive answer here. I would like to know the correct path for Ubuntu for local file trigger node to work, or the process to mount it in a volume that n8n can access.

I currently have a NAS network samba folder which is currently being synced to my ~/quotations folder. However I cant get the node to pick up any changes, I’m not sure whether my path is not correct or if n8n even has access to the folder?

i have tried to add volume to the docker-compose yml file at the very bottom, but again im not sure if i have put the correct path. the system shows ~/quotations but should I be doing something like /home/ubantu-dev/quotations?

What is the error message (if any)?

Just keeps running and doesnt pick up anything to trigger

Please share the workflow

Share the output returned by the last node

No output

Information on your n8n setup

  • latest version of N8n 1.86
  • default sqlite db
  • ubuntu-desktop 22.44 lts
  • runnning on a docker-compose with my own YML

Hi @Josh-Ghazi, welcome to the community!

Can you confirm how you’re mounting your host directory into your docker container?

Are you’re doing something like this (where ~/quotations is the path on your host and /home/Quotationsync is the path in your container)?

    volumes:
      - ~/quotations:/home/Quotationsync

And are you able to read from the mounted folder inside your container as expected (for example when running something like ls -lh /home/Quotationsync in the Execute Command node)?

1 Like

Thank you very much for the quick response!!!

I think you might have given me the answer. with this

volumes:
      - ~/quotations:/home/Quotationsync

I pulled the path to the directory using PWD command and i got this:

/home/ubantu-dev/Quotationsync/Quotation_ChemEX/Quotation 2022

I only need the use the “Quotation 2022” folder to do my workflow.
this is what i have in my YML which looks wrong!

volumes:
      - ~/.n8n:/home/node/.n8n
      - ~/Quotationsync/

So it looks like ive mounted the volume incorrectly, thank you so much for taking the time to answer!

I also have another noob question is that sometime i see the path as ~/directory, or home/directory or home/computername/directory. they all lead to the same directory but which one are honored by N8n?

Kindest regards
Joshua

1 Like

Ah yes, that seems like it’s a possible cause here. You can check out the exact syntax here directly in Docker’s documentation. If you specific a path only, docker would create a volume for you rather than mapping a path from your host machine.

The tilde ~ is a shorthand for your user directory on Linux and Mac OS. So if you username is ubantu-dev and your home directory is /home/ubantu-dev, you could replace that path with a shorter ~.

I also have another noob question is that sometime i see the path as ~/directory, or home/directory or home/computername/directory. they all lead to the same directory but which one are honored by N8n?

With the above in mind when n8n runs in a docker container and you have configured a volume using ~/.n8n:/home/node/.n8n, then ~/.n8n on your host machine would be /home/node/.n8n in your container.

So if you want to read /home/ubantu-dev/Quotationsync from your host machine inside your n8n docker container, you’d need to specify a volume using something like ~/Quotationsync:/home/node/Quotationsync and will then be able to read and write inside n8n using /home/node/Quotationsync.

Hope this helps!

1 Like

Oh my god, I cant thank you enough!

That is exactly what I needed,

At first i tried

volumes:
      - ~/.n8n:/home/node/.n8n
      - ~/Quotationsync:/home/Quotationsync

using the command node i was able to run (cool little trick by the way!)

ls -lh /home/Quotationsync

It would output nothing, but if the path did not exist it would return an error that there is no such file or directory. So i knew it was there and mounted but possibly didnt have the right permissions to access anytthing in the directory.

So i tried what you suggested and put it under

~/Quotationsync:/home/node/Quotationsync

And it works perfectly under the node directory!

I hope many other people who run into this issue can use this information to solve their troubles too.

really appreciate the help, i should have gone though the docker documentation first!!!

1 Like

Awesome, so glad to hear this helps!

There are many things at play here, in addition to n8n this also touches file and folder permissions combined with docker (and docker compose). So it’s rather brutal if you’re new and might not know exactly what you’re looking for :see_no_evil:

yes you are totally right, I feel like i’m learning how to walk all over again!

sorry to trouble you again, but I now have another problem

When run the ls commands it stops at ~/node/Quotationsync/Quotation_ChemEX/Quotation 2022 i can get to this folder fine (even with the space in the name by using ")after this point none of the subdirectories can be shown? do I need to set permissions in docker too? i have the permissions in the host machine set to read and write for all?

Oh, I just suggested the ls command as a quick test earlier to ensure you’re able to read from the right path.

With /home/node/Quotationsync available inside n8n, you should be able to use the Local File Trigger node for that path as expected, and it would also watch subfolders:

1 Like

Just so you know i shortened the path by mounting the folder “Quotations2022” i found it using the ls command

strange i added these files and nothing is coming up

it will just keep looking.

Now all of these folders were created by the Qsync which is a sync tool for the NAS that we have QNAP there wouldnt be anything strange or unusally about these folders that i couldnt go into the subdirectors ie. April, June, July etc?

Now all of these folders were created by the Qsync which is a sync tool for the NAS that we have QNAP there wouldnt be anything strange or unusally about these folders that i couldnt go into the subdirectors ie. April, June, July etc?

Subfolders shouldn’t be a problem, at least they weren’t when I tested this. Is there a chance you created these fields before manually executing your workflow by any chance? What happens if you copy another file while your workflow is executing?

1 Like

hmmm well ive tried a restart on the machine, the n8n boots up automatically which is nice to see.

  • I mounted 3 other directories from my home which are Qsync, Downloads, and Quotations2022
  • I see all of them there when i run the ls command in execute command node but limited (no subfolders, but when i first got it working with the long directory it would work up until it got the the Quotations 2022 folder after that nothing is picked up
  • none of the folders can pick up files copied in and out / deleted from these folders on the host machine.
  • i tried to create some files in the terminal to see if it makes any difference.

It may be that I have not mounted the directories correctly? I will try and open the docker terminal and check the mounted volumes in that terminal if they are not there it would be safe to say that i have mounted them incorrectly here is what my yml file looks like at the moment

I copied this docker compose file from the traefick and n8n bundle, but since i didnt need the reverse proxy in my application i removed the traefik parts. i hope everything looks alright

I got the Answer @MutedJam !

So I had the docker compose file inside ~/Documents folder and was running it from there, the .n8n folder mounted up fine but others wouldnt work.

So instead I put the dockerfile in a new folder that i made called ~/n8n and also put the Quotations2022 folder inside here as well, modified the YML file to mount the volume like this

- ./Quotation2022:/home/node/Quotation2022

and presto! it works very well!

the trigger is also working fine

Is there something strange about UBUNTU file directories?

Thank you for your help I couldnt have done it without you. You are a real Gem in the opensource world!

1 Like

Sweet, so glad to hear it’s now working. Tbh, I do not know if ~/Documents is treated in a special way by Ubuntu as I have never tried using it for docker containers and will definitely stay away from it now that I know about this :smiley:

Thanks so much for sharing your solution!

1 Like

No thank you! really appreciate your patience with this.

So where would be the conventional place to put these applications?? /opt or something like that?

1 Like

I think that’s a matter of personal preference. I typically just put each docker compose folder in a containers or docker folder inside my home directory.

Docker containers have their own internal directory structure, including temporary data as well as the mounted folders which are used to persist data even when the container is being re-created.

1 Like