Lost workflows after upgrade

Describe the problem/error/question

I upgraded to v1.31.1 and lost my workflow and other data.

I don’t remember which version I upgraded from, but it said 12 versions behind. That makes it (almost) v1.26.0.

I did not take a backup or follow the release guide correctly. It was my first upgrade.

I used the Caddy tutorial to deploy n8n.

Information on your n8n setup

  • n8n version: 1.31.1
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Caddy / Docker
  • Operating system: Ubuntu 22.04.2 LTS

docker-compose

version: "3.7"

services:
  caddy:
    image: caddy:latest
    restart: unless-stopped
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - ${DATA_FOLDER}/caddy_data:/data
      - ${DATA_FOLDER}/caddy_config:/config
      - ${DATA_FOLDER}/caddy_config/Caddyfile:/etc/caddy/Caddyfile

  n8n:
    image: n8nio/n8n
    user: root
    restart: always
    ports:
      - 5678:5678
    environment:
      - N8N_HOST=${SUBDOMAIN}.${DOMAIN_NAME}
      - N8N_PORT=5678
      - N8N_PROTOCOL=https
      - NODE_ENV=production
      - WEBHOOK_URL=https://${SUBDOMAIN}.${DOMAIN_NAME}/
      - GENERIC_TIMEZONE=${GENERIC_TIMEZONE}
    volumes:
      - ${DATA_FOLDER}/local_files:/files
      - ${DATA_FOLDER}/.n8n:/home/node/.n8n
volumes:
  caddy_data:
    external: true
  caddy_config:

It looks like the upgrade started using new images and left the previous as is.

hello @Junaid

From the docker file, I don’t see that you have configured the separate DB instance. So when you updated the image and replaced the container (run a new one), everything, that was there, now gone.

You need to run the previous container (if it is still available) and export all workflows and credentials

For the persistent configuration, you have to use the external database and an attachable volume (that is already attached according to the configuration)

2 Likes

Hi @barn4k, thanks for the response. I had a single (but a bit long) workflow that I lost. I abandoned the hope of recovery even before your message and recreated that. Will be testing the workflow.

That being said, with the setup I have, how will I retain data for future upgrades?

I have set up a workflow that backs up all workflows to Gitub and will do manual backups before upgrades as well. What about credentials? Do I have to set those up after every upgrade?

I, personally, would not recommend backup credentials to the GitHub due to security reasons. Even the encrypted creds may be exposed if you aren’t accurate and store somewhere the encryption key. If you don’t have many workflows/creds, the easiest thing is to create manual backups or a backup workflow that will store the data on the attachable volume (e.g. /home/node/.n8n or /files)

3 Likes

Personally I use this template and after a few modifications it works very well for me.

I second @barn4k that you shouldn’t backup creds to github, even if on a private repo, but it is possible.

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.