n8n/packages/core
Iván Ovejero c857e42677
feat(core): Coordinate workflow activation in multiple main scenario in internal API (#7566)
Story: https://linear.app/n8n/issue/PAY-926

This PR coordinates workflow activation on instance startup and on
leadership change in multiple main scenario in the internal API. Part 3
on manual workflow activation and deactivation will be a separate PR.

### Part 1: Instance startup

In multi-main scenario, on starting an instance...
- [x] If the instance is the leader, it should add webhooks, triggers
and pollers.
- [x] If the instance is the follower, it should not add webhooks,
triggers or pollers.
- [x] Unit tests.

### Part 2: Leadership change 

In multi-main scenario, if the main instance leader dies…

- [x] The new main instance leader must activate all trigger- and
poller-based workflows, excluding webhook-based workflows.
- [x] The old main instance leader must deactivate all trigger- and
poller-based workflows, excluding webhook-based workflows.
- [x] Unit tests.

To test, start two instances and check behavior on startup and
leadership change:

```
EXECUTIONS_MODE=queue N8N_LEADER_SELECTION_ENABLED=true N8N_LICENSE_TENANT_ID=... N8N_LICENSE_ACTIVATION_KEY=... N8N_LOG_LEVEL=debug npm run start

EXECUTIONS_MODE=queue N8N_LEADER_SELECTION_ENABLED=true N8N_LICENSE_TENANT_ID=... N8N_LICENSE_ACTIVATION_KEY=... N8N_LOG_LEVEL=debug N8N_PORT=5679 npm run start
```
2023-11-07 13:48:48 +01:00
..
bin fix(core): Reduce logging overhead for levels that do not output (#7479) 2023-10-20 18:26:33 +02:00
src feat(core): Coordinate workflow activation in multiple main scenario in internal API (#7566) 2023-11-07 13:48:48 +01:00
test refactor(core): Migrate from crypto-js to native crypto (#7556) 2023-11-03 13:26:20 +01:00
.eslintrc.js feat: Allow eslint-config to be externally consumable (#6694) 2023-07-19 09:35:10 +02:00
jest.config.js fix(core): Upgrade crypto-js to address CVE-2023-46233 (#7519) 2023-10-26 11:21:53 +02:00
LICENSE.md docs: scope Sustainable Use License to contents of the main branch (#4450) 2022-10-26 16:50:33 +02:00
LICENSE_EE.md docs(license): Introduce n8n Enterprise License (#3945) 2022-08-29 22:08:42 +02:00
package.json refactor(core): Migrate from crypto-js to native crypto (#7556) 2023-11-03 13:26:20 +01:00
README.md docs: Add proprietary license text (no-changelog) (#6038) 2023-04-20 18:49:09 +02:00
tsconfig.build.json ci: Fix typescript incremental builds (no-changelog) (#7275) 2023-09-29 13:26:06 +02:00
tsconfig.json ci: Fix typescript incremental builds (no-changelog) (#7275) 2023-09-29 13:26:06 +02:00

n8n.io - Workflow Automation

n8n-core

Core components for n8n

npm install n8n-core

License

n8n is fair-code distributed under the Sustainable Use License.

Proprietary licenses are available for enterprise customers. Get in touch

Additional information about the license can be found in the docs.