@constellation-network/node-pilot 0.18.0-intnet → 0.18.1-intnet

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.
Files changed (44) hide show
  1. package/README.md +12 -16
  2. package/dist/base-command.d.ts +1 -1
  3. package/dist/base-command.js +13 -4
  4. package/dist/checks/check-hardware.js +2 -2
  5. package/dist/checks/check-initial-setup.js +2 -1
  6. package/dist/checks/check-network.js +0 -7
  7. package/dist/checks/check-project.js +6 -4
  8. package/dist/clm.js +2 -2
  9. package/dist/commands/config/get.js +8 -0
  10. package/dist/commands/config/set.js +5 -1
  11. package/dist/commands/config.js +8 -0
  12. package/dist/commands/info.js +6 -0
  13. package/dist/commands/project.d.ts +12 -0
  14. package/dist/commands/project.js +46 -0
  15. package/dist/commands/restart.d.ts +2 -2
  16. package/dist/commands/restart.js +15 -16
  17. package/dist/commands/shutdown.js +2 -1
  18. package/dist/commands/status.d.ts +1 -1
  19. package/dist/commands/status.js +1 -1
  20. package/dist/config-store.d.ts +12 -20
  21. package/dist/config-store.js +9 -116
  22. package/dist/helpers/config-helper.js +2 -1
  23. package/dist/helpers/pilot-manager.d.ts +23 -0
  24. package/dist/helpers/pilot-manager.js +170 -0
  25. package/dist/helpers/project-helper.d.ts +3 -2
  26. package/dist/helpers/project-helper.js +39 -17
  27. package/dist/helpers/prompt-helper.d.ts +1 -0
  28. package/dist/helpers/prompt-helper.js +15 -3
  29. package/dist/helpers/service-log.js +2 -2
  30. package/dist/helpers/status-table.js +5 -4
  31. package/dist/services/cluster-service.d.ts +2 -1
  32. package/dist/services/cluster-service.js +28 -7
  33. package/dist/services/docker-service.js +3 -2
  34. package/dist/services/node-service.js +3 -2
  35. package/oclif.manifest.json +42 -13
  36. package/package.json +1 -1
  37. package/projects/hypergraph/docker-compose.yml +8 -4
  38. package/projects/hypergraph/networks/integrationnet/gl0.env +2 -1
  39. package/projects/hypergraph/networks/integrationnet/gl1.env +4 -3
  40. package/projects/hypergraph/networks/mainnet/gl0.env +2 -1
  41. package/projects/hypergraph/networks/mainnet/gl1.env +2 -1
  42. package/projects/hypergraph/networks/testnet/gl0.env +1 -0
  43. package/projects/hypergraph/networks/testnet/gl1.env +1 -0
  44. package/projects/hypergraph/scripts/install-dependencies.sh +2 -2
@@ -30,7 +30,22 @@ export const clusterService = {
30
30
  spinner.stop();
31
31
  },
32
32
  async getClusterInfo(layer) {
33
- return this.makeClusterRequestGet('cluster/info', layer);
33
+ return this.makeClusterRequestGet('cluster/info', layer)
34
+ .then(cInfo => {
35
+ if (!isClusterReady(cInfo)) {
36
+ return this.makeClusterRequestGet('cluster/info', layer, '?sticky=true')
37
+ .then(cInfo => {
38
+ if (!isClusterReady(cInfo)) {
39
+ if (cInfo.length > 0) {
40
+ clm.warn(`Found ${cInfo.length} nodes in the cluster, but none are READY.`);
41
+ }
42
+ throw new Error(`Network is not connectable.`);
43
+ }
44
+ return cInfo;
45
+ });
46
+ }
47
+ return cInfo;
48
+ });
34
49
  },
