@abtnode/core 1.17.2-beta-20251111-114226-13276e42 → 1.17.2-beta-20251113-121338-9c917e68
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/api/team.js +45 -17
- package/lib/blocklet/manager/disk.js +106 -69
- package/lib/blocklet/manager/ensure-blocklet-running.js +2 -2
- package/lib/blocklet/migration-dist/migration.cjs +1 -1
- package/lib/util/blocklet.js +16 -13
- package/lib/util/docker/parse-docker-options-from-pm2.js +2 -1
- package/lib/webhook/sender/slack/index.js +3 -1
- package/package.json +26 -26
package/lib/api/team.js
CHANGED
|
@@ -478,7 +478,7 @@ class TeamAPI extends EventEmitter {
|
|
|
478
478
|
logger.info('user updated successfully', { teamDid, userDid: user.did });
|
|
479
479
|
this.emit(TeamEvents.userUpdated, { teamDid, user: doc });
|
|
480
480
|
} else if (_action === 'add') {
|
|
481
|
-
this.
|
|
481
|
+
this.createDefaultOrgForUser({ teamDid, user });
|
|
482
482
|
|
|
483
483
|
if (teamDid === nodeInfo.did && nodeInfo.nodeOwner && user.did !== nodeInfo.nodeOwner.did && notify) {
|
|
484
484
|
await this.sendNewMemberNotification(this.teamManager, user, nodeInfo);
|
|
@@ -2412,20 +2412,35 @@ class TeamAPI extends EventEmitter {
|
|
|
2412
2412
|
}
|
|
2413
2413
|
|
|
2414
2414
|
async getPassportFromFederated({ site, passportId, teamDid }) {
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2415
|
+
try {
|
|
2416
|
+
const blocklet = await getBlocklet({
|
|
2417
|
+
did: teamDid,
|
|
2418
|
+
states: this.states,
|
|
2419
|
+
dataDirs: this.dataDirs,
|
|
2420
|
+
useCache: true,
|
|
2421
|
+
});
|
|
2422
|
+
const nodeInfo = await this.node.read();
|
|
2423
|
+
const { permanentWallet } = getBlockletInfo(blocklet, nodeInfo.sk);
|
|
2418
2424
|
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2425
|
+
const result = await callFederated({
|
|
2426
|
+
action: 'getPassport',
|
|
2427
|
+
data: {
|
|
2428
|
+
passportId,
|
|
2429
|
+
},
|
|
2430
|
+
permanentWallet,
|
|
2431
|
+
site,
|
|
2432
|
+
requestOptions: {
|
|
2433
|
+
// 缩短查询通行证的请求时间,这个请求不会很复杂
|
|
2434
|
+
timeout: 3 * 1000,
|
|
2435
|
+
},
|
|
2436
|
+
});
|
|
2427
2437
|
|
|
2428
|
-
|
|
2438
|
+
return result;
|
|
2439
|
+
} catch (error) {
|
|
2440
|
+
// 吞没错误,查询失败也不会影响整个快捷登录流程
|
|
2441
|
+
logger.error('Failed to getPassportFromFederated', { site, passportId, teamDid, error });
|
|
2442
|
+
return null;
|
|
2443
|
+
}
|
|
2429
2444
|
}
|
|
2430
2445
|
|
|
2431
2446
|
/**
|
|
@@ -2849,11 +2864,16 @@ class TeamAPI extends EventEmitter {
|
|
|
2849
2864
|
}
|
|
2850
2865
|
}
|
|
2851
2866
|
|
|
2852
|
-
async
|
|
2867
|
+
async createDefaultOrgForUser({ teamDid, user }) {
|
|
2853
2868
|
try {
|
|
2854
2869
|
// 创建失败不要影响主流程
|
|
2855
2870
|
await this.createOrg(
|
|
2856
|
-
{
|
|
2871
|
+
{
|
|
2872
|
+
teamDid,
|
|
2873
|
+
name: user.fullName,
|
|
2874
|
+
description: `this is a default org for ${user.fullName}`,
|
|
2875
|
+
throwOnValidationError: false,
|
|
2876
|
+
},
|
|
2857
2877
|
{ user }
|
|
2858
2878
|
);
|
|
2859
2879
|
} catch (err) {
|
|
@@ -2877,7 +2897,7 @@ class TeamAPI extends EventEmitter {
|
|
|
2877
2897
|
}
|
|
2878
2898
|
}
|
|
2879
2899
|
|
|
2880
|
-
async createOrg({ teamDid, deferPassport = false, ...rest }, context) {
|
|
2900
|
+
async createOrg({ teamDid, deferPassport = false, throwOnValidationError = true, ...rest }, context) {
|
|
2881
2901
|
try {
|
|
2882
2902
|
// 1. 对输入进行转义
|
|
2883
2903
|
const sanitizedOrg = {
|
|
@@ -2903,7 +2923,15 @@ class TeamAPI extends EventEmitter {
|
|
|
2903
2923
|
|
|
2904
2924
|
const { veriftMaxOrgPerUser } = createOrgValidators(blocklet);
|
|
2905
2925
|
|
|
2906
|
-
|
|
2926
|
+
try {
|
|
2927
|
+
veriftMaxOrgPerUser(orgCount); // 验证用户创建的 org 数量是否超过最大限制, 内部已经验证 org 是否开启
|
|
2928
|
+
} catch (_error) {
|
|
2929
|
+
if (throwOnValidationError) {
|
|
2930
|
+
throw _error;
|
|
2931
|
+
}
|
|
2932
|
+
logger.warn('Failed to validate org creation', { error: _error, teamDid, orgCount });
|
|
2933
|
+
return undefined;
|
|
2934
|
+
}
|
|
2907
2935
|
|
|
2908
2936
|
const result = await state.create({ ...sanitizedOrg }, context);
|
|
2909
2937
|
|
|
@@ -259,7 +259,7 @@ const { formatEnvironments, getBlockletMeta, validateOwner, isCLI } = util;
|
|
|
259
259
|
|
|
260
260
|
const statusLock = new DBCache(() => ({
|
|
261
261
|
prefix: 'blocklet-status-lock',
|
|
262
|
-
ttl: 1000 *
|
|
262
|
+
ttl: 1000 * 120,
|
|
263
263
|
...getAbtNodeRedisAndSQLiteUrl(),
|
|
264
264
|
}));
|
|
265
265
|
|
|
@@ -795,38 +795,105 @@ class DiskBlockletManager extends BaseBlockletManager {
|
|
|
795
795
|
},
|
|
796
796
|
context
|
|
797
797
|
) {
|
|
798
|
-
const
|
|
799
|
-
|
|
800
|
-
inputComponentDids?.length ? inputComponentDids : blocklet.children.map((x) => x.meta.did)
|
|
801
|
-
);
|
|
798
|
+
const lockName = `${did}-start-not-input-component-dids`;
|
|
799
|
+
const shouldLock = !inputComponentDids?.length;
|
|
802
800
|
|
|
803
|
-
|
|
801
|
+
if (shouldLock) {
|
|
802
|
+
await statusLock.acquire(lockName);
|
|
803
|
+
}
|
|
804
804
|
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
)
|
|
811
|
-
);
|
|
805
|
+
try {
|
|
806
|
+
const blocklet = await this.ensureBlocklet(did, { e2eMode });
|
|
807
|
+
const baseComponentDids = uniq(
|
|
808
|
+
inputComponentDids?.length ? inputComponentDids : blocklet.children.map((x) => x.meta.did)
|
|
809
|
+
);
|
|
812
810
|
|
|
813
|
-
|
|
814
|
-
componentDids
|
|
815
|
-
|
|
816
|
-
blocklet
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
811
|
+
// 优先启动资源型组件
|
|
812
|
+
let componentDids = [];
|
|
813
|
+
const nonEntryComponentIds = [];
|
|
814
|
+
for (const b of blocklet.children) {
|
|
815
|
+
if (!b?.meta?.did) {
|
|
816
|
+
continue;
|
|
817
|
+
}
|
|
818
|
+
if (!baseComponentDids.includes(b.meta.did)) {
|
|
819
|
+
continue;
|
|
820
|
+
}
|
|
821
|
+
const engine = getBlockletEngine(b.meta);
|
|
822
|
+
if (engine.interpreter === 'blocklet') {
|
|
823
|
+
nonEntryComponentIds.push(b.meta.did);
|
|
824
|
+
continue;
|
|
825
|
+
}
|
|
826
|
+
if (!hasStartEngine(b.meta)) {
|
|
827
|
+
nonEntryComponentIds.push(b.meta.did);
|
|
828
|
+
continue;
|
|
829
|
+
}
|
|
830
|
+
componentDids.push(b.meta.did);
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
await this.checkControllerStatus(blocklet, 'start');
|
|
834
|
+
|
|
835
|
+
if (nonEntryComponentIds.length) {
|
|
836
|
+
await states.blocklet.setBlockletStatus(did, BlockletStatus.running, {
|
|
837
|
+
componentDids: nonEntryComponentIds,
|
|
838
|
+
operator,
|
|
839
|
+
});
|
|
840
|
+
}
|
|
823
841
|
|
|
824
|
-
|
|
825
|
-
const
|
|
826
|
-
|
|
827
|
-
|
|
842
|
+
// sync component config before at first to ensure resource component config is ready
|
|
843
|
+
const serverSk = (await states.node.read()).sk;
|
|
844
|
+
await Promise.all(
|
|
845
|
+
componentDids.map((componentDid) =>
|
|
846
|
+
this.configSynchronizer.syncComponentConfig(componentDid, blocklet.meta.did, { serverSk })
|
|
847
|
+
)
|
|
828
848
|
);
|
|
829
849
|
|
|
850
|
+
componentDids = await this.startRequiredComponents({
|
|
851
|
+
componentDids,
|
|
852
|
+
inputComponentDids,
|
|
853
|
+
blocklet,
|
|
854
|
+
throwOnError,
|
|
855
|
+
checkHealthImmediately,
|
|
856
|
+
e2eMode,
|
|
857
|
+
context,
|
|
858
|
+
atomic,
|
|
859
|
+
});
|
|
860
|
+
|
|
861
|
+
if (atomic || !blocklet.structVersion) {
|
|
862
|
+
const nextBlocklet = await this._start(
|
|
863
|
+
{ blocklet, throwOnError, checkHealthImmediately, e2eMode, componentDids, operator },
|
|
864
|
+
context
|
|
865
|
+
);
|
|
866
|
+
|
|
867
|
+
// 根据情况更新 route table, 会判断只有包含多 interfaces 的 DID 才会更新 route table
|
|
868
|
+
if (!['true', '1'].includes(process.env.ABT_NODE_DISABLE_BLUE_GREEN)) {
|
|
869
|
+
this.emit(BlockletEvents.blurOrGreenStarted, {
|
|
870
|
+
blocklet: nextBlocklet,
|
|
871
|
+
componentDids: inputComponentDids,
|
|
872
|
+
context,
|
|
873
|
+
});
|
|
874
|
+
}
|
|
875
|
+
return nextBlocklet;
|
|
876
|
+
}
|
|
877
|
+
|
|
878
|
+
const tasks = componentDids.map(
|
|
879
|
+
(componentDid) => () =>
|
|
880
|
+
this._start(
|
|
881
|
+
{
|
|
882
|
+
blocklet,
|
|
883
|
+
throwOnError,
|
|
884
|
+
checkHealthImmediately,
|
|
885
|
+
e2eMode,
|
|
886
|
+
componentDids: [componentDid],
|
|
887
|
+
operator,
|
|
888
|
+
},
|
|
889
|
+
context
|
|
890
|
+
)
|
|
891
|
+
);
|
|
892
|
+
|
|
893
|
+
const rest = await pAll(tasks, { concurrency: 1 });
|
|
894
|
+
|
|
895
|
+
const nextBlocklet = await this.ensureBlocklet(did, { e2eMode });
|
|
896
|
+
|
|
830
897
|
// 根据情况更新 route table, 会判断只有包含多 interfaces 的 DID 才会更新 route table
|
|
831
898
|
if (!['true', '1'].includes(process.env.ABT_NODE_DISABLE_BLUE_GREEN)) {
|
|
832
899
|
this.emit(BlockletEvents.blurOrGreenStarted, {
|
|
@@ -835,38 +902,13 @@ class DiskBlockletManager extends BaseBlockletManager {
|
|
|
835
902
|
context,
|
|
836
903
|
});
|
|
837
904
|
}
|
|
838
|
-
return nextBlocklet;
|
|
839
|
-
}
|
|
840
|
-
|
|
841
|
-
const tasks = componentDids.map(
|
|
842
|
-
(componentDid) => () =>
|
|
843
|
-
this._start(
|
|
844
|
-
{
|
|
845
|
-
blocklet,
|
|
846
|
-
throwOnError,
|
|
847
|
-
checkHealthImmediately,
|
|
848
|
-
e2eMode,
|
|
849
|
-
componentDids: [componentDid],
|
|
850
|
-
operator,
|
|
851
|
-
},
|
|
852
|
-
context
|
|
853
|
-
)
|
|
854
|
-
);
|
|
855
|
-
|
|
856
|
-
const rest = await pAll(tasks, { concurrency: 1 });
|
|
857
|
-
|
|
858
|
-
const nextBlocklet = await this.ensureBlocklet(did, { e2eMode });
|
|
859
905
|
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
context,
|
|
866
|
-
});
|
|
906
|
+
return rest[0];
|
|
907
|
+
} finally {
|
|
908
|
+
if (shouldLock) {
|
|
909
|
+
await statusLock.releaseLock(lockName);
|
|
910
|
+
}
|
|
867
911
|
}
|
|
868
|
-
|
|
869
|
-
return rest[0];
|
|
870
912
|
}
|
|
871
913
|
|
|
872
914
|
async _start(
|
|
@@ -1076,17 +1118,8 @@ class DiskBlockletManager extends BaseBlockletManager {
|
|
|
1076
1118
|
componentDids: entryComponentIds,
|
|
1077
1119
|
};
|
|
1078
1120
|
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
blocklet.status = BlockletStatus.running;
|
|
1082
|
-
} else {
|
|
1083
|
-
this.startQueue.push({
|
|
1084
|
-
entity: 'blocklet',
|
|
1085
|
-
action: 'check_if_started',
|
|
1086
|
-
...params,
|
|
1087
|
-
id: `${did}/${(entryComponentIds || []).join(',')}`,
|
|
1088
|
-
});
|
|
1089
|
-
}
|
|
1121
|
+
await this._onCheckIfStarted(params, { throwOnError, needUpdateBlueStatus: false });
|
|
1122
|
+
blocklet.status = BlockletStatus.running;
|
|
1090
1123
|
|
|
1091
1124
|
return blocklet;
|
|
1092
1125
|
} catch (err) {
|
|
@@ -3557,12 +3590,12 @@ class DiskBlockletManager extends BaseBlockletManager {
|
|
|
3557
3590
|
) => {
|
|
3558
3591
|
const startedAt = Date.now();
|
|
3559
3592
|
const { did, context, minConsecutiveTime = 2000, timeout, componentDids } = jobInfo;
|
|
3593
|
+
const nodeInfo = await states.node.read();
|
|
3560
3594
|
const blocklet = await this.getBlocklet(did);
|
|
3561
3595
|
|
|
3562
3596
|
const { meta } = blocklet;
|
|
3563
3597
|
const { name } = meta;
|
|
3564
3598
|
|
|
3565
|
-
const nodeInfo = await states.node.read();
|
|
3566
3599
|
const successBlockletIds = new Set();
|
|
3567
3600
|
|
|
3568
3601
|
try {
|
|
@@ -3572,7 +3605,11 @@ class DiskBlockletManager extends BaseBlockletManager {
|
|
|
3572
3605
|
timeout,
|
|
3573
3606
|
componentDids,
|
|
3574
3607
|
isGreen,
|
|
3608
|
+
appDid: did,
|
|
3575
3609
|
enableDocker: nodeInfo.enableDocker,
|
|
3610
|
+
getBlocklet: () => {
|
|
3611
|
+
return this.getBlocklet(did);
|
|
3612
|
+
},
|
|
3576
3613
|
setBlockletRunning: async (componentDid) => {
|
|
3577
3614
|
successBlockletIds.add(componentDid);
|
|
3578
3615
|
await states.blocklet.setBlockletStatus(did, BlockletStatus.running, {
|
|
@@ -171,8 +171,8 @@ class EnsureBlockletRunning {
|
|
|
171
171
|
|
|
172
172
|
getRunningBlocklets = async () => {
|
|
173
173
|
const runningStatuses = this.whenCycleCheck
|
|
174
|
-
? [BlockletStatus.running, BlockletStatus.waiting
|
|
175
|
-
: [BlockletStatus.running, BlockletStatus.waiting, BlockletStatus.
|
|
174
|
+
? [BlockletStatus.running, BlockletStatus.waiting]
|
|
175
|
+
: [BlockletStatus.running, BlockletStatus.waiting, BlockletStatus.error];
|
|
176
176
|
|
|
177
177
|
const blocklets = await this.states.blocklet.getBlocklets();
|
|
178
178
|
for (const rootBlocklet of blocklets) {
|
|
@@ -39024,7 +39024,7 @@ module.exports = require("zlib");
|
|
|
39024
39024
|
/***/ ((module) => {
|
|
39025
39025
|
|
|
39026
39026
|
"use strict";
|
|
39027
|
-
module.exports = /*#__PURE__*/JSON.parse('{"name":"@abtnode/core","publishConfig":{"access":"public"},"version":"1.17.1","description":"","main":"lib/index.js","files":["lib"],"scripts":{"lint":"eslint tests lib --ignore-pattern \'tests/assets/*\'","lint:fix":"eslint --fix tests lib"},"keywords":[],"author":"wangshijun <wangshijun2010@gmail.com> (http://github.com/wangshijun)","license":"Apache-2.0","dependencies":{"@abtnode/analytics":"1.17.1","@abtnode/auth":"1.17.1","@abtnode/certificate-manager":"1.17.1","@abtnode/constant":"1.17.1","@abtnode/cron":"1.17.1","@abtnode/db-cache":"1.17.1","@abtnode/docker-utils":"1.17.1","@abtnode/logger":"1.17.1","@abtnode/models":"1.17.1","@abtnode/queue":"1.17.1","@abtnode/rbac":"1.17.1","@abtnode/router-provider":"1.17.1","@abtnode/static-server":"1.17.1","@abtnode/timemachine":"1.17.1","@abtnode/util":"1.17.1","@aigne/aigne-hub":"^0.10.5","@arcblock/did":"^1.27.4","@arcblock/did-connect-js":"^1.27.4","@arcblock/did-ext":"^1.27.4","@arcblock/did-motif":"^1.1.14","@arcblock/did-util":"^1.27.4","@arcblock/event-hub":"^1.27.4","@arcblock/jwt":"^1.27.4","@arcblock/pm2-events":"^0.0.5","@arcblock/validator":"^1.27.4","@arcblock/vc":"^1.27.4","@blocklet/constant":"1.17.1","@blocklet/did-space-js":"^1.2.2","@blocklet/env":"1.17.1","@blocklet/error":"^0.3.2","@blocklet/meta":"1.17.1","@blocklet/resolver":"1.17.1","@blocklet/sdk":"1.17.1","@blocklet/server-js":"1.17.1","@blocklet/store":"1.17.1","@blocklet/theme":"^3.2.
|
|
39027
|
+
module.exports = /*#__PURE__*/JSON.parse('{"name":"@abtnode/core","publishConfig":{"access":"public"},"version":"1.17.1","description":"","main":"lib/index.js","files":["lib"],"scripts":{"lint":"eslint tests lib --ignore-pattern \'tests/assets/*\'","lint:fix":"eslint --fix tests lib"},"keywords":[],"author":"wangshijun <wangshijun2010@gmail.com> (http://github.com/wangshijun)","license":"Apache-2.0","dependencies":{"@abtnode/analytics":"1.17.1","@abtnode/auth":"1.17.1","@abtnode/certificate-manager":"1.17.1","@abtnode/constant":"1.17.1","@abtnode/cron":"1.17.1","@abtnode/db-cache":"1.17.1","@abtnode/docker-utils":"1.17.1","@abtnode/logger":"1.17.1","@abtnode/models":"1.17.1","@abtnode/queue":"1.17.1","@abtnode/rbac":"1.17.1","@abtnode/router-provider":"1.17.1","@abtnode/static-server":"1.17.1","@abtnode/timemachine":"1.17.1","@abtnode/util":"1.17.1","@aigne/aigne-hub":"^0.10.5","@arcblock/did":"^1.27.4","@arcblock/did-connect-js":"^1.27.4","@arcblock/did-ext":"^1.27.4","@arcblock/did-motif":"^1.1.14","@arcblock/did-util":"^1.27.4","@arcblock/event-hub":"^1.27.4","@arcblock/jwt":"^1.27.4","@arcblock/pm2-events":"^0.0.5","@arcblock/validator":"^1.27.4","@arcblock/vc":"^1.27.4","@blocklet/constant":"1.17.1","@blocklet/did-space-js":"^1.2.2","@blocklet/env":"1.17.1","@blocklet/error":"^0.3.2","@blocklet/meta":"1.17.1","@blocklet/resolver":"1.17.1","@blocklet/sdk":"1.17.1","@blocklet/server-js":"1.17.1","@blocklet/store":"1.17.1","@blocklet/theme":"^3.2.3","@fidm/x509":"^1.2.1","@ocap/mcrypto":"^1.27.4","@ocap/util":"^1.27.4","@ocap/wallet":"^1.27.4","@slack/webhook":"^7.0.6","archiver":"^7.0.1","axios":"^1.7.9","axon":"^2.0.3","chalk":"^4.1.2","cross-spawn":"^7.0.3","dayjs":"^1.11.13","deep-diff":"^1.0.2","detect-port":"^1.5.1","envfile":"^7.1.0","escape-string-regexp":"^4.0.0","fast-glob":"^3.3.2","filesize":"^10.1.1","flat":"^5.0.2","fs-extra":"^11.2.0","get-port":"^5.1.1","hasha":"^5.2.2","is-base64":"^1.1.0","is-cidr":"4","is-ip":"3","is-url":"^1.2.4","joi":"17.12.2","joi-extension-semver":"^5.0.0","js-yaml":"^4.1.0","kill-port":"^2.0.1","lodash":"^4.17.21","node-stream-zip":"^1.15.0","p-all":"^3.0.0","p-limit":"^3.1.0","p-map":"^4.0.0","p-retry":"^4.6.2","p-wait-for":"^3.2.0","private-ip":"^2.3.4","rate-limiter-flexible":"^5.0.5","read-last-lines":"^1.8.0","semver":"^7.6.3","sequelize":"^6.35.0","shelljs":"^0.8.5","slugify":"^1.6.6","ssri":"^8.0.1","stream-throttle":"^0.1.3","stream-to-promise":"^3.0.0","systeminformation":"^5.23.3","tail":"^2.2.4","tar":"^6.1.11","transliteration":"^2.3.5","ua-parser-js":"^1.0.2","ufo":"^1.5.3","uuid":"^11.1.0","valid-url":"^1.0.9","which":"^2.0.2","xbytes":"^1.8.0"},"devDependencies":{"axios-mock-adapter":"^2.1.0","expand-tilde":"^2.0.2","express":"^4.18.2","unzipper":"^0.10.11"},"gitHead":"e5764f753181ed6a7c615cd4fc6682aacf0cb7cd"}');
|
|
39028
39028
|
|
|
39029
39029
|
/***/ }),
|
|
39030
39030
|
|
package/lib/util/blocklet.js
CHANGED
|
@@ -1082,7 +1082,10 @@ const validateBlockletChainInfo = (blocklet) => {
|
|
|
1082
1082
|
return chainInfo;
|
|
1083
1083
|
};
|
|
1084
1084
|
|
|
1085
|
-
const _checkProcessHealthy = async (
|
|
1085
|
+
const _checkProcessHealthy = async (
|
|
1086
|
+
blocklet,
|
|
1087
|
+
{ minConsecutiveTime, timeout, logToTerminal, isGreen = false, appDid }
|
|
1088
|
+
) => {
|
|
1086
1089
|
const { meta, ports, greenPorts, env } = blocklet;
|
|
1087
1090
|
const { name } = meta;
|
|
1088
1091
|
const processId = isGreen ? `${env.processId}-green` : env.processId;
|
|
@@ -1100,29 +1103,29 @@ const _checkProcessHealthy = async (blocklet, { minConsecutiveTime, timeout, log
|
|
|
1100
1103
|
const getStatus = async () => {
|
|
1101
1104
|
try {
|
|
1102
1105
|
const info = await getProcessInfo(processId, { timeout: 3_000 });
|
|
1103
|
-
return info.pm2_env.status;
|
|
1106
|
+
return { status: info.pm2_env.status, envPort: info.pm2_env.BLOCKLET_PORT };
|
|
1104
1107
|
} catch (err) {
|
|
1105
|
-
logger.error('blocklet checkStart error', { error: err, processId, name });
|
|
1106
|
-
return '';
|
|
1108
|
+
logger.error('blocklet checkStart error', { appDid, error: err, processId, name });
|
|
1109
|
+
return { status: '', envPort: null };
|
|
1107
1110
|
}
|
|
1108
1111
|
};
|
|
1109
1112
|
|
|
1110
|
-
|
|
1113
|
+
// eslint-disable-next-line prefer-const
|
|
1114
|
+
let { status, envPort } = await getStatus();
|
|
1111
1115
|
|
|
1112
1116
|
for (let i = 0; i < 20 && status !== 'online'; i++) {
|
|
1113
1117
|
const t = process.env.NODE_ENV !== 'test' ? 500 : 30;
|
|
1114
1118
|
await sleep(t);
|
|
1115
|
-
status = await getStatus();
|
|
1119
|
+
({ status, envPort } = await getStatus());
|
|
1116
1120
|
}
|
|
1117
1121
|
|
|
1118
1122
|
if (status !== 'online') {
|
|
1119
1123
|
throw new Error('process not start within 10s');
|
|
1120
1124
|
}
|
|
1121
1125
|
|
|
1122
|
-
const port =
|
|
1123
|
-
|
|
1124
|
-
(webInterface || dockerInterface).name
|
|
1125
|
-
);
|
|
1126
|
+
const port =
|
|
1127
|
+
envPort ||
|
|
1128
|
+
findInterfacePortByName({ meta, ports: isGreen ? greenPorts : ports }, (webInterface || dockerInterface).name);
|
|
1126
1129
|
if (logToTerminal) {
|
|
1127
1130
|
// eslint-disable-next-line no-console
|
|
1128
1131
|
console.log(
|
|
@@ -1142,7 +1145,7 @@ const _checkProcessHealthy = async (blocklet, { minConsecutiveTime, timeout, log
|
|
|
1142
1145
|
waitTCP: !webInterface,
|
|
1143
1146
|
});
|
|
1144
1147
|
} catch (error) {
|
|
1145
|
-
logger.error('ensure endpoint healthy failed', { port, minConsecutiveTime, timeout });
|
|
1148
|
+
logger.error('ensure endpoint healthy failed', { appDid, port, minConsecutiveTime, timeout });
|
|
1146
1149
|
throw error;
|
|
1147
1150
|
}
|
|
1148
1151
|
} catch (error) {
|
|
@@ -1153,7 +1156,7 @@ const _checkProcessHealthy = async (blocklet, { minConsecutiveTime, timeout, log
|
|
|
1153
1156
|
|
|
1154
1157
|
const checkBlockletProcessHealthy = async (
|
|
1155
1158
|
blocklet,
|
|
1156
|
-
{ minConsecutiveTime, timeout, componentDids, setBlockletRunning, isGreen = false } = {}
|
|
1159
|
+
{ minConsecutiveTime, timeout, componentDids, setBlockletRunning, isGreen = false, appDid } = {}
|
|
1157
1160
|
) => {
|
|
1158
1161
|
await forEachBlocklet(
|
|
1159
1162
|
blocklet,
|
|
@@ -1182,7 +1185,7 @@ const checkBlockletProcessHealthy = async (
|
|
|
1182
1185
|
|
|
1183
1186
|
const startedAt = Date.now();
|
|
1184
1187
|
|
|
1185
|
-
await _checkProcessHealthy(b, { minConsecutiveTime, timeout, logToTerminal, isGreen });
|
|
1188
|
+
await _checkProcessHealthy(b, { minConsecutiveTime, timeout, logToTerminal, isGreen, appDid });
|
|
1186
1189
|
|
|
1187
1190
|
logger.info('done check component healthy', { processId: b.env.processId, time: Date.now() - startedAt });
|
|
1188
1191
|
|
|
@@ -169,7 +169,7 @@ async function parseDockerOptionsFromPm2({
|
|
|
169
169
|
const port = ports[key];
|
|
170
170
|
const inter = meta.interfaces?.find((x) => x.port === key);
|
|
171
171
|
dockerInfo.network += ` -p ${inter?.hostIP || '127.0.0.1'}:${port}:${inter?.containerPort || port}`;
|
|
172
|
-
if (inter
|
|
172
|
+
if (inter) {
|
|
173
173
|
if (primaryPort === 0) {
|
|
174
174
|
primaryPort = inter.containerPort || port;
|
|
175
175
|
}
|
|
@@ -184,6 +184,7 @@ async function parseDockerOptionsFromPm2({
|
|
|
184
184
|
dockerEnv.BLOCKLET_DOCKER_NETWORK = network;
|
|
185
185
|
if (primaryPort) {
|
|
186
186
|
dockerEnv.BLOCKLET_DOCKER_PRIMARY_PORT = primaryPort;
|
|
187
|
+
dockerEnv.BLOCKLET_PORT = primaryPort;
|
|
187
188
|
}
|
|
188
189
|
}
|
|
189
190
|
|
|
@@ -157,7 +157,9 @@ class SlackSender extends BaseSender {
|
|
|
157
157
|
text: 'ok',
|
|
158
158
|
};
|
|
159
159
|
}
|
|
160
|
-
const webhook = new IncomingWebhook(url
|
|
160
|
+
const webhook = new IncomingWebhook(url, {
|
|
161
|
+
timeout: 60 * 1000, // 1 minutes
|
|
162
|
+
});
|
|
161
163
|
const res = await webhook.send({
|
|
162
164
|
blocks,
|
|
163
165
|
username: sender.name,
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.17.2-beta-
|
|
6
|
+
"version": "1.17.2-beta-20251113-121338-9c917e68",
|
|
7
7
|
"description": "",
|
|
8
8
|
"main": "lib/index.js",
|
|
9
9
|
"files": [
|
|
@@ -17,21 +17,21 @@
|
|
|
17
17
|
"author": "wangshijun <wangshijun2010@gmail.com> (http://github.com/wangshijun)",
|
|
18
18
|
"license": "Apache-2.0",
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@abtnode/analytics": "1.17.2-beta-
|
|
21
|
-
"@abtnode/auth": "1.17.2-beta-
|
|
22
|
-
"@abtnode/certificate-manager": "1.17.2-beta-
|
|
23
|
-
"@abtnode/constant": "1.17.2-beta-
|
|
24
|
-
"@abtnode/cron": "1.17.2-beta-
|
|
25
|
-
"@abtnode/db-cache": "1.17.2-beta-
|
|
26
|
-
"@abtnode/docker-utils": "1.17.2-beta-
|
|
27
|
-
"@abtnode/logger": "1.17.2-beta-
|
|
28
|
-
"@abtnode/models": "1.17.2-beta-
|
|
29
|
-
"@abtnode/queue": "1.17.2-beta-
|
|
30
|
-
"@abtnode/rbac": "1.17.2-beta-
|
|
31
|
-
"@abtnode/router-provider": "1.17.2-beta-
|
|
32
|
-
"@abtnode/static-server": "1.17.2-beta-
|
|
33
|
-
"@abtnode/timemachine": "1.17.2-beta-
|
|
34
|
-
"@abtnode/util": "1.17.2-beta-
|
|
20
|
+
"@abtnode/analytics": "1.17.2-beta-20251113-121338-9c917e68",
|
|
21
|
+
"@abtnode/auth": "1.17.2-beta-20251113-121338-9c917e68",
|
|
22
|
+
"@abtnode/certificate-manager": "1.17.2-beta-20251113-121338-9c917e68",
|
|
23
|
+
"@abtnode/constant": "1.17.2-beta-20251113-121338-9c917e68",
|
|
24
|
+
"@abtnode/cron": "1.17.2-beta-20251113-121338-9c917e68",
|
|
25
|
+
"@abtnode/db-cache": "1.17.2-beta-20251113-121338-9c917e68",
|
|
26
|
+
"@abtnode/docker-utils": "1.17.2-beta-20251113-121338-9c917e68",
|
|
27
|
+
"@abtnode/logger": "1.17.2-beta-20251113-121338-9c917e68",
|
|
28
|
+
"@abtnode/models": "1.17.2-beta-20251113-121338-9c917e68",
|
|
29
|
+
"@abtnode/queue": "1.17.2-beta-20251113-121338-9c917e68",
|
|
30
|
+
"@abtnode/rbac": "1.17.2-beta-20251113-121338-9c917e68",
|
|
31
|
+
"@abtnode/router-provider": "1.17.2-beta-20251113-121338-9c917e68",
|
|
32
|
+
"@abtnode/static-server": "1.17.2-beta-20251113-121338-9c917e68",
|
|
33
|
+
"@abtnode/timemachine": "1.17.2-beta-20251113-121338-9c917e68",
|
|
34
|
+
"@abtnode/util": "1.17.2-beta-20251113-121338-9c917e68",
|
|
35
35
|
"@aigne/aigne-hub": "^0.10.5",
|
|
36
36
|
"@arcblock/did": "^1.27.4",
|
|
37
37
|
"@arcblock/did-connect-js": "^1.27.4",
|
|
@@ -43,21 +43,21 @@
|
|
|
43
43
|
"@arcblock/pm2-events": "^0.0.5",
|
|
44
44
|
"@arcblock/validator": "^1.27.4",
|
|
45
45
|
"@arcblock/vc": "^1.27.4",
|
|
46
|
-
"@blocklet/constant": "1.17.2-beta-
|
|
46
|
+
"@blocklet/constant": "1.17.2-beta-20251113-121338-9c917e68",
|
|
47
47
|
"@blocklet/did-space-js": "^1.2.2",
|
|
48
|
-
"@blocklet/env": "1.17.2-beta-
|
|
48
|
+
"@blocklet/env": "1.17.2-beta-20251113-121338-9c917e68",
|
|
49
49
|
"@blocklet/error": "^0.3.2",
|
|
50
|
-
"@blocklet/meta": "1.17.2-beta-
|
|
51
|
-
"@blocklet/resolver": "1.17.2-beta-
|
|
52
|
-
"@blocklet/sdk": "1.17.2-beta-
|
|
53
|
-
"@blocklet/server-js": "1.17.2-beta-
|
|
54
|
-
"@blocklet/store": "1.17.2-beta-
|
|
55
|
-
"@blocklet/theme": "^3.2.
|
|
50
|
+
"@blocklet/meta": "1.17.2-beta-20251113-121338-9c917e68",
|
|
51
|
+
"@blocklet/resolver": "1.17.2-beta-20251113-121338-9c917e68",
|
|
52
|
+
"@blocklet/sdk": "1.17.2-beta-20251113-121338-9c917e68",
|
|
53
|
+
"@blocklet/server-js": "1.17.2-beta-20251113-121338-9c917e68",
|
|
54
|
+
"@blocklet/store": "1.17.2-beta-20251113-121338-9c917e68",
|
|
55
|
+
"@blocklet/theme": "^3.2.3",
|
|
56
56
|
"@fidm/x509": "^1.2.1",
|
|
57
57
|
"@ocap/mcrypto": "^1.27.4",
|
|
58
58
|
"@ocap/util": "^1.27.4",
|
|
59
59
|
"@ocap/wallet": "^1.27.4",
|
|
60
|
-
"@slack/webhook": "^
|
|
60
|
+
"@slack/webhook": "^7.0.6",
|
|
61
61
|
"archiver": "^7.0.1",
|
|
62
62
|
"axios": "^1.7.9",
|
|
63
63
|
"axon": "^2.0.3",
|
|
@@ -116,5 +116,5 @@
|
|
|
116
116
|
"express": "^4.18.2",
|
|
117
117
|
"unzipper": "^0.10.11"
|
|
118
118
|
},
|
|
119
|
-
"gitHead": "
|
|
119
|
+
"gitHead": "82362ffba5d50f01774b257b9cd8143adeb7a898"
|
|
120
120
|
}
|