@constellation-network/node-pilot 0.10.2-testnet → 0.11.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/README.md +10 -10
- package/dist/checks/check-project.js +16 -22
- package/dist/commands/clean.js +1 -29
- package/dist/commands/config.js +11 -13
- package/dist/commands/restart.js +1 -1
- package/dist/commands/test.js +1 -0
- package/dist/helpers/project-helper.d.ts +1 -0
- package/dist/helpers/project-helper.js +24 -0
- package/dist/helpers/prompt-helper.d.ts +1 -0
- package/dist/helpers/prompt-helper.js +12 -0
- package/dist/services/cluster-service.js +5 -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.11.0 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.11.0/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.11.0/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.11.0/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.11.0/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.11.0/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.11.0/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.11.0/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.11.0/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.11.0/src/commands/status.ts)_
|
|
261
261
|
<!-- commandsstop -->
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { input, number, select } from "@inquirer/prompts";
|
|
2
2
|
import os from "node:os";
|
|
3
|
+
import ora from "ora";
|
|
3
4
|
import { clm } from "../clm.js";
|
|
4
5
|
import { configStore } from "../config-store.js";
|
|
5
6
|
import { configHelper } from "../helpers/config-helper.js";
|
|
@@ -149,35 +150,28 @@ export const checkProject = {
|
|
|
149
150
|
if (isRunning) {
|
|
150
151
|
await dockerService.dockerDown();
|
|
151
152
|
}
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
// spinner.start();
|
|
158
|
-
// spinner.color = 'green';
|
|
159
|
-
// }
|
|
160
|
-
// else {
|
|
161
|
-
if (!rInfo && !configStore.isRestarting()) {
|
|
162
|
-
// First time install
|
|
163
|
-
clm.preStep('Tessellation and dependencies need to be installed. This may take a few minutes...');
|
|
164
|
-
await promptHelper.doYouWishToContinue();
|
|
153
|
+
const showSpinner = !configStore.isRestarting();
|
|
154
|
+
const spinner = ora('');
|
|
155
|
+
if (showSpinner) {
|
|
156
|
+
spinner.start();
|
|
157
|
+
spinner.color = 'green';
|
|
165
158
|
}
|
|
159
|
+
// if (!rInfo && !configStore.isRestarting()) {
|
|
160
|
+
// // First time install
|
|
161
|
+
// clm.preStep('Tessellation and dependencies need to be installed. This may take a few minutes...');
|
|
162
|
+
// await promptHelper.doYouWishToContinue();
|
|
166
163
|
// }
|
|
167
|
-
// const node = await clusterService.getClusterNodeInfo();
|
|
168
|
-
// const NODE_URL = `http://${node.host}:${node.publicPort}`;
|
|
169
164
|
// NOTE: may be different for metagraphs
|
|
170
165
|
await shellService.runProjectCommand(`scripts/install.sh ${nInfo.type}`, undefined, false)
|
|
171
166
|
.catch(() => {
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
// }
|
|
167
|
+
if (showSpinner) {
|
|
168
|
+
spinner.stop();
|
|
169
|
+
}
|
|
176
170
|
clm.error('Install script failed. Please run cpilot again after correcting the error');
|
|
177
171
|
});
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
172
|
+
if (showSpinner) {
|
|
173
|
+
spinner.stop();
|
|
174
|
+
}
|
|
181
175
|
rInfo = await configHelper.getReleaseInfo();
|
|
182
176
|
configStore.setNetworkInfo({
|
|
183
177
|
type: rInfo.network,
|
package/dist/commands/clean.js
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import { Args, Command, Flags } from '@oclif/core';
|
|
2
|
-
import { clm } from "../clm.js";
|
|
3
2
|
import { configStore } from "../config-store.js";
|
|
4
3
|
import { projectHelper } from "../helpers/project-helper.js";
|
|
5
|
-
import { promptHelper } from "../helpers/prompt-helper.js";
|
|
6
|
-
import { dockerService } from "../services/docker-service.js";
|
|
7
|
-
import { shellService } from "../services/shell-service.js";
|
|
8
4
|
export default class Clean extends Command {
|
|
9
5
|
static args = {
|
|
10
6
|
layer: Args.string({ description: 'network layer to clean. e.g. gl0', required: false }),
|
|
@@ -29,30 +25,6 @@ export default class Clean extends Command {
|
|
|
29
25
|
const deleteLogs = flags.logs || deleteAll;
|
|
30
26
|
const deleteData = flags.data || deleteAll;
|
|
31
27
|
const deleteJars = flags.jars || deleteAll;
|
|
32
|
-
|
|
33
|
-
clm.preStep('The validator node must be stopped first.');
|
|
34
|
-
await promptHelper.doYouWishToContinue();
|
|
35
|
-
await dockerService.dockerDown();
|
|
36
|
-
}
|
|
37
|
-
clm.preStep('Requesting sudo permission to remove files...');
|
|
38
|
-
for (const layer of layers) {
|
|
39
|
-
if (deleteData) {
|
|
40
|
-
// eslint-disable-next-line no-await-in-loop
|
|
41
|
-
await shellService.runProjectCommand(`sudo rm -rf ${layer}/data`);
|
|
42
|
-
if (layer === 'gl0') {
|
|
43
|
-
projectHelper.prepareDataFolder();
|
|
44
|
-
configStore.setProjectFlag('discordChecked', false);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
if (deleteLogs) {
|
|
48
|
-
// eslint-disable-next-line no-await-in-loop
|
|
49
|
-
await shellService.runProjectCommand(`sudo rm -rf ${layer}/logs`);
|
|
50
|
-
}
|
|
51
|
-
if (deleteJars) {
|
|
52
|
-
// eslint-disable-next-line no-await-in-loop
|
|
53
|
-
await shellService.runProjectCommand(`sudo rm -rf ${layer}/dist`);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
clm.postStep('Done');
|
|
28
|
+
await projectHelper.cleanup(layers, deleteLogs, deleteData, deleteJars);
|
|
57
29
|
}
|
|
58
30
|
}
|
package/dist/commands/config.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { select } from '@inquirer/prompts';
|
|
2
2
|
import { Command } from '@oclif/core';
|
|
3
3
|
import { checkNetwork } from "../checks/check-network.js";
|
|
4
|
+
import { checkNodePilot } from "../checks/check-pilot.js";
|
|
4
5
|
import { checkProject } from "../checks/check-project.js";
|
|
5
6
|
import { clm } from "../clm.js";
|
|
7
|
+
import { configStore } from "../config-store.js";
|
|
6
8
|
import { configHelper } from "../helpers/config-helper.js";
|
|
7
9
|
import { keyFileHelper } from "../helpers/key-file-helper.js";
|
|
10
|
+
import { projectHelper } from "../helpers/project-helper.js";
|
|
8
11
|
import { promptHelper } from "../helpers/prompt-helper.js";
|
|
9
|
-
import { dockerService } from "../services/docker-service.js";
|
|
10
|
-
import { checkNodePilot } from "../checks/check-pilot.js";
|
|
11
12
|
export default class Config extends Command {
|
|
12
13
|
static description = 'Update configuration settings';
|
|
13
14
|
static examples = [
|
|
@@ -36,30 +37,27 @@ export default class Config extends Command {
|
|
|
36
37
|
await checkNodePilot.promptDiscordRegistration();
|
|
37
38
|
}
|
|
38
39
|
else if (answer === 'javaMemory') {
|
|
39
|
-
await shutdownNodeIfRunning();
|
|
40
|
+
await promptHelper.shutdownNodeIfRunning();
|
|
40
41
|
await checkProject.configureJavaMemoryArguments();
|
|
41
42
|
}
|
|
42
43
|
else if (answer === 'keyFile') {
|
|
43
|
-
await shutdownNodeIfRunning();
|
|
44
|
+
await promptHelper.shutdownNodeIfRunning();
|
|
44
45
|
await keyFileHelper.showKeyFileInfo();
|
|
45
46
|
await keyFileHelper.promptForKeyFile();
|
|
46
47
|
}
|
|
47
48
|
else if (answer === 'layersToRun') {
|
|
48
|
-
await shutdownNodeIfRunning();
|
|
49
|
+
await promptHelper.shutdownNodeIfRunning();
|
|
49
50
|
await promptHelper.selectLayers();
|
|
50
51
|
await checkProject.configureJavaMemoryArguments();
|
|
51
52
|
}
|
|
52
53
|
else if (answer === 'network') {
|
|
53
|
-
|
|
54
|
+
clm.warn('Changing the network will DELETE all the data and logs from the validator node.');
|
|
55
|
+
await promptHelper.doYouWishToContinue();
|
|
56
|
+
const { layersToRun } = configStore.getProjectInfo();
|
|
57
|
+
await projectHelper.cleanup(layersToRun, true, true, true);
|
|
54
58
|
await promptHelper.selectNetwork();
|
|
59
|
+
await checkNodePilot.checkVersion(); // each network may have its own release
|
|
55
60
|
await checkProject.runInstall();
|
|
56
61
|
}
|
|
57
62
|
}
|
|
58
63
|
}
|
|
59
|
-
async function shutdownNodeIfRunning() {
|
|
60
|
-
if (await dockerService.isRunning()) {
|
|
61
|
-
clm.preStep('The validator node must be stopped first.');
|
|
62
|
-
await promptHelper.doYouWishToContinue();
|
|
63
|
-
await dockerService.dockerDown();
|
|
64
|
-
}
|
|
65
|
-
}
|
package/dist/commands/restart.js
CHANGED
|
@@ -97,7 +97,7 @@ export default class Restart extends BaseCommand {
|
|
|
97
97
|
process.exit(0);
|
|
98
98
|
}
|
|
99
99
|
process.on("exit", () => {
|
|
100
|
-
serviceLog.log('exiting, clearing isRestarting flag');
|
|
100
|
+
// serviceLog.log('exiting, clearing isRestarting flag');
|
|
101
101
|
configStore.setIsRestarting(0);
|
|
102
102
|
});
|
|
103
103
|
configStore.setIsRestarting(Date.now());
|
package/dist/commands/test.js
CHANGED
|
@@ -19,6 +19,7 @@ export default class Test extends Command {
|
|
|
19
19
|
// await archiverService.syncToLatestSnapshot();
|
|
20
20
|
// await archiverService.checkLogsForMissingSnapshots();
|
|
21
21
|
await StatusTable.run();
|
|
22
|
+
// console.log(semver.parse("0.11.0-testnet")?.compare('0.11.0'));
|
|
22
23
|
// await checkNodePilot.checkVersion();
|
|
23
24
|
}
|
|
24
25
|
async testRandomNode() {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { TessellationLayer } from "../types.js";
|
|
2
2
|
export declare const projectHelper: {
|
|
3
|
+
cleanup(layers: TessellationLayer[], deleteData: boolean, deleteLogs: boolean, deleteJars: boolean): Promise<void>;
|
|
3
4
|
generateLayerEnvFiles(layers?: TessellationLayer[]): Promise<void>;
|
|
4
5
|
importEnvFiles(): void;
|
|
5
6
|
installEmbedded(name: string): Promise<void>;
|
|
@@ -9,7 +9,31 @@ import { githubService } from "../services/github-service.js";
|
|
|
9
9
|
import { shellService } from "../services/shell-service.js";
|
|
10
10
|
import { configHelper } from "./config-helper.js";
|
|
11
11
|
import { getLayerEnvFileContent } from "./env-templates.js";
|
|
12
|
+
import { promptHelper } from "./prompt-helper.js";
|
|
12
13
|
export const projectHelper = {
|
|
14
|
+
async cleanup(layers, deleteData, deleteLogs, deleteJars) {
|
|
15
|
+
await promptHelper.shutdownNodeIfRunning();
|
|
16
|
+
clm.preStep('Requesting sudo permission to remove files...');
|
|
17
|
+
for (const layer of layers) {
|
|
18
|
+
if (deleteData) {
|
|
19
|
+
// eslint-disable-next-line no-await-in-loop
|
|
20
|
+
await shellService.runProjectCommand(`sudo rm -rf ${layer}/data`);
|
|
21
|
+
if (layer === 'gl0') {
|
|
22
|
+
this.prepareDataFolder();
|
|
23
|
+
configStore.setProjectFlag('discordChecked', false);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
if (deleteLogs) {
|
|
27
|
+
// eslint-disable-next-line no-await-in-loop
|
|
28
|
+
await shellService.runProjectCommand(`sudo rm -rf ${layer}/logs`);
|
|
29
|
+
}
|
|
30
|
+
if (deleteJars) {
|
|
31
|
+
// eslint-disable-next-line no-await-in-loop
|
|
32
|
+
await shellService.runProjectCommand(`sudo rm -rf ${layer}/dist`);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
clm.postStep('Cleanup complete');
|
|
36
|
+
},
|
|
13
37
|
async generateLayerEnvFiles(layers) {
|
|
14
38
|
const { layersToRun, projectDir } = configStore.getProjectInfo();
|
|
15
39
|
const { type: network } = configStore.getNetworkInfo();
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { checkbox, input, select } from "@inquirer/prompts";
|
|
2
2
|
import chalk from "chalk";
|
|
3
|
+
import { clm } from "../clm.js";
|
|
3
4
|
import { configStore } from "../config-store.js";
|
|
5
|
+
import { dockerService } from "../services/docker-service.js";
|
|
6
|
+
import { nodeService } from "../services/node-service.js";
|
|
4
7
|
export const promptHelper = {
|
|
5
8
|
async confirmPrompt(msg) {
|
|
6
9
|
const result = await input({
|
|
@@ -57,5 +60,14 @@ export const promptHelper = {
|
|
|
57
60
|
configStore.setNetworkInfo({ type: networkType, version: "latest" });
|
|
58
61
|
configStore.setProjectFlag('duplicateNodeIdChecked', false);
|
|
59
62
|
configStore.setProjectFlag('seedListChecked', false);
|
|
63
|
+
configStore.setProjectFlag('javaMemoryChecked', false);
|
|
64
|
+
},
|
|
65
|
+
async shutdownNodeIfRunning() {
|
|
66
|
+
if (await dockerService.isRunning()) {
|
|
67
|
+
clm.preStep('The validator node must be stopped first.');
|
|
68
|
+
await promptHelper.doYouWishToContinue();
|
|
69
|
+
await nodeService.leaveClusterAllLayers().catch();
|
|
70
|
+
await dockerService.dockerDown();
|
|
71
|
+
}
|
|
60
72
|
}
|
|
61
73
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { input } from "@inquirer/prompts";
|
|
2
|
+
import ora from "ora";
|
|
2
3
|
import { clm } from "../clm.js";
|
|
3
4
|
import { configStore } from "../config-store.js";
|
|
4
5
|
import { FastforwardService } from "./fastforward-service.js";
|
|
@@ -22,7 +23,11 @@ export const clusterService = {
|
|
|
22
23
|
}
|
|
23
24
|
configStore.setProjectInfo({ fastForward: true });
|
|
24
25
|
// }
|
|
26
|
+
const spinner = ora('Downloading latest snapshot...');
|
|
27
|
+
spinner.start();
|
|
28
|
+
spinner.color = 'green';
|
|
25
29
|
await FastforwardService.synctoLatestSnapshot();
|
|
30
|
+
spinner.stop();
|
|
26
31
|
},
|
|
27
32
|
async getClusterInfo(layer) {
|
|
28
33
|
return this.makeClusterRequest('cluster/info', layer);
|
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.11.0",
|
|
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"
|
|
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.25"
|
|
43
43
|
|
|
44
44
|
# Add entrypoint
|
|
45
45
|
COPY ./entrypoint.sh /app/entrypoint.sh
|