I can't start n8n on a fresh database

Hi @phpguru, you can for example specify a tag like 0.195.2 in your docker compose file. So instead of something like

services:
  n8n:
    container_name: n8n
    image: n8nio/n8n

you could use this:

services:
  n8n:
    container_name: n8n
    image: n8nio/n8n:0.195.4

I’ve used 0.195.4 in this example since it’s the latest version of n8n.

2 Likes

Let me give it a quick bash on Digital Ocean, I did my test with a local instance of MySQL although it looks like I have an older version so there could be something there. I suspect though if it was the connection itself it wouldn’t create the tables at all so that is a good sign.

It could be that a previous migration is failing and we are only showing an issue on that one, It does look unrelated to the issue recently fixed though.

I will be back shortly when I have tested on DO.

Alright yeah that is broken… Let me check a v8 mysql container locally and see if I can get a fix out soon for this one.

1 Like

Thanks a lot for trying on Digital Ocean.

I am using (or I was planning to use) their hosted mysql and only last night did I realize that their configuration page after you spin up a db says “ssl: required” — the thing is, I’m able to connect no problem with a regular mysql prompt and some tables got created via n8n startup routine, so I think that ssl required for mysql is just wrong. Kind of shocking but ok great - works in my favor I guess.

I checked and there’s no lower version of mysql to use unless I use a droplet and manage the db myself, which I am open to do but would prefer not to.

The other thing I noticed was for mysql configuration, n8n offers no environment variables for ssl configuration.

I looked into postgres like I mentioned, but when you create a managed db in digital ocean, they only offer the ca-certificate.crt to be downloaded, so I had no clue what to do with the other two ssl config params (the cert and the key).

I would love to be able to set up droplets for master and workers and use their managed service for mysql and Redis, but as you’ve discovered, it’s broken, so I really appreciate you going the extra mile to verify it on digital ocean and mysql 8.

Hey @phpguru,

That is the tricky bit at the moment we just don’t have the support for SSL / TLS with MySQL, I will have quick look and see if we have a PR opened for this that I can do a review on. With Postgres you might not need the certificate it depends on what the digital ocean cert contains, It could be a CA certificate for the connection so it is trusted I would need to clear some time to have a look at that.

Afternoon @phpguru,

Thought I would give you a quick update, I have set up MySQL 8.0.30 which is the latest version available on Dockerhub and on a new database it is working as expected so the good news is I don’t think the issue is directly with MySQL v8 and it is more than likely a config thing.

I will do some more testing over the weekend if I get a chance to see if I can work out what is different so we can get to the bottom of this one.

1 Like

I could try it on four droplets for now - I’m thinking the issue is trying to use Digital Oceans’s managed MySQL, but I don’t know why DO says it requires an SSL connection. I’d have to research how to do it.

If I wanted to try Postgres can you explain how the keys work?

I’m about half way to understanding how to do it on K8s. There’s one GitHub repo (that doesn’t seem to be affiliated with N8N) I saw that has a sample helm chart but I still need to grok parts of it. Seems so much easier. I thought I saw Traefik being used in one of the n8n versions I tried, but caddy is what I got now. Am I crazy? Ultimately that seems like the easier way to run it because of how easy it is to request more pods. How does N8N queue mode worker autoscaling work in K8s?

I can almost confirm that N8N in queue mode works fine when installed on 4 Digital Ocean droplets.

  • Ubuntu 20
  • MySQL 8
  • Redis 6
  • N8N Master
  • N8N Worker

I used the n8n-digital-ocean repo with caddy.

It would be really helpful to have a post or page on the docs about how to test queue mode - or just answer in this thread. In general, I am assuming I would need to create a workflow, then use Postman to fire off some POSTs to trigger the workflow, then watch the worker logs, check Redis for data and such. I’m a sysadmin & solution architect, but not very familiar with N8N. Some type of guide on how to verify that N8N Queue Mode is working properly would be really helpful, because it seems to be, but I’m not sure how to verify it.

Thanks for all your help! Digital Ocean hosted MySQL does NOT work!

Okay from what I can tell all the configs are correct, but N8N cannot use queue mode. Here is what I am getting.

On the Master

To run the master I am just doing

cd ~/n8n-digital-ocean
docker compose up -d

