8gears / n8n-helm-chart

A Kubernetes Helm chart for n8n a Workflow Automation Tool. Easily automate tasks across different services.
https://artifacthub.io/packages/helm/open-8gears/n8n
Apache License 2.0
187 stars 97 forks source link

mySQL errors on fresh install + HPA or replicas > 1 not working? #12

Closed DanPhonovation closed 1 year ago

DanPhonovation commented 3 years ago

Green lit deployment of either 112 or 120 using this helm chart, with a fresh db each time results in:

1) when saving the first flow I get:

ERROR RESPONSE
TypeError: Cannot read property 'toString' of undefined
at /usr/local/lib/node_modules/n8n/dist/src/Server.js:290:35
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async /usr/local/lib/node_modules/n8n/dist/src/ResponseHelper.js:76:26

2) aftewards, i'm unable to save anything else and get this error:

at addChunk (internal/streams/readable.js:309:12)
at readableAddChunk (internal/streams/readable.js:284:9)
at Socket.Readable.push (internal/streams/readable.js:223:10)
at TCP.onStreamRead (internal/stream_base_commons.js:188:23) {
code: 'ER_DUP_ENTRY',
errno: 1062,
sqlState: '23000',
sqlMessage: "Duplicate entry '0' for key 'PRIMARY'",
query: 'INSERT INTO `workflow_entity`(`id`, `name`, `active`, `nodes`, `connections`, `createdAt`, `updatedAt`, `settings`, `staticData`) VALUES (DEFAULT, ?, ?, ?, ?, ?, ?, ?, DEFAULT)',
parameters: [
'asdf',
0,
'[{"parameters":{},"name":"Start","type":"n8n-nodes-base.start","typeVersion":1,"position":[250,300]}]',
'{}',
2021-05-19T06:05:44.301Z,
2021-05-19T06:05:44.301Z,
'{}'
]
}

2nd issue is that: If one attempts to manually or via HPA scale above 1, or statically set the the amount of replicas to 2 in the values.yaml -

any extra containers fail with ReadWriteOnce errors - ie the storage PVC is already attached to the first pod.

Changing this to ReadWriteMany would require volumeMode: Block, when using something like CephRBD

Is scaling not functinoing here?

Vad1mo commented 3 years ago

I am not sure if n8n can be scaled, because of all the cron and trigger jobs. While on the k8s side we can do some tweaks to make it work I fear we need to check first how hwo horizontally scale n8n.

DanPhonovation commented 3 years ago

Defo possible but I u nderstand what you're saying: https://docs.n8n.io/reference/scaling-n8n.html#prerequisites

Joffcom commented 1 year ago

You can only have one main n8n instance running at a time at the moment, This may change in the future. I would also recommend moving away from MySQL and over to Postgres as we will be fully dropping MySQL support in the future.

As for the original error that is probably an old migration issue and this issue can probably be closed.