Hi all,
I am in a dire situation.
I was trying to run my VPS a bit more efficiently, and add a Hugo website to the same docker compose / traefik combination, so they can run on the same server.
Got it working, but then, I edited something wrong, and boom, n8n went down.
Long story short I did a docker-compose prune -a and like an idiot. Pressed ENTER.
I re-pulld the latest (as I always have) and it failed. It gave an error to say it could not extract the TAR file again and again, so I focused on a specific version. I decided on image: n8nio/n8n:1.81.0. Randomly.
I then went and re-pulled images, and built, and got this kind of error:
docker-compose up --build
WARNING: Found orphan containers (n8n_hugo_1) for this project. If you removed or renamed this service in your compose file, you can run this command with the --remove-orphans flag to clean it up.
Removing n8n_traefik_1 ... done
Removing n8n_n8n_1 ... done
Network traefik is external, skipping
WARNING: Found orphan containers (n8n_hugo_1) for this project. If you removed or renamed this service in your compose file, you can run this command with the --remove-orphans flag to clean it up.
Creating n8n_traefik_1 ... done
Creating n8n_n8n_1 ... done
Attaching to n8n_n8n_1, n8n_traefik_1
n8n_1 | Invalid timestamp value for N8N_RELEASE_DATE: $(date -u +"%Y-%m-%dT%H:%M:%SZ")
n8n_1 | Permissions 0644 for n8n settings file /home/node/.n8n/config are too wide. This is ignored for now, but in the future n8n will attempt to change the permissions automatically. To automatically enforce correct permissions now set N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=true (recommended), or turn this check off set N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=false.
n8n_1 | User settings loaded from: /home/node/.n8n/config
n8n_1 | Initializing n8n process
n8n_1 | n8n ready on 0.0.0.0, port 5678
n8n_1 |
n8n_1 | There is a deprecation related to your environment variables. Please take the recommended actions to update your configuration:
n8n_1 | - N8N_RUNNERS_ENABLED -> Running n8n without task runners is deprecated. Task runners will be turned on by default in a future version. Please set `N8N_RUNNERS_ENABLED=true` to enable task runners now and avoid potential issues in the future. Learn more: https://docs.n8n.io/hosting/configuration/task-runners/
n8n_1 |
n8n_1 | Version: 1.81.0
n8n_1 | ================================
n8n_1 | Start Active Workflows:
n8n_1 | ================================
n8n_1 | SQLITE_ERROR: no such column: SharedCredentials__SharedCredentials_project__SharedCredentials__SharedCredentials_project_projectRelations__SharedCredentials__SharedCredentials_project__SharedCredentials__SharedCredentials_project_projectRelations_user.role
n8n_1 | SQLITE_ERROR: no such column: SharedCredentials__SharedCredentials_project__SharedCredentials__SharedCredentials_project_projectRelations__SharedCredentials__SharedCredentials_project__SharedCredentials__SharedCredentials_project_projectRelations_user.role
n8n_1 | => ERROR: Workflow "Workflow Name Redacted for Privacy" (ID: 1) could not be activated on first try, keep on trying if not an auth issue
n8n_1 | SQLITE_ERROR: no such column: SharedCredentials__SharedCredentials_project__SharedCredentials__SharedCredentials_project_projectRelations__SharedCredentials__SharedCredentials_project__SharedCredentials__SharedCredentials_project_projectRelations_user.role
n8n_1 | Issue on initial workflow activation try of "Workflow Name Redacted for Privacy" (ID: 1) (startup)
and on and on it goes.
I try to log in and it says
Problem logging in SQLITE_ERROR: no such column: User.role
I had an OMG moment. I deleted my database!
So I had a hunt through the system, and found these files:
βββ .n8n
βββ binaryData
βββ meta
βββ persistMeta
βββ config
βββ database.sqlite
βββ git
βββ .git
βββ branches
βββ config
βββ description
βββ HEAD
βββ hooks
βββ applypatch-msg.sample
βββ commit-msg.sample
βββ post-update.sample
βββ pre-applypatch.sample
βββ pre-commit.sample
βββ pre-merge-commit.sample
βββ prepare-commit-msg.sample
βββ pre-push.sample
βββ pre-rebase.sample
βββ pre-receive.sample
βββ push-to-checkout.sample
βββ update.sample
βββ info
βββ exclude
βββ objects
βββ info
βββ pack
βββ refs
βββ heads
βββ tags
βββ n8nEventLog-1.log
βββ n8nEventLog-2.log
βββ n8nEventLog-3.log
βββ n8nEventLog.log
βββ nodes
βββ package.json
βββ ssh
The sql database is about 100mb which is a good sign.
The files are all located at /home/username-redacted/n8n-local-files/.n8n
So, I figure, I need to point n8n at that location, to load up the data.
I change my docker-compose file to this:
version: "3"
services:
traefik:
image: "traefik"
restart: always
command:
- "--api=true"
- "--api.insecure=true"
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--entrypoints.web.address=:80"
- "--entrypoints.web.http.redirections.entryPoint.to=websecure"
- "--entrypoints.web.http.redirections.entrypoint.scheme=https"
- "--entrypoints.websecure.address=:443"
- "--certificatesresolvers.mytlschallenge.acme.tlschallenge=true"
- "--certificatesresolvers.mytlschallenge.acme.email=${SSL_EMAIL}"
- "--certificatesresolvers.mytlschallenge.acme.storage=/letsencrypt/acme.json"
ports:
- "80:80"
- "443:443"
volumes:
- ${DATA_FOLDER}/letsencrypt:/letsencrypt
- /var/run/docker.sock:/var/run/docker.sock:ro
n8n:
image: n8nio/n8n:1.81.0
restart: always
ports:
- "127.0.0.1:5678:5678"
labels:
- traefik.enable=true
- traefik.http.routers.n8n.rule=Host(`${SUBDOMAIN}.${DOMAIN_NAME}`)
- traefik.http.routers.n8n.tls=true
- traefik.http.routers.n8n.entrypoints=web,websecure
- traefik.http.routers.n8n.tls.certresolver=mytlschallenge
- traefik.http.middlewares.n8n.headers.SSLRedirect=true
- traefik.http.middlewares.n8n.headers.STSSeconds=315360000
- traefik.http.middlewares.n8n.headers.browserXSSFilter=true
- traefik.http.middlewares.n8n.headers.contentTypeNosniff=true
- traefik.http.middlewares.n8n.headers.forceSTSHeader=true
- traefik.http.middlewares.n8n.headers.SSLHost=${DOMAIN_NAME}
- traefik.http.middlewares.n8n.headers.STSIncludeSubdomains=true
- traefik.http.middlewares.n8n.headers.STSPreload=true
- traefik.http.routers.n8n.middlewares=n8n@docker
environment:
- N8N_BASIC_AUTH_ACTIVE=true
- N8N_BASIC_AUTH_USER=redacted
- N8N_BASIC_AUTH_PASSWORD=redacted
- N8N_HOST=${SUBDOMAIN}.${DOMAIN_NAME}
- N8N_PORT=5678
- N8N_PROTOCOL=https
- NODE_ENV=production
- WEBHOOK_URL=https://${SUBDOMAIN}.${DOMAIN_NAME}/
- GENERIC_TIMEZONE=${GENERIC_TIMEZONE}
- DB_MIGRATIONS_RUN_ON_STARTUP=true
volumes:
- /home/username-redacted/n8n-local-files/.n8n:/home/node/.n8n
- /home/username-redacted/n8n-local-files:/files
networks:
default:
external:
name: traefik
You can see I have the - DB_MIGRATIONS_RUN_ON_STARTUP=true added in, as I read that might help. However, no.
Now what should I do?
- I DO have my workflows backed up as .json files.
- I donβt have any of my authentications backed up.
- I donβt know what version my n8n was, so not sure if those json backups will even work.
Iβm stumped, and, Iβm an idiot for doing that.
What would you all recommend?
Thanks so much, any feedback greatly appreciated.
(running debian, docker-compose)