Commit graph

34 commits

Author SHA1 Message Date
Iván Ovejero 76ab780cdd
refactor(core): Remove dead orchestration code (#11266) 2024-10-15 16:47:31 +02:00
Iván Ovejero 05467fd101
refactor(core): Move queueModeId as hostId to InstanceSettings (#11262) 2024-10-15 14:55:13 +02:00
Val ecbe568d69
feat: Enable Task Runners on Scaling mode Workers (no-changelog) (#11253) 2024-10-15 11:03:28 +01:00
Iván Ovejero c0aa28c6cf
fix(core): Override executions mode if regular during worker startup (#11250) 2024-10-14 16:12:41 +02:00
Iván Ovejero 0820cb5ab9
refactor(core): Simplify main pubsub message handler (#11156) 2024-10-11 10:31:33 +02:00
Iván Ovejero 383b4765d2
refactor(core): Simplify worker pubsub message handler (#11086) 2024-10-07 16:19:58 +02:00
Iván Ovejero d537cea363
test(core): Allow Jest to exit cleanly in worker command test (#11095) 2024-10-04 14:44:53 +02:00
Iván Ovejero 63e6f1fa38
refactor(core): Organize all event maps (#10997) 2024-09-30 10:44:03 +02:00
Iván Ovejero a6e1064985
test(core): Fix license mock in worker test (#10824) 2024-09-17 08:47:03 +02:00
कारतोफ्फेलस्क्रिप्ट™ 25c8a328a8
refactor(core): Move instanceType to InstanceSettings (no-changelog) (#10640)
Some checks are pending
Test Master / install-and-build (push) Waiting to run
Test Master / Unit tests (18.x) (push) Blocked by required conditions
Test Master / Unit tests (20.x) (push) Blocked by required conditions
Test Master / Unit tests (22.4) (push) Blocked by required conditions
Test Master / Lint (push) Blocked by required conditions
Test Master / Notify Slack on failure (push) Blocked by required conditions
Benchmark Docker Image CI / build (push) Waiting to run
2024-09-16 13:37:14 +02:00
Tomi Turtiainen 5156313074
refactor(core): Enable import/order eslint rule (#10794)
Some checks are pending
Test Master / install-and-build (push) Waiting to run
Test Master / Unit tests (18.x) (push) Blocked by required conditions
Test Master / Unit tests (20.x) (push) Blocked by required conditions
Test Master / Unit tests (22.4) (push) Blocked by required conditions
Test Master / Lint (push) Blocked by required conditions
Test Master / Notify Slack on failure (push) Blocked by required conditions
Benchmark Docker Image CI / build (push) Waiting to run
2024-09-12 19:07:18 +03:00
Iván Ovejero d7241cfc3a
refactor(core): Standardize filename casing for services and Public API (no-changelog) (#10579) 2024-08-28 13:59:27 +02:00
Iván Ovejero 96e69ad5f2
refactor(core): Standardize filename casing for environments and eventbus (no-changelog) (#10527)
Some checks are pending
Test Master / install-and-build (push) Waiting to run
Test Master / Unit tests (18.x) (push) Blocked by required conditions
Test Master / Unit tests (20.x) (push) Blocked by required conditions
Test Master / Unit tests (22.4) (push) Blocked by required conditions
Test Master / Lint (push) Blocked by required conditions
Test Master / Notify Slack on failure (push) Blocked by required conditions
2024-08-26 11:10:06 +02:00
Iván Ovejero f667b384c9
refactor(core): Standardize filenames in cli (no-changelog) (#10484)
Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
2024-08-22 11:10:37 +02:00
Iván Ovejero 6b52bebf52
refactor(core): Tear down internal hooks (no-changelog) (#10340) 2024-08-12 10:13:15 +02:00
Iván Ovejero e31d017bdd
refactor(core): Centralize scaling mode (no-changelog) (#9835) 2024-08-07 13:50:46 +02:00
Iván Ovejero aa0a470dce
refactor(core): Clean up event relays (no-changelog) (#10284) 2024-08-02 16:52:49 +02:00
Iván Ovejero 7c53433191
fix(core): Fix worker logs relay (#9919) 2024-07-03 10:29:25 +02:00
कारतोफ्फेलस्क्रिप्ट™ 2d02c73fbd
refactor(core): Refactor cli command tests (no-changelog) (#9731) 2024-06-18 10:50:39 +02:00
Iván Ovejero aaa78435b0
refactor(core): Remove event bus channel (no-changelog) (#9663) 2024-06-11 10:02:23 +02:00
कारतोफ्फेलस्क्रिप्ट™ 596990bed7
ci: Fix vulnerable dev dependencies (no-changelog) (#9545) 2024-05-30 13:54:29 +02:00
कारतोफ्फेलस्क्रिप्ट™ d6deceacde
refactor(core): Remove roleId indirection (no-changelog) (#8413) 2024-01-24 13:38:57 +01:00
कारतोफ्फेलस्क्रिप्ट™ 913c8c6b0c
feat(core): Upgrade oclif (no-changelog) (#8381) 2024-01-22 18:25:36 +01:00
Iván Ovejero f35d4fcbd8
refactor(core): Simplify OrchestrationService (no-changelog) (#8364) 2024-01-22 11:16:29 +01:00
Iván Ovejero f53c482939
perf(core): Improve caching service (#8213)
Story: https://linear.app/n8n/issue/PAY-1188

- Implement Redis hashes on the caching service, based on Micha's work
in #7747, adapted from `node-cache-manager-ioredis-yet`. Optimize
workflow ownership lookups and manual webhook lookups with Redis hashes.
- Simplify the caching service by removing all currently unused methods
and options: `enable`, `disable`, `getCache`, `keys`, `keyValues`,
`refreshFunctionEach`, `refreshFunctionMany`, `refreshTtl`, etc.
- Remove the flag `N8N_CACHE_ENABLED`. Currently some features on
`master` are broken with caching disabled, and test webhooks now rely
entirely on caching, for multi-main setup support. We originally
introduced this flag to protect against excessive memory usage, but
total cache usage is low enough that we decided to drop this setting.
Apparently this flag was also never documented.
- Overall caching service refactor: use generics, reduce branching, add
discriminants for cache kinds for better type safety, type caching
events, improve readability, remove outdated docs, etc. Also refactor
and expand caching service tests.

Follow-up to: https://github.com/n8n-io/n8n/pull/8176

---------

Co-authored-by: Michael Auerswald <michael.auerswald@gmail.com>
2024-01-05 11:52:44 +01:00
Iván Ovejero 53c0b49d15
fix(core): Initialize queue once in queue mode (#8025)
We're initializing the queue twice because of a [bad
merge](2c63474538).
No associated known bugs but no need to init the queue twice. We should
follow up by investigating if any pending bugs can be associated to
this.
2023-12-14 16:16:12 +01:00
Iván Ovejero 4c4082503c
feat(core): Coordinate manual workflow activation and deactivation in multi-main scenario (#7643)
Followup to #7566 | Story: https://linear.app/n8n/issue/PAY-926

### Manual workflow activation and deactivation

In a multi-main scenario, if the user manually activates or deactivates
a workflow, the process (whether leader or follower) that handles the
PATCH request and updates its internal state should send a message into
the command channel, so that all other main processes update their
internal state accordingly:

- Add to `ActiveWorkflows` if activating
- Remove from `ActiveWorkflows` if deactivating
- Remove and re-add to `ActiveWorkflows` if the update did not change
activation status.

After updating their internal state, if activating or deactivating, the
recipient main processes should push a message to all connected
frontends so that these can update their stores and so reflect the value
in the UI.

### Workflow activation errors

On failure to activate a workflow, the main instance should record the
error in Redis - main instances should always pull activation errors
from Redis in a multi-main scenario.

### Leadership change

On leadership change...

- The old leader should stop pruning and the new leader should start
pruning.
- The old leader should remove trigger- and poller-based workflows and
the new leader should add them.
2023-11-17 15:58:50 +01:00
कारतोफ्फेलस्क्रिप्ट™ 000e76e3b4
ci(core): Reduce memory usage in tests (part-2) (no-changelog) (#7671)
This also gets rid of `Db.collection`, which was another source of
circular dependencies.
2023-11-10 15:04:26 +01:00
कारतोफ्फेलस्क्रिप्ट™ 05586a900d
refactor(core): Make Logger a service (no-changelog) (#7494) 2023-10-25 16:35:22 +02:00
Michael Auerswald afa683a06f
refactor(core): Have one orchestration service per instance type (#7303)
webhook instances will not listen to either worker or event log messages
on the Redis pub/sub channel
2023-10-06 13:58:11 +02:00
Iván Ovejero 1a661e6d00
feat(core): Integrate object store as binary data manager (#7253)
Depends on: #7225 | Story:
[PAY-848](https://linear.app/n8n/issue/PAY-848)

This PR integrates the object store service as a new binary data manager
for Enterprise.
2023-10-05 15:25:17 +02:00
Michael Auerswald 4b014286cf
fix(core): Make senderId required for all command messages (#7252)
all commands sent between main instance and workers need to contain a
server id to prevent senders from reacting to their own messages,
causing loops

this PR makes sure all sent messages contain a sender id by default as
part of constructing a sending redis client.

---------

Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
2023-09-26 13:58:06 +02:00
Iván Ovejero 6d6e2488c6
refactor(core): Generalize binary data manager interface (no-changelog) (#7164)
Depends on: #7092 | Story:
[PAY-768](https://linear.app/n8n/issue/PAY-768)

This PR: 
- Generalizes the `IBinaryDataManager` interface.
- Adjusts `Filesystem.ts` to satisfy the interface.
- Sets up an S3 client stub to be filled in in the next PR.
- Turns `BinaryDataManager` into an injectable service.
- Adjusts the config schema and adds new validators.

Note that the PR looks large but all the main changes are in
`packages/core/src/binaryData`.

Out of scope:
- `BinaryDataManager` (now `BinaryDataService`) and `Filesystem.ts` (now
`fs.client.ts`) were slightly refactored for maintainability, but fully
overhauling them is **not** the focus of this PR, which is meant to
clear the way for the S3 implementation. Future improvements for these
two should include setting up a backwards-compatible dir structure that
makes it easier to locate binary data files to delete, removing
duplication, simplifying cloning methods, using integers for binary data
size instead of `prettyBytes()`, writing tests for existing binary data
logic, etc.

---------

Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
2023-09-22 17:22:12 +02:00
Michael Auerswald 7b49cf2a2c
feat(core): Add commands to workers to respond with current state (#7029)
This PR adds new endpoints to the REST API:
`/orchestration/worker/status` and `/orchestration/worker/id`

Currently these just trigger the return of status / ids from the workers
via the redis back channel, this still needs to be handled and passed
through to the frontend.

It also adds the eventbus to each worker, and triggers a reload of those
eventbus instances when the configuration changes on the main instances.
2023-09-07 14:44:19 +02:00