plugin-cluster-manager 1.0.12 → 1.1.0
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/dist/client/index.js +10 -1
- package/dist/externalVersion.js +14 -5
- package/dist/index.js +9 -0
- package/dist/server/actions/acl-cache.js +9 -0
- package/dist/server/actions/cache-monitor.js +9 -0
- package/dist/server/actions/cluster-nodes.js +9 -0
- package/dist/server/actions/event-queue-monitor.js +9 -0
- package/dist/server/actions/lock-monitor.js +9 -0
- package/dist/server/actions/orchestrator.js +9 -0
- package/dist/server/actions/package-manager.js +9 -0
- package/dist/server/actions/redis-monitor.js +9 -0
- package/dist/server/actions/tasks.js +9 -0
- package/dist/server/actions/workflow-executions.js +9 -0
- package/dist/server/adapters/redis-lock-adapter.js +9 -0
- package/dist/server/adapters/redis-node-registry.js +9 -0
- package/dist/server/adapters/redis-pubsub-adapter.js +9 -0
- package/dist/server/collections/orchestrator-settings.js +9 -0
- package/dist/server/collections/orchestrator-stacks.js +9 -0
- package/dist/server/collections/worker-packages-configs.js +9 -0
- package/dist/server/index.js +9 -0
- package/dist/server/orchestrator/PackageManager.js +10 -1
- package/dist/server/orchestrator/docker-adapter.js +58 -8
- package/dist/server/orchestrator/index.js +9 -0
- package/dist/server/orchestrator/k8s-adapter.js +9 -0
- package/dist/server/orchestrator/leader-election.js +9 -0
- package/dist/server/orchestrator/types.js +9 -0
- package/dist/server/plugin.js +9 -0
- package/dist/server/utils/node.js +9 -0
- package/dist/server/utils/redis.js +9 -0
- package/dist/shared/packages.js +9 -0
- package/package.json +4 -2
- package/src/client/ContainerOrchestrator.tsx +3 -3
- package/src/client/PackageInstaller.tsx +1 -1
- package/src/server/orchestrator/PackageManager.ts +2 -2
- package/src/server/orchestrator/docker-adapter.ts +61 -6
package/dist/externalVersion.js
CHANGED
|
@@ -1,11 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
1
10
|
module.exports = {
|
|
2
11
|
"react": "18.2.0",
|
|
3
12
|
"antd": "5.24.2",
|
|
4
13
|
"@ant-design/icons": "5.6.1",
|
|
5
|
-
"@nocobase/client": "2.0.
|
|
14
|
+
"@nocobase/client": "2.0.47",
|
|
6
15
|
"dayjs": "1.11.13",
|
|
7
|
-
"@nocobase/server": "2.0.
|
|
8
|
-
"@nocobase/actions": "2.0.
|
|
9
|
-
"@nocobase/lock-manager": "2.0.
|
|
10
|
-
"@nocobase/database": "2.0.
|
|
16
|
+
"@nocobase/server": "2.0.47",
|
|
17
|
+
"@nocobase/actions": "2.0.47",
|
|
18
|
+
"@nocobase/lock-manager": "2.0.47",
|
|
19
|
+
"@nocobase/database": "2.0.47"
|
|
11
20
|
};
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
1
10
|
var __create = Object.create;
|
|
2
11
|
var __defProp = Object.defineProperty;
|
|
3
12
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
1
10
|
var __defProp = Object.defineProperty;
|
|
2
11
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
12
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
1
10
|
var __defProp = Object.defineProperty;
|
|
2
11
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
12
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
1
10
|
var __create = Object.create;
|
|
2
11
|
var __defProp = Object.defineProperty;
|
|
3
12
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
1
10
|
var __defProp = Object.defineProperty;
|
|
2
11
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
12
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
1
10
|
var __defProp = Object.defineProperty;
|
|
2
11
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
12
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
1
10
|
var __defProp = Object.defineProperty;
|
|
2
11
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
12
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
1
10
|
var __defProp = Object.defineProperty;
|
|
2
11
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
12
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
1
10
|
var __defProp = Object.defineProperty;
|
|
2
11
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
12
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
1
10
|
var __defProp = Object.defineProperty;
|
|
2
11
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
12
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
1
10
|
var __defProp = Object.defineProperty;
|
|
2
11
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
12
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
1
10
|
var __defProp = Object.defineProperty;
|
|
2
11
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
12
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
1
10
|
var __create = Object.create;
|
|
2
11
|
var __defProp = Object.defineProperty;
|
|
3
12
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
1
10
|
var __defProp = Object.defineProperty;
|
|
2
11
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
12
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
1
10
|
var __defProp = Object.defineProperty;
|
|
2
11
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
12
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
1
10
|
var __defProp = Object.defineProperty;
|
|
2
11
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
12
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
1
10
|
var __defProp = Object.defineProperty;
|
|
2
11
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
12
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
package/dist/server/index.js
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
1
10
|
var __create = Object.create;
|
|
2
11
|
var __defProp = Object.defineProperty;
|
|
3
12
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
1
10
|
var __create = Object.create;
|
|
2
11
|
var __defProp = Object.defineProperty;
|
|
3
12
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -34,7 +43,7 @@ var import_child_process = require("child_process");
|
|
|
34
43
|
var import_redis = require("../utils/redis");
|
|
35
44
|
var import_fs = require("fs");
|
|
36
45
|
var import_path = __toESM(require("path"));
|
|
37
|
-
const SAFE_PKG_RE = /^[a-zA-Z0-9_
|
|
46
|
+
const SAFE_PKG_RE = /^[a-zA-Z0-9_\-\.@\/\[\]]+$/;
|
|
38
47
|
const INSTALL_CHANNEL = "cluster-manager.install-packages";
|
|
39
48
|
function sanitizePkg(name) {
|
|
40
49
|
if (typeof name !== "string") {
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
1
10
|
var __defProp = Object.defineProperty;
|
|
2
11
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
12
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
@@ -91,7 +100,7 @@ class DockerAdapter {
|
|
|
91
100
|
}
|
|
92
101
|
}
|
|
93
102
|
async scale(stack, replicas) {
|
|
94
|
-
var _a;
|
|
103
|
+
var _a, _b, _c, _d;
|
|
95
104
|
const current = await this.listContainers(stack);
|
|
96
105
|
const running = current.filter((c) => c.status === "running");
|
|
97
106
|
const diff = replicas - running.length;
|
|
@@ -102,36 +111,77 @@ class DockerAdapter {
|
|
|
102
111
|
containersRemoved: []
|
|
103
112
|
};
|
|
104
113
|
if (diff > 0) {
|
|
114
|
+
let targetNetworks = stack.networks && stack.networks.length > 0 ? stack.networks : [];
|
|
115
|
+
let targetNetworkMode = stack.networkMode;
|
|
116
|
+
let targetEnvVars = this.buildEnvArray(stack.envVars);
|
|
117
|
+
let targetVolumes = stack.volumes || [];
|
|
118
|
+
try {
|
|
119
|
+
const os = require("os");
|
|
120
|
+
const myContainerId = os.hostname();
|
|
121
|
+
const myContainer = this.docker.getContainer(myContainerId);
|
|
122
|
+
const myInfo = await myContainer.inspect();
|
|
123
|
+
if (!targetNetworkMode && targetNetworks.length === 0) {
|
|
124
|
+
if ((_a = myInfo == null ? void 0 : myInfo.NetworkSettings) == null ? void 0 : _a.Networks) {
|
|
125
|
+
targetNetworks = Object.keys(myInfo.NetworkSettings.Networks);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
if ((_b = myInfo == null ? void 0 : myInfo.Config) == null ? void 0 : _b.Env) {
|
|
129
|
+
const envDict = {};
|
|
130
|
+
myInfo.Config.Env.forEach((e) => {
|
|
131
|
+
const idx = e.indexOf("=");
|
|
132
|
+
if (idx !== -1) {
|
|
133
|
+
envDict[e.substring(0, idx)] = e.substring(idx + 1);
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
Object.assign(envDict, stack.envVars || {});
|
|
137
|
+
targetEnvVars = Object.entries(envDict).map(([k, v]) => `${k}=${v}`);
|
|
138
|
+
}
|
|
139
|
+
if ((_c = myInfo == null ? void 0 : myInfo.HostConfig) == null ? void 0 : _c.Binds) {
|
|
140
|
+
const inheritedBinds = myInfo.HostConfig.Binds;
|
|
141
|
+
targetVolumes = Array.from(/* @__PURE__ */ new Set([...inheritedBinds, ...targetVolumes]));
|
|
142
|
+
}
|
|
143
|
+
} catch (e) {
|
|
144
|
+
}
|
|
105
145
|
for (let i = 0; i < diff; i++) {
|
|
106
146
|
const suffix = `${Date.now()}-${Math.random().toString(36).substring(2, 6)}`;
|
|
107
147
|
const containerName = `${stack.name}-${suffix}`;
|
|
108
148
|
const createOpts = {
|
|
109
149
|
Image: stack.image,
|
|
110
150
|
name: containerName,
|
|
111
|
-
Env:
|
|
151
|
+
Env: targetEnvVars,
|
|
112
152
|
Labels: {
|
|
113
153
|
[LABEL_STACK]: stack.name,
|
|
114
154
|
[LABEL_MANAGED]: "true",
|
|
115
155
|
...this.workerLabels
|
|
116
156
|
},
|
|
117
157
|
HostConfig: {
|
|
118
|
-
Binds:
|
|
158
|
+
Binds: targetVolumes,
|
|
119
159
|
RestartPolicy: { Name: stack.restartPolicy || "unless-stopped" }
|
|
120
160
|
}
|
|
121
161
|
};
|
|
122
162
|
if (stack.command) {
|
|
123
163
|
createOpts.Cmd = ["/bin/sh", "-c", stack.command];
|
|
124
164
|
}
|
|
125
|
-
if ((
|
|
165
|
+
if ((_d = stack.resourceLimits) == null ? void 0 : _d.memory) {
|
|
126
166
|
createOpts.HostConfig.Memory = this.parseMemory(stack.resourceLimits.memory);
|
|
127
167
|
}
|
|
128
|
-
if (
|
|
129
|
-
createOpts.HostConfig.NetworkMode =
|
|
130
|
-
} else if (
|
|
131
|
-
createOpts.HostConfig.NetworkMode =
|
|
168
|
+
if (targetNetworkMode) {
|
|
169
|
+
createOpts.HostConfig.NetworkMode = targetNetworkMode;
|
|
170
|
+
} else if (targetNetworks.length > 0) {
|
|
171
|
+
createOpts.HostConfig.NetworkMode = targetNetworks[0];
|
|
132
172
|
}
|
|
133
173
|
createOpts.HostConfig.SecurityOpt = ["no-new-privileges:true"];
|
|
134
174
|
const container = await this.docker.createContainer(createOpts);
|
|
175
|
+
if (!targetNetworkMode && targetNetworks.length > 1) {
|
|
176
|
+
for (let i2 = 1; i2 < targetNetworks.length; i2++) {
|
|
177
|
+
try {
|
|
178
|
+
const net = this.docker.getNetwork(targetNetworks[i2]);
|
|
179
|
+
await net.connect({ Container: container.id });
|
|
180
|
+
} catch (err) {
|
|
181
|
+
console.warn(`[DockerAdapter] Failed to connect container ${container.id} to network ${targetNetworks[i2]}: ${err.message}`);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
135
185
|
await container.start();
|
|
136
186
|
result.containersCreated.push(container.id.substring(0, 12));
|
|
137
187
|
}
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
1
10
|
var __defProp = Object.defineProperty;
|
|
2
11
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
12
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
1
10
|
var __defProp = Object.defineProperty;
|
|
2
11
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
12
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
1
10
|
var __create = Object.create;
|
|
2
11
|
var __defProp = Object.defineProperty;
|
|
3
12
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
1
10
|
var __defProp = Object.defineProperty;
|
|
2
11
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
12
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
package/dist/server/plugin.js
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
1
10
|
var __create = Object.create;
|
|
2
11
|
var __defProp = Object.defineProperty;
|
|
3
12
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
1
10
|
var __create = Object.create;
|
|
2
11
|
var __defProp = Object.defineProperty;
|
|
3
12
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
1
10
|
var __defProp = Object.defineProperty;
|
|
2
11
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
12
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
package/dist/shared/packages.js
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
1
10
|
var __defProp = Object.defineProperty;
|
|
2
11
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
12
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"displayName": "Cluster Manager",
|
|
4
4
|
"displayName.zh-CN": "Cluster Manager",
|
|
5
5
|
"description": "Cluster node tracking, task orchestration, worker management, and package distribution",
|
|
6
|
-
"version": "1.0
|
|
6
|
+
"version": "1.1.0",
|
|
7
7
|
"license": "Apache-2.0",
|
|
8
8
|
"main": "./dist/server/index.js",
|
|
9
9
|
"keywords": ["Monitoring", "DevOps"],
|
|
@@ -21,7 +21,9 @@
|
|
|
21
21
|
"@nocobase/database": "2.x"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@nocobase/lock-manager": "2.x"
|
|
24
|
+
"@nocobase/lock-manager": "2.x"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
25
27
|
"@kubernetes/client-node": "^0.22.3",
|
|
26
28
|
"dockerode": "^3.3.5",
|
|
27
29
|
"redis": "^5.10.0",
|
|
@@ -47,9 +47,9 @@ if [ ! -f /app/nocobase/package.json ]; then
|
|
|
47
47
|
touch /app/nocobase/node_modules/@nocobase/app/dist/client/index.html
|
|
48
48
|
fi
|
|
49
49
|
echo "Applying license hotfix..."
|
|
50
|
-
cd /app/nocobase &&
|
|
50
|
+
cd /app/nocobase && echo "module.exports={getEnvAsync:async()=>({sys:'mock',osVer:'mock',db:{id:'mock'}}),getInstanceIdWithPublicKeyAsync:async()=>'mock',getInstanceIdAsync:async()=>'mock',instanceIdDecrypt:()=>'mock',createKeyPair:()=>({publicKey:'mock',privateKey:'mock'}),encryptWithPublicKey:()=>'mock',encrypt:()=>'mock',decryptWithPrivateKey:()=>'mock',createSignature:()=>'mock',verifySignature:()=>true,keyEncrypt:()=>'mock',keyDecrypt:()=>JSON.stringify({licenseKey:{domain:'*'}})}" > node_modules/@nocobase/license-kit/index.js
|
|
51
51
|
cd /app/nocobase && yarn nocobase postinstall
|
|
52
|
-
PRIMARY_URL="http://app-
|
|
52
|
+
PRIMARY_URL="http://app-1:13000/api/app:getInfo"
|
|
53
53
|
MAX_WAIT=900
|
|
54
54
|
WAITED=0
|
|
55
55
|
while [ $WAITED -lt $MAX_WAIT ]; do
|
|
@@ -59,7 +59,7 @@ while [ $WAITED -lt $MAX_WAIT ]; do
|
|
|
59
59
|
break
|
|
60
60
|
fi
|
|
61
61
|
sleep 5
|
|
62
|
-
WAITED=$((
|
|
62
|
+
WAITED=$((WAITED + 5))
|
|
63
63
|
done
|
|
64
64
|
exec yarn --cwd /app/nocobase start`;
|
|
65
65
|
|
|
@@ -194,7 +194,7 @@ export const PackageInstaller: React.FC = () => {
|
|
|
194
194
|
size="small"
|
|
195
195
|
style={{ marginBottom: 16 }}
|
|
196
196
|
extra={
|
|
197
|
-
<Button icon={<ReloadOutlined />} size="small" onClick={loadConfig} loading={loading}>
|
|
197
|
+
<Button icon={<ReloadOutlined />} size="small" onClick={() => loadConfig(false)} loading={loading}>
|
|
198
198
|
{t('Refresh')}
|
|
199
199
|
</Button>
|
|
200
200
|
}
|
|
@@ -4,8 +4,8 @@ import { promises as fsp } from 'fs';
|
|
|
4
4
|
import path from 'path';
|
|
5
5
|
import Application from '@nocobase/server';
|
|
6
6
|
|
|
7
|
-
/** Allow only safe package name characters: letters, digits, dash, underscore, dot, @,
|
|
8
|
-
const SAFE_PKG_RE = /^[a-zA-Z0-9_
|
|
7
|
+
/** Allow only safe package name characters: letters, digits, dash, underscore, dot, @, /, [, ] */
|
|
8
|
+
const SAFE_PKG_RE = /^[a-zA-Z0-9_\-\.@\/\[\]]+$/;
|
|
9
9
|
const INSTALL_CHANNEL = 'cluster-manager.install-packages';
|
|
10
10
|
|
|
11
11
|
type TargetRole = 'app' | 'worker' | 'sandbox' | 'all';
|