Here is the n8n stanza of docker-compose.yml

  n8n:
    container_name: n8n
    image: n8nio/n8n
    restart: always
    ports:
      - 5678:5678
    environment:
     - EXECUTIONS_PROCESS=${EXECUTIONS_PROCESS}
     - EXECUTIONS_MODE=${EXECUTIONS_MODE}
     - EXECUTIONS_TIMEOUT=${EXECUTIONS_TIMEOUT}
     - EXECUTIONS_DATA_PRUNE=${EXECUTIONS_DATA_PRUNE}
     - EXECUTIONS_DATA_MAX_AGE=${EXECUTIONS_DATA_MAX_AGE}
     - QUEUE_BULL_REDIS_HOST=${QUEUE_BULL_REDIS_HOST}
     - QUEUE_BULL_REDIS_PORT=${QUEUE_BULL_REDIS_PORT}
     - DB_TYPE=${DB_TYPE}
     - DB_MYSQLDB_DATABASE=${DB_MYSQLDB_DATABASE}
     - DB_MYSQLDB_HOST=${DB_MYSQLDB_HOST}
     - DB_MYSQLDB_PORT=${DB_MYSQLDB_PORT}
     - DB_MYSQLDB_USER=${DB_MYSQLDB_USER}
     - DB_MYSQLDB_PASSWORD=${DB_MYSQLDB_PASSWORD}
     - N8N_BASIC_AUTH_ACTIVE=${N8N_BASIC_AUTH_ACTIVE}
     - N8N_BASIC_AUTH_USER=${N8N_BASIC_AUTH_USER}
     - N8N_BASIC_AUTH_PASSWORD=${N8N_BASIC_AUTH_PASSWORD}
     - N8N_HOST=${N8N_HOST}
     - N8N_PORT=${N8N_PORT}
     - N8N_PROTOCOL=${N8N_PROTOCOL}
     - NODE_ENV=${NODE_ENV}
     - WEBHOOK_URL=${WEBHOOK_URL}
     - GENERIC_TIMEZONE=${GENERIC_TIMEZONE}
     - N8N_ENCRYPTION_KEY=${N8N_ENCRYPTION_KEY}
     - N8N_EMAIL_MODE=${N8N_EMAIL_MODE}
     - N8N_SMTP_HOST=${N8N_SMTP_HOST}
     - N8N_SMTP_PORT=${N8N_SMTP_PORT}
     - N8N_SMTP_USER=${N8N_SMTP_USER}
     - N8N_SMPT_PASS=${N8N_SMPT_PASS}
     - N8N_SMTP_SENDER=${N8N_SMTP_SENDER}
     - N8N_SMTP_SSL=${N8N_SMTP_SSL}
    volumes:
      - ${DATA_FOLDER}/.n8n:/home/node/.n8n
      - ${DATA_FOLDER}/local_files:/files```

master logs

root@n8n-master:~/n8n-digital-ocean# docker logs n8n
Initializing n8n process
n8n ready on 0.0.0.0, port 5678
Version: 0.195.5

Editor is now accessible via:
https://trove.agency:5678/
Owner was set up successfully
User survey updated successfully
Started with job ID: 1 (Execution ID: 2)
Problem with execution 2: Unable to find data of execution "2" in database. Aborting execution.. Aborting.
Started with job ID: 2 (Execution ID: 3)
Problem with execution 3: Unable to find data of execution "3" in database. Aborting execution.. Aborting.
Started with job ID: 3 (Execution ID: 4)
Problem with execution 4: Unable to find data of execution "4" in database. Aborting execution.. Aborting.
Started with job ID: 4 (Execution ID: 5)
Problem with execution 5: Unable to find data of execution "5" in database. Aborting execution.. Aborting.
Started with job ID: 5 (Execution ID: 6)
Problem with execution 6: Unable to find data of execution "6" in database. Aborting execution.. Aborting.
Started with job ID: 6 (Execution ID: 7)
Problem with execution 7: Unable to find data of execution "7" in database. Aborting execution.. Aborting.
Started with job ID: 7 (Execution ID: 8)
Problem with execution 8: Unable to find data of execution "8" in database. Aborting execution.. Aborting.
Started with job ID: 8 (Execution ID: 9)
Problem with execution 9: Unable to find data of execution "9" in database. Aborting execution.. Aborting.
Started with job ID: 9 (Execution ID: 10)
Problem with execution 10: Unable to find data of execution "10" in database. Aborting execution.. Aborting.
Started with job ID: 10 (Execution ID: 11)
Problem with execution 11: Unable to find data of execution "11" in database. Aborting execution.. Aborting.
Started with job ID: 11 (Execution ID: 12)
Problem with execution 12: Unable to find data of execution "12" in database. Aborting execution.. Aborting.
Started with job ID: 12 (Execution ID: 13)
Problem with execution 13: Unable to find data of execution "13" in database. Aborting execution.. Aborting.
Started with job ID: 13 (Execution ID: 14)
Problem with execution 14: Unable to find data of execution "14" in database. Aborting execution.. Aborting.
Initializing n8n process
n8n ready on 0.0.0.0, port 5678
Version: 0.195.5

Editor is now accessible via:
https://trove.agency:5678/
The session "huesukui3tb" is not registered.
The session "huesukui3tb" is not registered.
The session "huesukui3tb" is not registered.
The session "huesukui3tb" is not registered.
The session "huesukui3tb" is not registered.
The session "huesukui3tb" is not registered.
The session "huesukui3tb" is not registered.

.


On the Worker

On the worker I am doing this to run it

docker run \
    --detach \
    --name n8n-queue \
    -e QUEUE_BULL_REDIS_HOST=${QUEUE_BULL_REDIS_HOST} \
    -p 5679:5678 \
    n8nio/n8n n8n worker

worker logs

root@n8n-worker:~# docker logs n8n-queue
Starting n8n worker...
UserSettings were generated and saved to: /home/node/.n8n/config
Migrations in progress, please do NOT stop the process.
query is slow: CREATE TABLE IF NOT EXISTS "credentials_entity" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(128) NOT NULL, "data" text NOT NULL, "type" varchar(128) NOT NULL, "nodesAccess" text NOT NULL, "createdAt" datetime NOT NULL, "updatedAt" datetime NOT NULL)
execution time: 4614

n8n worker is now ready
 * Version: 0.195.5
 * Concurrency: 10

Migrations finished.
Worker failed to find data of execution "2" in database. Cannot continue.
Worker failed to find data of execution "3" in database. Cannot continue.
Worker failed to find data of execution "4" in database. Cannot continue.
Worker failed to find data of execution "5" in database. Cannot continue.
Worker failed to find data of execution "6" in database. Cannot continue.
Worker failed to find data of execution "7" in database. Cannot continue.
Worker failed to find data of execution "8" in database. Cannot continue.
Worker failed to find data of execution "9" in database. Cannot continue.
Worker failed to find data of execution "10" in database. Cannot continue.
Worker failed to find data of execution "11" in database. Cannot continue.
Worker failed to find data of execution "12" in database. Cannot continue.
Worker failed to find data of execution "13" in database. Cannot continue.
Worker failed to find data of execution "14" in database. Cannot continue.

On Redis

root@n8n-master:~/n8n-digital-ocean# redis-cli -h <INTERNAL IP IN VPC>
<INTERNAL IP IN VPC>:6379> KEYS *
1) "bull:jobs:id"
<INTERNAL IP IN VPC>:6379> GET bull:jobs:id
"13"
<INTERNAL IP IN VPC>:6379> exit

Hey @phpguru,

The worker nodes also need to access the database to be able to load the workflows and save the execution data, It looks like you are only passing in the redis host so it won’t know about any of the otehr bits it is meant to be doing.

1 Like

After I posted my configs yesterday I just stared at my config and decided that the worker probably needed the db connection too and got it working!

It was glorious.

[SOLVED]

I have more questions but I’ll start a new thread or two. Thanks for all your help.

2 Likes

Hey @phpguru, @Jon

Has anyone found any solution to this problem with the Digital Ocean hosted MySQL database?
Having the same issue with DO hosted MySQL database.

Thanks in advanced

DO’s MySQL version is too new. I had to install my own MySQL 5.7 on a droplet.

1 Like

Thanks for the reply @phpguru. But the thing is um tested it with lates mysql docker container and all work fine. That seem strange. Just as you mentioned it create some tables on the database as well. (That implies no problem with connecting to the DB)

@Jon Any thoughts?

It’s been awhile so maybe it wasn’t the MySQL version but the DO-managed MySQL requires a connection encrypted by TLS whcih N8N doesn’t do yet?

I was not able to use the DO-managed MySQL, was my main point. I just created my own droplet (even though I would’ve much preferred to use the managed service) because my assignment was time sensitive.

Glad to hear that you found a solution. But as mentioned here I would strongly recommend to use Postgres instead of MySQL:

Hey @jan
Do u have any insight about what the reason it’s not working with Digital Ocean Managed MySQL? I’ve tested it with latest MySQL docker container and it was working fine.
Since it’s creating some tables on the DB seems the connection also fine. What is wrong with migrations?
image

Um really eager to hear your thoughts : ) Thanks in advanced!

Sorry, do sadly have no idea. Honestly do not have any deep knowledge about MySQL and even less about the managed version of Digital Ocean. So can sadly not be of any help here except my above recommendation not to use it.

1 Like

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