35
50
  async getClusterNodeInfo(layer) {
36
51
  return this.makeClusterRequestGet('node/info', layer);
@@ -56,12 +71,12 @@ export const clusterService = {
56
71
  async getSourceNodeOrdinalHash(layer, ordinal) {
57
72
  return this.makeSourceNodeRequest(`global-snapshots/${ordinal}/hash`, layer);
58
73
  },
59
- async makeClusterRequestGet(path, layer) {
74
+ async makeClusterRequestGet(path, layer, params = '') {
60
75
  layer = layer || this.getLayer0();
61
76
  const { type } = configStore.getNetworkInfo();
62
77
  const envLayerInfo = configStore.getEnvLayerInfo(type, layer);
63
78
  if (envLayerInfo.CL_LB) {
64
- return fetch(`${envLayerInfo.CL_LB}/${path}`)
79
+ return fetch(`${envLayerInfo.CL_LB}/${path}${params}`)
65
80
  .then(res => {
66
81
  if (res.ok) {
67
82
  return res.json();
@@ -90,18 +105,24 @@ export const clusterService = {
90
105
  })
91
106
  .then(res => res.json());
92
107
  },
108
+ async makeRandomSourceNodeRequest(path, layer) {
109
+ return this.makeClusterRequestGet(path, layer, '?source_node=true&sticky=false');
110
+ },
93
111
  async makeSourceNodeRequest(path, layer) {
94
112
  const { type } = configStore.getNetworkInfo();
95
- const { CL_PUBLIC_HTTP_PORT } = configStore.getEnvLayerInfo(type, layer);
113
+ const { CL_SOURCE_HTTP_PORT } = configStore.getEnvLayerInfo(type, layer);
96
114
  const { CL_L0_PEER_HTTP_HOST } = configStore.getEnvNetworkInfo(type);
97
- clm.debug(`http://${CL_L0_PEER_HTTP_HOST}:${CL_PUBLIC_HTTP_PORT}/${path}`);
98
- return fetch(`http://${CL_L0_PEER_HTTP_HOST}:${CL_PUBLIC_HTTP_PORT}/${path}`)
115
+ clm.debug(`http://${CL_L0_PEER_HTTP_HOST}:${CL_SOURCE_HTTP_PORT}/${path}`);
116
+ return fetch(`http://${CL_L0_PEER_HTTP_HOST}:${CL_SOURCE_HTTP_PORT}/${path}`)
99
117
  .then(res => res.json())
100
118
  .catch(() => {
101
- throw new Error(`Unable to connect to source node at http://${CL_L0_PEER_HTTP_HOST}:${CL_PUBLIC_HTTP_PORT}/${path}`);
119
+ throw new Error(`Unable to connect to source node at http://${CL_L0_PEER_HTTP_HOST}:${CL_SOURCE_HTTP_PORT}/${path}`);
102
120
  });
103
121
  },
104
122
  async postNodeParams(body, layer) {
105
123
  return this.makeClusterRequestPost(`node-params`, body, layer);
106
124
  }
107
125
  };
126
+ function isClusterReady(info) {
127
+ return info.some(node => node.state === 'Ready');
128
+ }
@@ -1,6 +1,7 @@
1
1
  import ora from "ora";
2
2
  import { clm } from "../clm.js";
3
3
  import { configStore } from "../config-store.js";
4
+ import { pilotManager } from "../helpers/pilot-manager.js";
4
5
  import { projectHelper } from "../helpers/project-helper.js";
5
6
  import { shellService } from "./shell-service.js";
6
7
  export const dockerService = {
@@ -32,7 +33,7 @@ export const dockerService = {
32
33
  if (await this.isRunning()) {
33
34
  await this.dockerDown();
34
35
  }
35
- configStore.setProjectStatusToRunning(true);
36
+ pilotManager.setProjectStatusToRunning(true);
36
37
  await run('up -d');
37
38
  },
38
39
  async dockerStartLayers(layers) {
@@ -43,7 +44,7 @@ export const dockerService = {
43
44
  if (await this.isRunning()) {
44
45
  await this.dockerDown();
45
46
  }
46
- configStore.setProjectStatusToRunning(true);
47
+ pilotManager.setProjectStatusToRunning(true);
47
48
  await projectHelper.generateLayerEnvFiles();
48
49
  await run('up -d');
49
50
  },
@@ -1,6 +1,7 @@
1
1
  import chalk from "chalk";
2
2
  import { clm } from "../clm.js";
3
3
  import { configStore } from "../config-store.js";
4
+ import { pilotManager } from "../helpers/pilot-manager.js";
4
5
  import { clusterService } from "./cluster-service.js";
5
6
  import { shellService } from "./shell-service.js";
6
7
  export const nodeService = {
@@ -32,7 +33,7 @@ export const nodeService = {
32
33
  return layer;
33
34
  },
34
35
  async isPortExposed(port) {
35
- const command = configStore.getSystemInfo().platform === 'linux' ? `ss -tuln | grep 0.0.0.0:${port}` : `netstat -an | grep '*.${port}'`;
36
+ const command = pilotManager.getSystemInfo().platform === 'linux' ? `ss -tuln | grep 0.0.0.0:${port}` : `netstat -an | grep '*.${port}'`;
36
37
  return shellService.runCommandWithOutput(command).then(o => o.length > 0);
37
38
  },
38
39
  async isPortInUse(port) {
@@ -40,7 +41,7 @@ export const nodeService = {
40
41
  return shellService.runCommandWithOutput(`sudo lsof -i :${port}`).then(Boolean).catch(() => false);
41
42
  },
42
43
  async isPortOpen(port) {
43
- const command = configStore.getSystemInfo().platform === 'linux' ? `ss -tuln | grep :${port}` : `netstat -an | grep '.${port}'`;
44
+ const command = pilotManager.getSystemInfo().platform === 'linux' ? `ss -tuln | grep :${port}` : `netstat -an | grep '.${port}'`;
44
45
  return shellService.runCommandWithOutput(command).then(o => o.length > 0);
45
46
  },
46
47
  async joinCluster(layer) {
@@ -155,6 +155,47 @@
155
155
  "logs.js"
156
156
  ]
157
157
  },
158
+ "project": {
159
+ "aliases": [],
160
+ "args": {},
161
+ "description": "Create a new project, list all projects or change active project",
162
+ "examples": [
163
+ "<%= config.bin %> <%= command.id %>"
164
+ ],
165
+ "flags": {
166
+ "create": {
167
+ "char": "c",
168
+ "description": "create a new project with the given name",
169
+ "name": "create",
170
+ "hasDynamicHelp": false,
171
+ "multiple": false,
172
+ "type": "option"
173
+ },
174
+ "delete": {
175
+ "char": "d",
176
+ "description": "delete a project with the given name. WARNING: this will remove all data and logs associated with the project. Use with caution.",
177
+ "name": "delete",
178
+ "hasDynamicHelp": false,
179
+ "multiple": false,
180
+ "type": "option"
181
+ }
182
+ },
183
+ "hasDynamicHelp": false,
184
+ "hidden": true,
185
+ "hiddenAliases": [],
186
+ "id": "project",
187
+ "pluginAlias": "@constellation-network/node-pilot",
188
+ "pluginName": "@constellation-network/node-pilot",
189
+ "pluginType": "core",
190
+ "strict": true,
191
+ "enableJsonFlag": false,
192
+ "isESM": true,
193
+ "relativePath": [
194
+ "dist",
195
+ "commands",
196
+ "project.js"
197
+ ]
198
+ },
158
199
  "restart": {
159
200
  "aliases": [],
160
201
  "args": {
@@ -168,18 +209,6 @@
168
209
  "<%= config.bin %> <%= command.id %>"
169
210
  ],
170
211
  "flags": {
171
- "project": {
172
- "char": "p",
173
- "description": "Specify the project name to use",
174
- "helpGroup": "GLOBAL",
175
- "name": "project",
176
- "hasDynamicHelp": false,
177
- "multiple": false,
178
- "options": [
179
- "hypergraph"
180
- ],
181
- "type": "option"
182
- },
183
212
  "autostart": {
184
213
  "description": "restart each running project if it has been stopped",
185
214
  "name": "autostart",
@@ -363,5 +392,5 @@
363
392
  ]
364
393
  }
365
394
  },
366
- "version": "0.18.0-intnet"
395
+ "version": "0.18.1-intnet"
367
396
  }
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.18.0-intnet",
4
+ "version": "0.18.1-intnet",
5
5
  "author": "Frank Fox",
6
6
  "bin": {
7
7
  "cpilot": "bin/run.js"
@@ -15,8 +15,10 @@ services:
15
15
  env_file:
16
16
  - gl0.env
17
17
  ports:
18
- - "9000:9000" # Public HTTP
19
- - "9001:9001" # P2P HTTP
18
+ # - "9000:9000" # Public HTTP
19
+ # - "9001:9001" # P2P HTTP
20
+ - "${CL_GL0_PUBLIC_PORT:-9000}:${CL_GL0_PUBLIC_PORT:-9000}" # Public HTTP
21
+ - "${CL_GL0_P2P_PORT:-9001}:${CL_GL0_P2P_PORT:-9001}" # P2P HTTP
20
22
  volumes:
21
23
  - ./gl0/data:/app/data
22
24
  - ./gl0/logs:/app/logs
@@ -40,8 +42,10 @@ services:
40
42
  env_file:
41
43
  - gl1.env
42
44
  ports:
43
- - "9010:9010" # Public HTTP
44
- - "9011:9011" # P2P HTTP
45
+ # - "9010:9010" # Public HTTP
46
+ # - "9011:9011" # P2P HTTP
47
+ - "${CL_GL1_PUBLIC_PORT:-9010}:${CL_GL1_PUBLIC_PORT:-9010}" # Public HTTP
48
+ - "${CL_GL1_P2P_PORT:-9011}:${CL_GL1_P2P_PORT:-9011}" # P2P HTTP
45
49
  volumes:
46
50
  - ./gl1/data:/app/data
47
51
  - ./gl1/logs:/app/logs
@@ -1,4 +1,5 @@
1
1
  CL_LB=https://l0-lb-integrationnet.constellationnetwork.io
2
2
  CL_PUBLIC_HTTP_PORT=9000
3
3
  CL_P2P_HTTP_PORT=9001
4
- CL_CLI_HTTP_PORT=9002
4
+ CL_CLI_HTTP_PORT=9002
5
+ CL_SOURCE_HTTP_PORT=9000
@@ -1,4 +1,5 @@
1
1
  CL_LB=https://l1-lb-integrationnet.constellationnetwork.io
2
- CL_PUBLIC_HTTP_PORT=9010
3
- CL_P2P_HTTP_PORT=9011
4
- CL_CLI_HTTP_PORT=9012
2
+ CL_PUBLIC_HTTP_PORT=9100
3
+ CL_P2P_HTTP_PORT=9101
4
+ CL_CLI_HTTP_PORT=9102
5
+ CL_SOURCE_HTTP_PORT=9010
@@ -1,4 +1,5 @@
1
1
  CL_LB=https://l0-lb-mainnet.constellationnetwork.io
2
2
  CL_PUBLIC_HTTP_PORT=9000
3
3
  CL_P2P_HTTP_PORT=9001
4
- CL_CLI_HTTP_PORT=9002
4
+ CL_CLI_HTTP_PORT=9002
5
+ CL_SOURCE_HTTP_PORT=9000
@@ -1,4 +1,5 @@
1
1
  CL_LB=https://l1-lb-mainnet.constellationnetwork.io
2
2
  CL_PUBLIC_HTTP_PORT=9010
3
3
  CL_P2P_HTTP_PORT=9011
4
- CL_CLI_HTTP_PORT=9012
4
+ CL_CLI_HTTP_PORT=9012
5
+ CL_SOURCE_HTTP_PORT=9010
@@ -2,4 +2,5 @@ CL_LB=https://l0-lb-testnet.constellationnetwork.io
2
2
  CL_PUBLIC_HTTP_PORT=9000
3
3
  CL_P2P_HTTP_PORT=9001
4
4
  CL_CLI_HTTP_PORT=9002
5
+ CL_SOURCE_HTTP_PORT=9000
5
6
 
@@ -2,3 +2,4 @@ CL_LB=https://l1-lb-testnet.constellationnetwork.io
2
2
  CL_PUBLIC_HTTP_PORT=9010
3
3
  CL_P2P_HTTP_PORT=9011
4
4
  CL_CLI_HTTP_PORT=9012
5
+ CL_SOURCE_HTTP_PORT=9010
@@ -54,8 +54,8 @@ check_java() {
54
54
  Darwin)
55
55
  if command -v brew >/dev/null 2>&1; then
56
56
  echo "Installing Java 21 using Homebrew..."
57
- brew untap adoptopenjdk/openjdk
58
- brew install --cask temurin21
57
+ # if brew tap | grep -q '^adoptopenjdk/openjdk$'; then brew untap adoptopenjdk/openjdk; fi
58
+ brew install --cask temurin@21
59
59
  else
60
60
  echo "⚠️ Homebrew not found. Please install Java 21 manually."
61
61
  return 1