@constellation-network/node-pilot 0.7.1 → 0.8.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 +7 -1
- package/dist/commands/clean.js +1 -0
- package/dist/commands/info.js +5 -2
- package/dist/commands/status.js +3 -0
- package/dist/config-store.d.ts +1 -0
- package/dist/helpers/prompt-helper.js +7 -1
- package/dist/helpers/status-table-helper.js +1 -1
- package/dist/helpers/status-table.js +4 -4
- package/dist/services/migration-service.d.ts +3 -0
- package/dist/services/migration-service.js +35 -0
- package/oclif.manifest.json +1 -1
- package/package.json +2 -2
- 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.8.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.8.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.8.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.8.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.8.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.8.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.8.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.8.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.8.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.8.0-testnet/src/commands/status.ts)_
|
|
261
261
|
<!-- commandsstop -->
|
|
@@ -9,6 +9,12 @@ import { dockerService } from "../services/docker-service.js";
|
|
|
9
9
|
import { shellService } from "../services/shell-service.js";
|
|
10
10
|
import { checkNetwork } from "./check-network.js";
|
|
11
11
|
export const checkProject = {
|
|
12
|
+
async checkJavaMemory() {
|
|
13
|
+
if (configStore.hasProjectFlag('javaMemoryChecked')) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
await promptHelper.configureJavaMemoryArguments();
|
|
17
|
+
},
|
|
12
18
|
async hasVersionChanged() {
|
|
13
19
|
const clusterVersion = await clusterService.getReleaseVersion();
|
|
14
20
|
const rInfo = await configHelper.getReleaseInfo();
|
|
@@ -17,7 +23,7 @@ export const checkProject = {
|
|
|
17
23
|
async projectInstallation() {
|
|
18
24
|
let updateNetworkType = false;
|
|
19
25
|
let updateLayers = false;
|
|
20
|
-
if (!configStore.hasProjects()
|
|
26
|
+
if (!configStore.hasProjects()) {
|
|
21
27
|
await projectHelper.selectProject();
|
|
22
28
|
await checkNetwork.configureIpAddress();
|
|
23
29
|
updateNetworkType = true;
|
package/dist/commands/clean.js
CHANGED
package/dist/commands/info.js
CHANGED
|
@@ -12,12 +12,13 @@ export default class Info extends Command {
|
|
|
12
12
|
const projectInfo = configStore.getProjectInfo();
|
|
13
13
|
const networkInfo = configStore.getNetworkInfo();
|
|
14
14
|
const { CL_EXTERNAL_IP: currentIpAddress } = configStore.getEnvInfo();
|
|
15
|
+
const { CL_DOCKER_JAVA_OPTS } = configStore.getEnvLayerInfo(networkInfo.type, 'gl0');
|
|
15
16
|
// Project Name
|
|
16
17
|
configHelper.showEnvInfo('Project Name', projectInfo.name);
|
|
17
|
-
// DAG Address
|
|
18
|
-
configHelper.showEnvInfo('DAG Address', projectInfo.dagAddress);
|
|
19
18
|
// External IP Address
|
|
20
19
|
configHelper.showEnvInfo('External IP Address', currentIpAddress);
|
|
20
|
+
// DAG Address
|
|
21
|
+
configHelper.showEnvInfo('DAG Address', projectInfo.dagAddress);
|
|
21
22
|
// Node ID
|
|
22
23
|
configHelper.showEnvInfo('Node ID', projectInfo.nodeId);
|
|
23
24
|
// Layers to Run
|
|
@@ -26,6 +27,8 @@ export default class Info extends Command {
|
|
|
26
27
|
configHelper.showEnvInfo('Network', networkInfo.type);
|
|
27
28
|
// Network version
|
|
28
29
|
configHelper.showEnvInfo('Network Version', networkInfo.version);
|
|
30
|
+
// Java Memory
|
|
31
|
+
configHelper.showEnvInfo('GL0 Java Opts', CL_DOCKER_JAVA_OPTS);
|
|
29
32
|
// Project Directory
|
|
30
33
|
configHelper.showEnvInfo('Project Directory', projectInfo.projectDir);
|
|
31
34
|
// Fast Forward
|
package/dist/commands/status.js
CHANGED
|
@@ -7,6 +7,7 @@ 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";
|
|
10
11
|
export default class Status extends Command {
|
|
11
12
|
// eslint-disable-next-line no-warning-comments
|
|
12
13
|
// TODO add -f flag to continuously monitor status
|
|
@@ -16,8 +17,10 @@ export default class Status extends Command {
|
|
|
16
17
|
}
|
|
17
18
|
}
|
|
18
19
|
export async function checkInstallationAndConfigurationStatus() {
|
|
20
|
+
migrationService.runMigrations();
|
|
19
21
|
await checkInitialSetup.firstTimeRun();
|
|
20
22
|
await checkProject.projectInstallation();
|
|
23
|
+
await checkProject.checkJavaMemory();
|
|
21
24
|
await checkNetwork.checkExternalIpAddress();
|
|
22
25
|
await checkNetwork.isNetworkConnectable();
|
|
23
26
|
await checkNodePilot.checkDiscordRegistration();
|
package/dist/config-store.d.ts
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import { checkbox, input, number, select } from "@inquirer/prompts";
|
|
2
2
|
import chalk from "chalk";
|
|
3
|
+
import os from "node:os";
|
|
3
4
|
import { clm } from "../clm.js";
|
|
4
5
|
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
|
+
}
|
|
5
10
|
export const promptHelper = {
|
|
6
11
|
async configureJavaMemoryArguments() {
|
|
7
12
|
const { memory } = configStore.getSystemInfo();
|
|
@@ -30,13 +35,14 @@ export const promptHelper = {
|
|
|
30
35
|
const network = type.toUpperCase();
|
|
31
36
|
const logMethod = type === currentNetwork ? clm.postStep : clm.debug;
|
|
32
37
|
logMethod(`${network}:: ${layersToRun[0]} memory allocation: ${mainLayerMem}GB`);
|
|
33
|
-
configStore.setEnvLayerInfo(type, layersToRun[0], { CL_DOCKER_JAVA_OPTS:
|
|
38
|
+
configStore.setEnvLayerInfo(type, layersToRun[0], { CL_DOCKER_JAVA_OPTS: getJavaMemoryOptions(mainLayerMem) });
|
|
34
39
|
if (subLayerMem) {
|
|
35
40
|
logMethod(`${network}:: ${layersToRun[1]} memory allocation: ${subLayerMem}GB`);
|
|
36
41
|
configStore.setEnvLayerInfo(type, layersToRun[1], { CL_DOCKER_JAVA_OPTS: `-Xms1024M -Xmx${subLayerMem}G -Xss256K` });
|
|
37
42
|
}
|
|
38
43
|
}
|
|
39
44
|
}
|
|
45
|
+
configStore.setProjectFlag('javaMemoryChecked', true);
|
|
40
46
|
},
|
|
41
47
|
async confirmPrompt(msg) {
|
|
42
48
|
const result = await input({
|
|
@@ -68,7 +68,7 @@ class CellFormatter {
|
|
|
68
68
|
return this.style(value, "white");
|
|
69
69
|
}
|
|
70
70
|
formatUpTIme(startTime) {
|
|
71
|
-
if (
|
|
71
|
+
if (Number.isNaN(Number(startTime)))
|
|
72
72
|
return '-';
|
|
73
73
|
const formattedTime = formatTime(Date.now() - Number(startTime), true);
|
|
74
74
|
return formattedTime ?? '-';
|
|
@@ -69,8 +69,8 @@ export class StatusTable {
|
|
|
69
69
|
const ordinal = (values[info.layer].ordinal === n.ordinal) ? String(n.ordinal) : n.ordinal + ':true';
|
|
70
70
|
const label = info.layer + ':' + network + projectName;
|
|
71
71
|
const row1 = [
|
|
72
|
-
n.state,
|
|
73
|
-
n.session,
|
|
72
|
+
n.state || '-',
|
|
73
|
+
n.session || Date.now().toString(),
|
|
74
74
|
n.ordinal ? ordinal : '-',
|
|
75
75
|
distance,
|
|
76
76
|
];
|
|
@@ -119,8 +119,8 @@ export class StatusTable {
|
|
|
119
119
|
rows.push([
|
|
120
120
|
projectName + ':' + network,
|
|
121
121
|
info.layer,
|
|
122
|
-
n.session
|
|
123
|
-
n.state,
|
|
122
|
+
n.session || Date.now().toString(),
|
|
123
|
+
n.state || '-',
|
|
124
124
|
n.ordinal ? ordinal : '-',
|
|
125
125
|
distance,
|
|
126
126
|
n.clusterState || 'Ready',
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import semver from "semver";
|
|
2
|
+
import packageJson from '../../package.json' with { type: 'json' };
|
|
3
|
+
import { clm } from "../clm.js";
|
|
4
|
+
import { configStore } from "../config-store.js";
|
|
5
|
+
export const migrationService = {
|
|
6
|
+
runMigrations() {
|
|
7
|
+
const migrations = {
|
|
8
|
+
'0.8.0': m080,
|
|
9
|
+
// add more migrations as needed
|
|
10
|
+
};
|
|
11
|
+
const { version = '0.0.0' } = configStore.getProjectInfo();
|
|
12
|
+
const lastMigratedVersion = semver.parse(version);
|
|
13
|
+
const currentVersion = semver.parse(packageJson.version);
|
|
14
|
+
if (!lastMigratedVersion || !currentVersion) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
// console.log(`Running migrations from ${lastMigratedVersion.version} to ${currentVersion.version}`);
|
|
18
|
+
// console.log(`semver.gt(v, version): ${semver.gt('0.8.0', version)}`);
|
|
19
|
+
// console.log(`semver.lte(v, currentVersion.version): ${semver.lte('0.8.0', currentVersion.version)}`)
|
|
20
|
+
const migrationVersions = Object.keys(migrations)
|
|
21
|
+
.filter(v => semver.gt(v, version) && semver.lte(v, currentVersion.version))
|
|
22
|
+
.sort(semver.compare);
|
|
23
|
+
if (migrationVersions.length > 0) {
|
|
24
|
+
clm.preStep(`Migration versions to run: ${migrationVersions}`);
|
|
25
|
+
for (const version of migrationVersions) {
|
|
26
|
+
migrations[version]();
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
configStore.setProjectInfo({ version: currentVersion.toString() });
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
function m080() {
|
|
33
|
+
clm.step('Running migration 0.8.0...');
|
|
34
|
+
configStore.setProjectFlag('javaMemoryChecked', false);
|
|
35
|
+
}
|
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@constellation-network/node-pilot",
|
|
3
3
|
"description": "An easy deployment and monitoring tool for Constellation nodes.",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.8.0-testnet",
|
|
5
5
|
"author": "Frank Fox",
|
|
6
6
|
"bin": {
|
|
7
7
|
"cpilot": "bin/run.js"
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"version": "oclif readme && git add README.md",
|
|
22
22
|
"start": "./bin/dev.js",
|
|
23
23
|
"debug": "DEBUG=true ./bin/dev.js",
|
|
24
|
-
"pub": "npm publish --access public"
|
|
24
|
+
"pub": "npm publish --access public --tag testnet"
|
|
25
25
|
},
|
|
26
26
|
"types": "dist/index.d.ts",
|
|
27
27
|
"engines": {
|
|
@@ -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.22"
|
|
43
43
|
|
|
44
44
|
# Add entrypoint
|
|
45
45
|
COPY ./entrypoint.sh /app/entrypoint.sh
|