chore: Bump license-sdk to v2.16.1 (no-changelog) (#13351)

Co-authored-by: Tomi Turtiainen <10324676+tomi@users.noreply.github.com>
This commit is contained in:
Cornelius Suermann 2025-02-19 15:56:30 +01:00 committed by GitHub
parent c3dc66ee73
commit daa1fe9386
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 59 additions and 37 deletions

View file

@ -97,7 +97,7 @@
"@n8n/task-runner": "workspace:*", "@n8n/task-runner": "workspace:*",
"@n8n/typeorm": "0.3.20-12", "@n8n/typeorm": "0.3.20-12",
"@n8n_io/ai-assistant-sdk": "1.13.0", "@n8n_io/ai-assistant-sdk": "1.13.0",
"@n8n_io/license-sdk": "2.16.0", "@n8n_io/license-sdk": "2.16.1",
"@oclif/core": "4.0.7", "@oclif/core": "4.0.7",
"@rudderstack/rudder-sdk-node": "2.0.9", "@rudderstack/rudder-sdk-node": "2.0.9",
"@sentry/node": "catalog:", "@sentry/node": "catalog:",

View file

@ -103,6 +103,11 @@ export class License {
}); });
await this.manager.initialize(); await this.manager.initialize();
const features = this.manager.getFeatures();
this.checkIsLicensedForMultiMain(features);
this.checkIsLicensedForBinaryDataS3(features);
this.logger.debug('License initialized'); this.logger.debug('License initialized');
} catch (error: unknown) { } catch (error: unknown) {
if (error instanceof Error) { if (error instanceof Error) {
@ -129,44 +134,20 @@ export class License {
async onFeatureChange(_features: TFeatures): Promise<void> { async onFeatureChange(_features: TFeatures): Promise<void> {
this.logger.debug('License feature change detected', _features); this.logger.debug('License feature change detected', _features);
if (config.getEnv('executions.mode') === 'queue' && this.globalConfig.multiMainSetup.enabled) { this.checkIsLicensedForMultiMain(_features);
const isMultiMainLicensed = this.checkIsLicensedForBinaryDataS3(_features);
(_features[LICENSE_FEATURES.MULTIPLE_MAIN_INSTANCES] as boolean | undefined) ?? false;
this.instanceSettings.setMultiMainLicensed(isMultiMainLicensed); if (this.instanceSettings.isMultiMain && !this.instanceSettings.isLeader) {
this.logger
if (this.instanceSettings.isMultiMain && !this.instanceSettings.isLeader) { .scoped(['scaling', 'multi-main-setup', 'license'])
this.logger .debug('Instance is not leader, skipping sending of "reload-license" command...');
.scoped(['scaling', 'multi-main-setup', 'license']) return;
.debug('Instance is not leader, skipping sending of "reload-license" command...');
return;
}
if (this.globalConfig.multiMainSetup.enabled && !isMultiMainLicensed) {
this.logger
.scoped(['scaling', 'multi-main-setup', 'license'])
.debug(
'License changed with no support for multi-main setup - no new followers will be allowed to init. To restore multi-main setup, please upgrade to a license that supports this feature.',
);
}
} }
if (config.getEnv('executions.mode') === 'queue') { if (config.getEnv('executions.mode') === 'queue') {
const { Publisher } = await import('@/scaling/pubsub/publisher.service'); const { Publisher } = await import('@/scaling/pubsub/publisher.service');
await Container.get(Publisher).publishCommand({ command: 'reload-license' }); await Container.get(Publisher).publishCommand({ command: 'reload-license' });
} }
const isS3Selected = config.getEnv('binaryDataManager.mode') === 's3';
const isS3Available = config.getEnv('binaryDataManager.availableModes').includes('s3');
const isS3Licensed = _features['feat:binaryDataS3'];
if (isS3Selected && isS3Available && !isS3Licensed) {
this.logger.debug(
'License changed with no support for external storage - blocking writes on object store. To restore writes, please upgrade to a license that supports this feature.',
);
Container.get(ObjectStoreService).setReadonly(true);
}
} }
async saveCertStr(value: TLicenseBlock): Promise<void> { async saveCertStr(value: TLicenseBlock): Promise<void> {
@ -407,4 +388,45 @@ export class License {
await this.init({ forceRecreate: true }); await this.init({ forceRecreate: true });
this.logger.debug('License reinitialized'); this.logger.debug('License reinitialized');
} }
/**
* Ensures that the instance is licensed for multi-main setup if multi-main mode is enabled
*/
private checkIsLicensedForMultiMain(features: TFeatures) {
const isMultiMainEnabled =
config.getEnv('executions.mode') === 'queue' && this.globalConfig.multiMainSetup.enabled;
if (!isMultiMainEnabled) {
return;
}
const isMultiMainLicensed =
(features[LICENSE_FEATURES.MULTIPLE_MAIN_INSTANCES] as boolean | undefined) ?? false;
this.instanceSettings.setMultiMainLicensed(isMultiMainLicensed);
if (!isMultiMainLicensed) {
this.logger
.scoped(['scaling', 'multi-main-setup', 'license'])
.debug(
'License changed with no support for multi-main setup - no new followers will be allowed to init. To restore multi-main setup, please upgrade to a license that supports this feature.',
);
}
}
/**
* Ensures that the instance is licensed for binary data S3 if S3 is selected and available
*/
private checkIsLicensedForBinaryDataS3(features: TFeatures) {
const isS3Selected = config.getEnv('binaryDataManager.mode') === 's3';
const isS3Available = config.getEnv('binaryDataManager.availableModes').includes('s3');
const isS3Licensed = features['feat:binaryDataS3'];
if (isS3Selected && isS3Available && !isS3Licensed) {
this.logger.debug(
'License changed with no support for external storage - blocking writes on object store. To restore writes, please upgrade to a license that supports this feature.',
);
Container.get(ObjectStoreService).setReadonly(true);
}
}
} }

View file

@ -824,8 +824,8 @@ importers:
specifier: 1.13.0 specifier: 1.13.0
version: 1.13.0 version: 1.13.0
'@n8n_io/license-sdk': '@n8n_io/license-sdk':
specifier: 2.16.0 specifier: 2.16.1
version: 2.16.0 version: 2.16.1
'@oclif/core': '@oclif/core':
specifier: 4.0.7 specifier: 4.0.7
version: 4.0.7 version: 4.0.7
@ -4564,8 +4564,8 @@ packages:
resolution: {integrity: sha512-16kftFTeX3/lBinHJaBK0OL1lB4FpPaUoHX4h25AkvgHvmjUHpWNY2ZtKos0rY89+pkzDsNxMZqSUkeKU45iRg==} resolution: {integrity: sha512-16kftFTeX3/lBinHJaBK0OL1lB4FpPaUoHX4h25AkvgHvmjUHpWNY2ZtKos0rY89+pkzDsNxMZqSUkeKU45iRg==}
engines: {node: '>=20.15', pnpm: '>=8.14'} engines: {node: '>=20.15', pnpm: '>=8.14'}
'@n8n_io/license-sdk@2.16.0': '@n8n_io/license-sdk@2.16.1':
resolution: {integrity: sha512-MVBqCkapJUX1rWhAXzGnfqOFaqzr0MT2X3ZTuA1BOyypb0doiuG9eh2ABy67Py4QKXGu+gnBAXZYGwG29bay+w==} resolution: {integrity: sha512-J3zsSzu0JftKAsLnxeKtprKkNSWpfNNMy7kUGkBgEsd6R7kJ6bzKKIcyTu+pHPP+Gfe6iTKw+SXz2TXSZEmK2A==}
engines: {node: '>=18.12.1'} engines: {node: '>=18.12.1'}
'@n8n_io/riot-tmpl@4.0.0': '@n8n_io/riot-tmpl@4.0.0':
@ -16961,7 +16961,7 @@ snapshots:
'@n8n_io/ai-assistant-sdk@1.13.0': {} '@n8n_io/ai-assistant-sdk@1.13.0': {}
'@n8n_io/license-sdk@2.16.0': '@n8n_io/license-sdk@2.16.1':
dependencies: dependencies:
crypto-js: 4.2.0 crypto-js: 4.2.0
node-machine-id: 1.1.12 node-machine-id: 1.1.12