a year ago
How do I run code inside a node? Can it be done in the Railway UI or only through CLI?
Let's say I need to run the following code, where and how do I do it? I need to change an environment variable but don't know where to find it.
docker volume create n8n_data
docker run -it --rm \
--name n8n \
-p 5678:5678 \
-e GENERIC_TIMEZONE="Europe/Berlin" \
-e TZ="Europe/Berlin" \
-v n8n_data:/home/node/.n8n \
7 Replies
a year ago
Here are the steps you'd follow to achieve this:
1. Create a project and then open it (if you don't already have one)
2. In the project canvas, right click and click Docker Image (this will allow you to create a new service from a docker image)
3. Type n8nio/n8n and hit enter
4. A service will now show up in green, right click and add volume set to /home/node/.n8n
5. Open the service and go to the Variables tab, from there you can enter the environment variables you need to add
6. Click Deploy
My suggestion, however, would be to just use the n8n template
https://railway.com/template/0vH6fh (simple)
https://railway.com/template/r2SNX_ (more complex)
This way you only need to click a few buttons to get n8n running
a year ago
Thanks for the fast reply! Yeah, I used the second template. And now just tried adding the variable, but got the following error:
The executable "docker" could not be found.
I only added the variable in the "primary" node. There are 4 nodes in the template. Do I need to add them to all 4 or is it something else the problem?
a year ago
Did you change the start command or something? 
docker shouldn't be referenced as a command anywhere
Also, to be clear, I believe when you say node you mean service
It'd be better to call them as such otherwise you might confuse others in the future if you ever ask for more help 
a year ago
Ooh, service! Got it! Thanks.
Shouldn't I be able to set the env variable from the "variables" tab? Do I have change it only in the "primary" service or all 4 services? I tried it and it didn't work. I still got "The executable "docker" could not be found." even after just setting the env variable in the "variables" tab.
a year ago
Shouldn't I be able to set the env variable from the "variables" tab? Do I have change it only in the "primary" service or all 4 services?
I'm not sure, I don't use n8n so I can't help you there, although you might as well add it to both the workers and primary service, couldn't hurt
I still got "The executable "docker" could not be found."
I just deployed the template myself and I didn't get this error
a year ago
Oh, got it working! Thanks!
I added the variables to both but for some reason the suggested "deploy after changes" failed, then I had the idea of redeploying the last active deploy and it worked. Thanks again!
Status changed to Solved dev • about 1 year ago
