Update n8n without loosing Flows

Hi, I am using CyberPanel. I am hosting n8n for myself in one of my subdomain. The issue I am facing is whenever there is an update I has to delete the old n8n and pull the latest version and then build the whole container a fresh.
so, all of my old data is lost every time there is an update.

I guess there is a way to update it properly that I don’t know of. I am completely noob here, as you guys already understand that.
Please help

Thank You
:slightly_smiling_face:

P.S: is there any complete guide to setup n8n in Cyber Panel properly?

Hey @Abac_Tech, welcome to the community!

I’ve never used CyberPanel I am afraid but this sounds like you don’t have a persistent volume configured for your n8n docker container. Are you running n8n via Docker on your machine running CyberPanel? If so, you might want to check how to configure volumes for your Docker containers using CyberPanel (this way you’d probably find more results compared to searching for n8n specifically).

Without using CyberPanel as an additional layer it’d be as simple as setting the -v ~/.n8n:/home/node/.n8n option from our documentation when executing the docker run command. This would make your local ~/.n8n folder available inside the container as /home/node/.n8n, meaning this folder (and all the data inside such as your workflows) will survive the container recreation that typically happens during an update.

2 Likes

hi, thank you for your reply and help.
when I set up there was an option to map volumes so I did this.

image

But today I updated and all the flows are gone.

I followed this method to update

Hey @Abac_Tech, which options did you use for the last command from your screenshot? Did you include the -v /root/n8n/.n8n:/home/node/.n8n which seems to be what you have configured in your CyberPanel screenshot? I reckon once you add this your workflows might be back :slight_smile:

There might also be more elegant ways in CyberPanel to create a new container with the latest version will keeping all volumes, but that’s a question better asked in their respective community.

Hey @Abac_Tech,

It is also worth adding… Does the user running the container from CyberPanel have access to the /root directory on the server? It could just be that docker doesn’t have access to the root home directory so ignores it and keeps it internal.

You could test this by logging into the Cyberpanel box and check what user is running the container then su to that user and see if you can touch a file in /root.

1 Like

Hi @MutedJam I tried to look into these folders “/root/n8n/.n8n:/home/node/.n8n” with filezilla but both of the directories are empty.

image

and,

image

Hi @Jon actually I am the only user here, and I am using it as a root user. and in my cyber panel there’s also only 1 user that’s me and it’s root user if I am not wrong.

Hey @Abac_Tech,

Is docker / cyber panel running as root as well? Normally you would run services as a system user rather than root so it is always worth checking that it isn’t using say a docker user for docker and www-data or similar for cyber panel.

Hi @Jon Yes it’s also running as root.

these are the two line inside Container Processes

UID CMD
root tini -- /docker-entrypoint.sh
cyberpa+ node /usr/local/bin/n8n

Hey @Abac_Tech,

Inside the container shouldn’t matter it is outside of the containers on the OS itself. If you look at that second one for the node process though it isn’t root it is cyberpa+ which I suspect is the OS user running the container.

Can you check on the actual OS to see what user is running docker, if it is cyberpanel you will need to change the OS folder to one that the user can access.

Hey @Jon,
Can you please tell me, how to do that?

Hey @Abac_Tech,

Normally it would be a case of running the ps command to find out but the docker process itself should run under root but I am thinking the command to actually launch the container was done as a cyberpanel user so it might be worth starting with a cat /etc/passwd | grep cyber

When you installed Cyberpanel did you just run the script they provide? I can set aside some time to give it a go.

Hi, bro!
Do you send me a link, for instalation n8n on cyberpanel?