@constellation-network/node-pilot 0.9.0-testnet → 0.10.0-testnet
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/README.md +10 -10
- package/dist/checks/check-project.d.ts +1 -0
- package/dist/checks/check-project.js +52 -3
- package/dist/commands/config.js +2 -2
- package/dist/commands/status.js +1 -2
- package/dist/helpers/prompt-helper.d.ts +0 -1
- package/dist/helpers/prompt-helper.js +1 -43
- package/dist/helpers/status-table-helper.js +4 -4
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
- package/projects/hypergraph/Dockerfile +1 -1
package/README.md
CHANGED
|
@@ -21,7 +21,7 @@ $ npm install -g @constellation-network/node-pilot
|
|
|
21
21
|
$ cpilot COMMAND
|
|
22
22
|
running command...
|
|
23
23
|
$ cpilot (--version|-v)
|
|
24
|
-
@constellation-network/node-pilot/0.
|
|
24
|
+
@constellation-network/node-pilot/0.10.0-testnet darwin-arm64 node-v22.15.0
|
|
25
25
|
$ cpilot --help [COMMAND]
|
|
26
26
|
USAGE
|
|
27
27
|
$ cpilot COMMAND
|
|
@@ -71,7 +71,7 @@ EXAMPLES
|
|
|
71
71
|
$ cpilot clean
|
|
72
72
|
```
|
|
73
73
|
|
|
74
|
-
_See code: [src/commands/clean.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.
|
|
74
|
+
_See code: [src/commands/clean.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.10.0-testnet/src/commands/clean.ts)_
|
|
75
75
|
|
|
76
76
|
## `cpilot config`
|
|
77
77
|
|
|
@@ -88,7 +88,7 @@ EXAMPLES
|
|
|
88
88
|
$ cpilot config
|
|
89
89
|
```
|
|
90
90
|
|
|
91
|
-
_See code: [src/commands/config.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.
|
|
91
|
+
_See code: [src/commands/config.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.10.0-testnet/src/commands/config.ts)_
|
|
92
92
|
|
|
93
93
|
## `cpilot config get [NAME]`
|
|
94
94
|
|
|
@@ -112,7 +112,7 @@ EXAMPLES
|
|
|
112
112
|
$ cpilot config get gl0:CL_PUBLIC_HTTP_PORT
|
|
113
113
|
```
|
|
114
114
|
|
|
115
|
-
_See code: [src/commands/config/get.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.
|
|
115
|
+
_See code: [src/commands/config/get.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.10.0-testnet/src/commands/config/get.ts)_
|
|
116
116
|
|
|
117
117
|
## `cpilot config set NAME VALUE`
|
|
118
118
|
|
|
@@ -135,7 +135,7 @@ EXAMPLES
|
|
|
135
135
|
$ cpilot config set gl0:CL_PUBLIC_HTTP_PORT 9000
|
|
136
136
|
```
|
|
137
137
|
|
|
138
|
-
_See code: [src/commands/config/set.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.
|
|
138
|
+
_See code: [src/commands/config/set.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.10.0-testnet/src/commands/config/set.ts)_
|
|
139
139
|
|
|
140
140
|
## `cpilot help [COMMAND]`
|
|
141
141
|
|
|
@@ -172,7 +172,7 @@ EXAMPLES
|
|
|
172
172
|
$ cpilot info
|
|
173
173
|
```
|
|
174
174
|
|
|
175
|
-
_See code: [src/commands/info.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.
|
|
175
|
+
_See code: [src/commands/info.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.10.0-testnet/src/commands/info.ts)_
|
|
176
176
|
|
|
177
177
|
## `cpilot logs LAYER`
|
|
178
178
|
|
|
@@ -198,7 +198,7 @@ EXAMPLES
|
|
|
198
198
|
$ cpilot logs
|
|
199
199
|
```
|
|
200
200
|
|
|
201
|
-
_See code: [src/commands/logs.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.
|
|
201
|
+
_See code: [src/commands/logs.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.10.0-testnet/src/commands/logs.ts)_
|
|
202
202
|
|
|
203
203
|
## `cpilot restart [LAYER]`
|
|
204
204
|
|
|
@@ -226,7 +226,7 @@ EXAMPLES
|
|
|
226
226
|
$ cpilot restart
|
|
227
227
|
```
|
|
228
228
|
|
|
229
|
-
_See code: [src/commands/restart.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.
|
|
229
|
+
_See code: [src/commands/restart.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.10.0-testnet/src/commands/restart.ts)_
|
|
230
230
|
|
|
231
231
|
## `cpilot shutdown`
|
|
232
232
|
|
|
@@ -243,7 +243,7 @@ EXAMPLES
|
|
|
243
243
|
$ cpilot shutdown
|
|
244
244
|
```
|
|
245
245
|
|
|
246
|
-
_See code: [src/commands/shutdown.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.
|
|
246
|
+
_See code: [src/commands/shutdown.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.10.0-testnet/src/commands/shutdown.ts)_
|
|
247
247
|
|
|
248
248
|
## `cpilot status`
|
|
249
249
|
|
|
@@ -257,5 +257,5 @@ DESCRIPTION
|
|
|
257
257
|
Display node status and configuration settings
|
|
258
258
|
```
|
|
259
259
|
|
|
260
|
-
_See code: [src/commands/status.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.
|
|
260
|
+
_See code: [src/commands/status.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.10.0-testnet/src/commands/status.ts)_
|
|
261
261
|
<!-- commandsstop -->
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { input, select } from "@inquirer/prompts";
|
|
1
|
+
import { input, number, select } from "@inquirer/prompts";
|
|
2
|
+
import os from "node:os";
|
|
2
3
|
import { clm } from "../clm.js";
|
|
3
4
|
import { configStore } from "../config-store.js";
|
|
4
5
|
import { configHelper } from "../helpers/config-helper.js";
|
|
@@ -8,12 +9,60 @@ import { clusterService } from "../services/cluster-service.js";
|
|
|
8
9
|
import { dockerService } from "../services/docker-service.js";
|
|
9
10
|
import { shellService } from "../services/shell-service.js";
|
|
10
11
|
import { checkNetwork } from "./check-network.js";
|
|
12
|
+
function getJavaMemoryOptions(mem) {
|
|
13
|
+
const linuxOpt = (os.platform() === 'linux') ? ' -XX:+UseZGC' : '';
|
|
14
|
+
return `-Xms${mem}g -Xmx${mem}g -XX:+UnlockExperimentalVMOptions${linuxOpt} -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=./heap_dumps/ -XX:+ExitOnOutOfMemoryError`;
|
|
15
|
+
}
|
|
11
16
|
export const checkProject = {
|
|
12
17
|
async checkJavaMemory() {
|
|
13
18
|
if (configStore.hasProjectFlag('javaMemoryChecked')) {
|
|
14
19
|
return;
|
|
15
20
|
}
|
|
16
|
-
await
|
|
21
|
+
await this.configureJavaMemoryArguments();
|
|
22
|
+
},
|
|
23
|
+
async configureJavaMemoryArguments() {
|
|
24
|
+
const { memory } = configStore.getSystemInfo();
|
|
25
|
+
const { layersToRun, name } = configStore.getProjectInfo();
|
|
26
|
+
const { type: currentNetwork } = configStore.getNetworkInfo();
|
|
27
|
+
const xmx = Number(memory);
|
|
28
|
+
if (xmx === 8 && layersToRun.length > 1) {
|
|
29
|
+
clm.warn('Minimum 8GB memory detected. Only a single layer will be allowed to run');
|
|
30
|
+
await promptHelper.doYouWishToContinue();
|
|
31
|
+
configStore.setProjectInfo({ layersToRun: [layersToRun[0]] });
|
|
32
|
+
configStore.setEnvLayerInfo(currentNetwork, layersToRun[0], { CL_DOCKER_JAVA_OPTS: '-Xms1024M -Xmx7G -Xss256K' });
|
|
33
|
+
}
|
|
34
|
+
else if (name === 'hypergraph') {
|
|
35
|
+
// prompt to use all detected memory
|
|
36
|
+
let answer = await number({
|
|
37
|
+
default: xmx - 1,
|
|
38
|
+
message: `How much of the detected memory (${xmx}GB) do you want to use?: `,
|
|
39
|
+
validate: v => v !== undefined && v >= 4 && v <= xmx
|
|
40
|
+
});
|
|
41
|
+
if (answer === xmx)
|
|
42
|
+
answer--;
|
|
43
|
+
let subLayerMem = 0;
|
|
44
|
+
let mainLayerMem = 0;
|
|
45
|
+
if (currentNetwork === 'testnet') {
|
|
46
|
+
subLayerMem = layersToRun.length > 1 ? Math.floor(answer / 2) : 0;
|
|
47
|
+
mainLayerMem = answer - subLayerMem;
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
subLayerMem = layersToRun.length > 1 ? Math.floor(answer / 3) : 0;
|
|
51
|
+
mainLayerMem = answer - subLayerMem;
|
|
52
|
+
}
|
|
53
|
+
const { supportedTypes } = configStore.getNetworkInfo();
|
|
54
|
+
for (const type of supportedTypes) {
|
|
55
|
+
const network = type.toUpperCase();
|
|
56
|
+
const logMethod = type === currentNetwork ? clm.postStep : clm.debug;
|
|
57
|
+
logMethod(`${network}:: ${layersToRun[0]} memory allocation: ${mainLayerMem}GB`);
|
|
58
|
+
configStore.setEnvLayerInfo(type, layersToRun[0], { CL_DOCKER_JAVA_OPTS: getJavaMemoryOptions(mainLayerMem) });
|
|
59
|
+
if (subLayerMem) {
|
|
60
|
+
logMethod(`${network}:: ${layersToRun[1]} memory allocation: ${subLayerMem}GB`);
|
|
61
|
+
configStore.setEnvLayerInfo(type, layersToRun[1], { CL_DOCKER_JAVA_OPTS: `-Xms1024M -Xmx${subLayerMem}G -Xss256K` });
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
configStore.setProjectFlag('javaMemoryChecked', true);
|
|
17
66
|
},
|
|
18
67
|
async hasVersionChanged() {
|
|
19
68
|
const clusterVersion = await clusterService.getReleaseVersion();
|
|
@@ -37,7 +86,7 @@ export const checkProject = {
|
|
|
37
86
|
}
|
|
38
87
|
if (!layersToRun || updateLayers) {
|
|
39
88
|
await promptHelper.selectLayers();
|
|
40
|
-
await
|
|
89
|
+
await this.configureJavaMemoryArguments();
|
|
41
90
|
}
|
|
42
91
|
},
|
|
43
92
|
async releaseVersion() {
|
package/dist/commands/config.js
CHANGED
|
@@ -37,7 +37,7 @@ export default class Config extends Command {
|
|
|
37
37
|
}
|
|
38
38
|
else if (answer === 'javaMemory') {
|
|
39
39
|
await shutdownNodeIfRunning();
|
|
40
|
-
await
|
|
40
|
+
await checkProject.configureJavaMemoryArguments();
|
|
41
41
|
}
|
|
42
42
|
else if (answer === 'keyFile') {
|
|
43
43
|
await shutdownNodeIfRunning();
|
|
@@ -47,7 +47,7 @@ export default class Config extends Command {
|
|
|
47
47
|
else if (answer === 'layersToRun') {
|
|
48
48
|
await shutdownNodeIfRunning();
|
|
49
49
|
await promptHelper.selectLayers();
|
|
50
|
-
await
|
|
50
|
+
await checkProject.configureJavaMemoryArguments();
|
|
51
51
|
}
|
|
52
52
|
else if (answer === 'network') {
|
|
53
53
|
await shutdownNodeIfRunning();
|
package/dist/commands/status.js
CHANGED
|
@@ -7,7 +7,6 @@ import { checkNodePilot } from "../checks/check-pilot.js";
|
|
|
7
7
|
import { checkProject } from "../checks/check-project.js";
|
|
8
8
|
import { checkWallet } from "../checks/check-wallet.js";
|
|
9
9
|
import { keyFileHelper } from "../helpers/key-file-helper.js";
|
|
10
|
-
import { migrationService } from "../services/migration-service.js";
|
|
11
10
|
export default class Status extends Command {
|
|
12
11
|
// eslint-disable-next-line no-warning-comments
|
|
13
12
|
// TODO add -f flag to continuously monitor status
|
|
@@ -17,7 +16,7 @@ export default class Status extends Command {
|
|
|
17
16
|
}
|
|
18
17
|
}
|
|
19
18
|
export async function checkInstallationAndConfigurationStatus() {
|
|
20
|
-
migrationService.runMigrations();
|
|
19
|
+
// migrationService.runMigrations();
|
|
21
20
|
await checkInitialSetup.firstTimeRun();
|
|
22
21
|
await checkProject.projectInstallation();
|
|
23
22
|
await checkProject.checkJavaMemory();
|
|
@@ -1,49 +1,7 @@
|
|
|
1
|
-
import { checkbox, input,
|
|
1
|
+
import { checkbox, input, select } from "@inquirer/prompts";
|
|
2
2
|
import chalk from "chalk";
|
|
3
|
-
import os from "node:os";
|
|
4
|
-
import { clm } from "../clm.js";
|
|
5
3
|
import { configStore } from "../config-store.js";
|
|
6
|
-
function getJavaMemoryOptions(mem) {
|
|
7
|
-
const linuxOpt = (os.platform() === 'linux') ? ' -XX:+UseZGC' : '';
|
|
8
|
-
return `-Xms${mem}g -Xmx${mem}g -XX:+UnlockExperimentalVMOptions${linuxOpt} -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=./heap_dumps/ -XX:+ExitOnOutOfMemoryError`;
|
|
9
|
-
}
|
|
10
4
|
export const promptHelper = {
|
|
11
|
-
async configureJavaMemoryArguments() {
|
|
12
|
-
const { memory } = configStore.getSystemInfo();
|
|
13
|
-
const { layersToRun, name } = configStore.getProjectInfo();
|
|
14
|
-
const { type: currentNetwork } = configStore.getNetworkInfo();
|
|
15
|
-
const xmx = Number(memory);
|
|
16
|
-
if (xmx === 8 && layersToRun.length > 1) {
|
|
17
|
-
clm.warn('Minimum 8GB memory detected. Only a single layer will be allowed to run');
|
|
18
|
-
await promptHelper.doYouWishToContinue();
|
|
19
|
-
configStore.setProjectInfo({ layersToRun: [layersToRun[0]] });
|
|
20
|
-
configStore.setEnvLayerInfo(currentNetwork, layersToRun[0], { CL_DOCKER_JAVA_OPTS: '-Xms1024M -Xmx7G -Xss256K' });
|
|
21
|
-
}
|
|
22
|
-
else if (name === 'hypergraph') {
|
|
23
|
-
// prompt to use all detected memory
|
|
24
|
-
let answer = await number({
|
|
25
|
-
default: xmx - 1,
|
|
26
|
-
message: `How much of the detected memory (${xmx}GB) do you want to use?: `,
|
|
27
|
-
validate: v => v !== undefined && v >= 4 && v <= xmx
|
|
28
|
-
});
|
|
29
|
-
if (answer === xmx)
|
|
30
|
-
answer--;
|
|
31
|
-
const subLayerMem = layersToRun.length > 1 ? Math.floor(answer / 3) : 0;
|
|
32
|
-
const mainLayerMem = answer - subLayerMem;
|
|
33
|
-
const { supportedTypes } = configStore.getNetworkInfo();
|
|
34
|
-
for (const type of supportedTypes) {
|
|
35
|
-
const network = type.toUpperCase();
|
|
36
|
-
const logMethod = type === currentNetwork ? clm.postStep : clm.debug;
|
|
37
|
-
logMethod(`${network}:: ${layersToRun[0]} memory allocation: ${mainLayerMem}GB`);
|
|
38
|
-
configStore.setEnvLayerInfo(type, layersToRun[0], { CL_DOCKER_JAVA_OPTS: getJavaMemoryOptions(mainLayerMem) });
|
|
39
|
-
if (subLayerMem) {
|
|
40
|
-
logMethod(`${network}:: ${layersToRun[1]} memory allocation: ${subLayerMem}GB`);
|
|
41
|
-
configStore.setEnvLayerInfo(type, layersToRun[1], { CL_DOCKER_JAVA_OPTS: `-Xms1024M -Xmx${subLayerMem}G -Xss256K` });
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
configStore.setProjectFlag('javaMemoryChecked', true);
|
|
46
|
-
},
|
|
47
5
|
async confirmPrompt(msg) {
|
|
48
6
|
const result = await input({
|
|
49
7
|
default: 'y',
|
|
@@ -17,8 +17,8 @@ class CellFormatter {
|
|
|
17
17
|
formatDistance(value) {
|
|
18
18
|
if (!value || value === '-')
|
|
19
19
|
return '-';
|
|
20
|
-
const num =
|
|
21
|
-
if (num
|
|
20
|
+
const num = Number(value);
|
|
21
|
+
if (num <= 0)
|
|
22
22
|
return value;
|
|
23
23
|
if (num < 9)
|
|
24
24
|
return this.style(value, "bgYellow", "whiteBright", "bold");
|
|
@@ -109,7 +109,7 @@ export const statusTableHeader = [
|
|
|
109
109
|
{ color: 'white', formatter: formatDistance, headerColor: 'whiteBright', value: 'Distance' },
|
|
110
110
|
{ color: 'white', formatter: formatState, headerColor: 'whiteBright', value: 'Cluster State', width: 16 },
|
|
111
111
|
{ color: 'white', formatter: formatCpu, headerColor: 'whiteBright', value: 'CPU Usage', width: 12 },
|
|
112
|
-
{ color: 'white', formatter: formatMem, headerColor: 'whiteBright', value: 'Mem Usage
|
|
112
|
+
{ color: 'white', formatter: formatMem, headerColor: 'whiteBright', value: 'Mem Usage', width: 12 },
|
|
113
113
|
{ color: 'white', formatter: formatError, headerColor: 'whiteBright', value: 'Error', width: 22 },
|
|
114
114
|
];
|
|
115
115
|
export const glHeader1 = [
|
|
@@ -123,6 +123,6 @@ export const glHeader1 = [
|
|
|
123
123
|
export const glHeader2 = [
|
|
124
124
|
{ color: 'white', formatter: formatState, headerColor: 'whiteBright', value: 'Cluster State', width: 22 },
|
|
125
125
|
{ color: 'white', formatter: formatCpu, headerColor: 'whiteBright', value: 'CPU Usage', width: 13 },
|
|
126
|
-
{ color: 'white', formatter: formatMem, headerColor: 'whiteBright', value: 'Mem Usage
|
|
126
|
+
{ color: 'white', formatter: formatMem, headerColor: 'whiteBright', value: 'Mem Usage', width: 16 },
|
|
127
127
|
{ color: 'white', formatter: formatError, headerColor: 'whiteBright', value: 'Error', width: 22 },
|
|
128
128
|
];
|
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -39,7 +39,7 @@ COPY dist/gl0.jar /app/jars/gl0.jar
|
|
|
39
39
|
#COPY ./health-check /health-check
|
|
40
40
|
#RUN chmod +x /health-check/bin/run.sh
|
|
41
41
|
#RUN chmod +x /health-check/bin/hydrate.sh
|
|
42
|
-
RUN npm install -g "@constellation-network/node-pilot-health-check@0.0.
|
|
42
|
+
RUN npm install -g "@constellation-network/node-pilot-health-check@0.0.24"
|
|
43
43
|
|
|
44
44
|
# Add entrypoint
|
|
45
45
|
COPY ./entrypoint.sh /app/entrypoint.sh
|