mirror of
https://github.com/n8n-io/n8n.git
synced 2025-02-21 02:56:40 -08:00
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:
parent
c3dc66ee73
commit
daa1fe9386
|
@ -97,7 +97,7 @@
|
|||
"@n8n/task-runner": "workspace:*",
|
||||
"@n8n/typeorm": "0.3.20-12",
|
||||
"@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",
|
||||
"@rudderstack/rudder-sdk-node": "2.0.9",
|
||||
"@sentry/node": "catalog:",
|
||||
|
|
|
@ -103,6 +103,11 @@ export class License {
|
|||
});
|
||||
|
||||
await this.manager.initialize();
|
||||
|
||||
const features = this.manager.getFeatures();
|
||||
this.checkIsLicensedForMultiMain(features);
|
||||
this.checkIsLicensedForBinaryDataS3(features);
|
||||
|
||||
this.logger.debug('License initialized');
|
||||
} catch (error: unknown) {
|
||||
if (error instanceof Error) {
|
||||
|
@ -129,11 +134,8 @@ export class License {
|
|||
async onFeatureChange(_features: TFeatures): Promise<void> {
|
||||
this.logger.debug('License feature change detected', _features);
|
||||
|
||||
if (config.getEnv('executions.mode') === 'queue' && this.globalConfig.multiMainSetup.enabled) {
|
||||
const isMultiMainLicensed =
|
||||
(_features[LICENSE_FEATURES.MULTIPLE_MAIN_INSTANCES] as boolean | undefined) ?? false;
|
||||
|
||||
this.instanceSettings.setMultiMainLicensed(isMultiMainLicensed);
|
||||
this.checkIsLicensedForMultiMain(_features);
|
||||
this.checkIsLicensedForBinaryDataS3(_features);
|
||||
|
||||
if (this.instanceSettings.isMultiMain && !this.instanceSettings.isLeader) {
|
||||
this.logger
|
||||
|
@ -142,31 +144,10 @@ export class License {
|
|||
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') {
|
||||
const { Publisher } = await import('@/scaling/pubsub/publisher.service');
|
||||
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> {
|
||||
|
@ -407,4 +388,45 @@ export class License {
|
|||
await this.init({ forceRecreate: true });
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -824,8 +824,8 @@ importers:
|
|||
specifier: 1.13.0
|
||||
version: 1.13.0
|
||||
'@n8n_io/license-sdk':
|
||||
specifier: 2.16.0
|
||||
version: 2.16.0
|
||||
specifier: 2.16.1
|
||||
version: 2.16.1
|
||||
'@oclif/core':
|
||||
specifier: 4.0.7
|
||||
version: 4.0.7
|
||||
|
@ -4564,8 +4564,8 @@ packages:
|
|||
resolution: {integrity: sha512-16kftFTeX3/lBinHJaBK0OL1lB4FpPaUoHX4h25AkvgHvmjUHpWNY2ZtKos0rY89+pkzDsNxMZqSUkeKU45iRg==}
|
||||
engines: {node: '>=20.15', pnpm: '>=8.14'}
|
||||
|
||||
'@n8n_io/license-sdk@2.16.0':
|
||||
resolution: {integrity: sha512-MVBqCkapJUX1rWhAXzGnfqOFaqzr0MT2X3ZTuA1BOyypb0doiuG9eh2ABy67Py4QKXGu+gnBAXZYGwG29bay+w==}
|
||||
'@n8n_io/license-sdk@2.16.1':
|
||||
resolution: {integrity: sha512-J3zsSzu0JftKAsLnxeKtprKkNSWpfNNMy7kUGkBgEsd6R7kJ6bzKKIcyTu+pHPP+Gfe6iTKw+SXz2TXSZEmK2A==}
|
||||
engines: {node: '>=18.12.1'}
|
||||
|
||||
'@n8n_io/riot-tmpl@4.0.0':
|
||||
|
@ -16961,7 +16961,7 @@ snapshots:
|
|||
|
||||
'@n8n_io/ai-assistant-sdk@1.13.0': {}
|
||||
|
||||
'@n8n_io/license-sdk@2.16.0':
|
||||
'@n8n_io/license-sdk@2.16.1':
|
||||
dependencies:
|
||||
crypto-js: 4.2.0
|
||||
node-machine-id: 1.1.12
|
||||
|
|
Loading…
Reference in a new issue