I am attempting to do something which may not be possible, but I thought I would ask. I am self-hosting n8n via docker and am building a workflow that when triggered by a webhook would execute a ‘git pull’ command on my server (whether that be localhost or my production server) in order to pull fresh copies of all workflows into n8n. It will be a selective pull - I’ll modify git and the command if/when I figure out how to successfully run ANY command
My initial thought is to do this with the Execute Command node. What I’m failing to grasp is how to mount a volume in my docker-compose.yml file that would make my project directory visible to the command. In my n8n service config I’ve added a volume (found this on Stack Overflow) but I don’t know if it’s close or not to the right answer:
volumes:
- ./var/run/docker.sock:/var/run/docker.sock
Here is just a current draft of the experiment.
When I change the command to ls, I get something as follows, which makes sense as it is the root level of the n8n container.
So I guess what I am asking is is there a way to allow the command node to reach into the root of my local development folder where the docker-compose.yml file resides so that I can pull from git?
If this is not possible/advisable, I was then thinking about running an SSH node instead. I can see how this would work in my production environment, but I don’t understand how/if it could work on my local developer instance on Docker in Windows.
Any ideas/suggestions would be welcome. Thank you!
Information on your n8n setup
- n8n version: 0.221.2
- Database (default: SQLite): SQLite
- n8n EXECUTIONS_PROCESS setting (default: own, main): own
- Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
- Operating system: Windows 11