@constellation-network/node-pilot 0.0.8 → 0.0.9
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 +22 -15
- package/bin/dev.js +1 -6
- package/bin/run.js +1 -1
- package/dist/base-command.d.ts +9 -0
- package/dist/base-command.js +20 -0
- package/dist/checks/check-hardware.js +3 -3
- package/dist/checks/check-layers.js +7 -7
- package/dist/checks/check-network.d.ts +2 -0
- package/dist/checks/check-network.js +46 -11
- package/dist/checks/check-node-ctl.js +4 -4
- package/dist/checks/check-project.js +13 -8
- package/dist/checks/check-wallet.d.ts +3 -0
- package/dist/checks/check-wallet.js +37 -0
- package/dist/clm.d.ts +1 -0
- package/dist/clm.js +3 -0
- package/dist/commands/config/get.d.ts +6 -0
- package/dist/commands/config/get.js +57 -11
- package/dist/commands/config/set.d.ts +0 -1
- package/dist/commands/config/set.js +13 -11
- package/dist/commands/config.js +17 -22
- package/dist/commands/info.js +3 -2
- package/dist/commands/logs.d.ts +1 -1
- package/dist/commands/logs.js +7 -3
- package/dist/commands/restart.d.ts +5 -2
- package/dist/commands/restart.js +25 -5
- package/dist/commands/shutdown.js +3 -3
- package/dist/commands/status.js +4 -0
- package/dist/commands/test.js +11 -3
- package/dist/config-store.d.ts +43 -30
- package/dist/config-store.js +71 -33
- package/dist/helpers/config-helper.js +2 -2
- package/dist/helpers/env-templates.d.ts +4 -3
- package/dist/helpers/env-templates.js +28 -20
- package/dist/helpers/key-file-helper.d.ts +2 -0
- package/dist/helpers/key-file-helper.js +51 -16
- package/dist/helpers/project-helper.d.ts +2 -2
- package/dist/helpers/project-helper.js +37 -38
- package/dist/helpers/prompt-helper.d.ts +0 -1
- package/dist/helpers/prompt-helper.js +15 -15
- package/dist/services/archiver-service.d.ts +17 -0
- package/dist/services/archiver-service.js +104 -0
- package/dist/services/cluster-service.d.ts +10 -6
- package/dist/services/cluster-service.js +45 -45
- package/dist/services/docker-service.d.ts +9 -0
- package/dist/{helpers/docker-helper.js → services/docker-service.js} +8 -5
- package/dist/services/fastforward-service.js +3 -3
- package/dist/services/get-random-node.js +1 -1
- package/dist/{helpers/github-helper.d.ts → services/github-service.d.ts} +1 -1
- package/dist/{helpers/github-helper.js → services/github-service.js} +1 -1
- package/dist/services/node-service.js +14 -14
- package/dist/test.d.ts +1 -0
- package/dist/test.js +50 -0
- package/dist/types.d.ts +6 -0
- package/install-dependencies.sh +0 -2
- package/oclif.manifest.json +23 -4
- package/package.json +9 -8
- package/projects/hypergraph/Dockerfile +27 -18
- package/projects/hypergraph/docker-compose.yml +14 -12
- package/projects/hypergraph/networks/integrationnet/gl0.env +4 -0
- package/projects/hypergraph/networks/integrationnet/gl1.env +4 -0
- package/projects/hypergraph/networks/integrationnet/network.env +8 -0
- package/projects/hypergraph/networks/{integrationnet.env → integrationnet/source-nodes.env} +1 -9
- package/projects/hypergraph/networks/mainnet/gl0.env +4 -0
- package/projects/hypergraph/networks/mainnet/gl1.env +4 -0
- package/projects/hypergraph/networks/mainnet/network.env +8 -0
- package/projects/hypergraph/networks/{mainnet.env → mainnet/source-nodes.env} +0 -8
- package/projects/hypergraph/networks/testnet/gl0.env +5 -0
- package/projects/hypergraph/networks/testnet/gl1.env +4 -0
- package/projects/hypergraph/networks/testnet/network.env +8 -0
- package/projects/hypergraph/networks/{testnet.env → testnet/source-nodes.env} +0 -8
- package/projects/hypergraph/scripts/check-version.sh +31 -0
- package/projects/hypergraph/scripts/docker-build.sh +12 -1
- package/projects/hypergraph/scripts/install.sh +30 -25
- package/projects/hypergraph/seedlist +268 -0
- package/scripts/autoheal.sh +8 -0
- package/scripts/services/io.constellationnetwork.nodepilot.Updater.plist +16 -0
- package/scripts/services/node-pilot-autoheal.service +14 -0
- package/scripts/services/node-pilot-updater-hypergraph.service +15 -0
- package/scripts/updater.sh +13 -0
- package/dist/helpers/docker-helper.d.ts +0 -7
- package/projects/hypergraph/layers/gl1.env +0 -3
- package/projects/scripts/docker-cleanup.sh +0 -64
@@ -1,4 +1,5 @@
|
|
1
1
|
import { input } from "@inquirer/prompts";
|
2
|
+
import { clm } from "../clm.js";
|
2
3
|
import { configStore } from "../config-store.js";
|
3
4
|
import { FastforwardService } from "./fastforward-service.js";
|
4
5
|
export const clusterService = {
|
@@ -21,57 +22,56 @@ export const clusterService = {
|
|
21
22
|
configStore.setProjectInfo({ fastForward: true });
|
22
23
|
}
|
23
24
|
await FastforwardService.synctoLatestSnapshot();
|
25
|
+
// await archiverService.syncToLatestSnapshot()
|
26
|
+
// .catch(() => {
|
27
|
+
// clm.warn(`Failed to download latest snapshots using Starchiver. Using fast forward to latest snapshot.`);
|
28
|
+
// clusterService.fastForwardSnapshot();
|
29
|
+
// })
|
24
30
|
},
|
25
|
-
async getClusterInfo() {
|
26
|
-
|
27
|
-
return fetch(`https://l0-lb-${type}.constellationnetwork.io/cluster/info`)
|
28
|
-
.then(res => {
|
29
|
-
if (res.ok)
|
30
|
-
return res.json();
|
31
|
-
throw new Error(`Failed`);
|
32
|
-
})
|
33
|
-
.catch(() => []);
|
31
|
+
async getClusterInfo(layer) {
|
32
|
+
return this.makeClusterRequest('cluster/info', layer);
|
34
33
|
},
|
35
|
-
async
|
36
|
-
|
37
|
-
return fetch(`https://l0-lb-${type}.constellationnetwork.io/consensus/latest/peers`)
|
38
|
-
.then(res => {
|
39
|
-
if (res.ok)
|
40
|
-
return res.json();
|
41
|
-
return 0;
|
42
|
-
})
|
43
|
-
.catch(() => 0);
|
34
|
+
async getClusterNodeInfo(layer) {
|
35
|
+
return this.makeClusterRequest('node/info', layer);
|
44
36
|
},
|
45
|
-
async
|
46
|
-
|
47
|
-
return fetch(`https://l0-lb-${type}.constellationnetwork.io/global-snapshots/latest`)
|
48
|
-
.then(res => {
|
49
|
-
if (res.ok)
|
50
|
-
return res.json().then(i => (i?.value?.ordinal || 0));
|
51
|
-
return 0;
|
52
|
-
})
|
53
|
-
.catch(() => 0);
|
37
|
+
async getLatestConsensusInfo(layer) {
|
38
|
+
return this.makeClusterRequest('consensus/latest/peers', layer);
|
54
39
|
},
|
55
|
-
|
56
|
-
|
57
|
-
return fetch(`https://l0-lb-${type}.constellationnetwork.io/node/info`)
|
58
|
-
.then(res => {
|
59
|
-
if (res.ok)
|
60
|
-
return res.json();
|
61
|
-
throw new Error(`Failed`);
|
62
|
-
})
|
63
|
-
.catch(() => ({ state: "Unavailable" }));
|
40
|
+
getLayer0() {
|
41
|
+
return configStore.getProjectInfo().layersToRun.includes('gl0') ? 'gl0' : 'ml0';
|
64
42
|
},
|
65
43
|
async getReleaseVersion() {
|
66
|
-
return this.
|
44
|
+
return this.getClusterNodeInfo().then(i => i.version);
|
45
|
+
},
|
46
|
+
async getSourceNodeInfo(layer) {
|
47
|
+
return this.makeSourceNodeRequest('node/info', layer);
|
48
|
+
},
|
49
|
+
async getSourceNodeLatestOrdinal(layer) {
|
50
|
+
return this.makeSourceNodeRequest('global-snapshots/latest', layer).then(i => i.value.ordinal);
|
67
51
|
},
|
68
|
-
async
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
52
|
+
async getSourceNodeOrdinalHash(layer, ordinal) {
|
53
|
+
return this.makeSourceNodeRequest(`global-snapshots/${ordinal}/hash`, layer);
|
54
|
+
},
|
55
|
+
async makeClusterRequest(path, layer) {
|
56
|
+
layer = layer || this.getLayer0();
|
57
|
+
const { type } = configStore.getNetworkInfo();
|
58
|
+
const envLayerInfo = configStore.getEnvLayerInfo(type, layer);
|
59
|
+
if (envLayerInfo.CL_LB) {
|
60
|
+
return fetch(`${envLayerInfo.CL_LB}/${path}`)
|
61
|
+
.then(res => res.json())
|
62
|
+
.catch(() => {
|
63
|
+
clm.debug(`Failed to get node info from ${envLayerInfo.CL_LB}. Attempting source node...`);
|
64
|
+
return this.makeSourceNodeRequest(path, layer);
|
65
|
+
});
|
66
|
+
}
|
67
|
+
return this.makeSourceNodeRequest(path, layer);
|
68
|
+
},
|
69
|
+
async makeSourceNodeRequest(path, layer) {
|
70
|
+
const { type } = configStore.getNetworkInfo();
|
71
|
+
const { CL_PUBLIC_HTTP_PORT } = configStore.getEnvLayerInfo(type, layer);
|
72
|
+
const { CL_L0_PEER_HTTP_HOST } = configStore.getEnvNetworkInfo(type);
|
73
|
+
clm.debug(`http://${CL_L0_PEER_HTTP_HOST}:${CL_PUBLIC_HTTP_PORT}/${path}`);
|
74
|
+
return fetch(`http://${CL_L0_PEER_HTTP_HOST}:${CL_PUBLIC_HTTP_PORT}/${path}`)
|
75
|
+
.then(res => res.json());
|
76
76
|
}
|
77
77
|
};
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import { TessellationLayer } from "../types.js";
|
2
|
+
export declare const dockerService: {
|
3
|
+
dockerBuild(): Promise<void>;
|
4
|
+
dockerDown(): Promise<void>;
|
5
|
+
dockerRestart(layer: TessellationLayer): Promise<void>;
|
6
|
+
dockerStartLayers(layers: TessellationLayer[]): Promise<void>;
|
7
|
+
dockerUp(): Promise<void>;
|
8
|
+
isRunning(): Promise<boolean>;
|
9
|
+
};
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import ora from "ora";
|
2
2
|
import { clm } from "../clm.js";
|
3
3
|
import { configStore } from "../config-store.js";
|
4
|
-
import {
|
5
|
-
import {
|
6
|
-
export const
|
4
|
+
import { projectHelper } from "../helpers/project-helper.js";
|
5
|
+
import { shellService } from "./shell-service.js";
|
6
|
+
export const dockerService = {
|
7
7
|
async dockerBuild() {
|
8
8
|
if (shellService.existsProjectScript('scripts/docker-build.sh')) {
|
9
9
|
const silent = !process.env.DEBUG;
|
@@ -25,8 +25,11 @@ export const dockerHelper = {
|
|
25
25
|
async dockerDown() {
|
26
26
|
await run('down');
|
27
27
|
},
|
28
|
-
async dockerRestart() {
|
29
|
-
await run('restart');
|
28
|
+
async dockerRestart(layer) {
|
29
|
+
await run('restart', [layer]);
|
30
|
+
},
|
31
|
+
async dockerStartLayers(layers) {
|
32
|
+
await run('up -d', layers);
|
30
33
|
},
|
31
34
|
async dockerUp() {
|
32
35
|
// If docker is already running, stop it
|
@@ -19,9 +19,9 @@ export class FastforwardService {
|
|
19
19
|
this.dataDir = path.join(projectDir, 'app-data', 'gl0-data'); // gl0
|
20
20
|
fs.mkdirSync(this.tmpDir, { recursive: true });
|
21
21
|
fs.mkdirSync(this.dataDir, { recursive: true });
|
22
|
-
const env = configStore.
|
22
|
+
const env = configStore.getEnvNetworkInfo(type);
|
23
23
|
// this.lbUrl = `https://l0-lb-${this.network}.constellationnetwork.io`;
|
24
|
-
this.lbUrl = `http://${env.
|
24
|
+
this.lbUrl = `http://${env.CL_L0_PEER_HTTP_HOST}:${env.CL_L0_PEER_HTTP_PORT}`;
|
25
25
|
}
|
26
26
|
static async synctoLatestSnapshot() {
|
27
27
|
const ffs = new FastforwardService();
|
@@ -38,7 +38,7 @@ export class FastforwardService {
|
|
38
38
|
fs.writeFileSync(path.join(snapshotInfoDir, ordinal.toString()), compressedSnapshotInfo);
|
39
39
|
fs.writeFileSync(path.join(this.tmpDir, ordinal.toString() + '.c'), compressedSnapshotIncremental);
|
40
40
|
await this.saveSnapshotFiles(ordinal.toString(), hash);
|
41
|
-
clm.postStep(
|
41
|
+
clm.postStep(`Fastforward to snapshot "${ordinal}" completed.`);
|
42
42
|
}
|
43
43
|
async fetchLatestSnapshot() {
|
44
44
|
const url = `${this.lbUrl}/global-snapshots/latest/combined`;
|
@@ -1,7 +1,7 @@
|
|
1
1
|
export const getRandomNode = (nodes) => {
|
2
2
|
const randomNodeIndex = Math.floor(Math.random() * nodes.length);
|
3
3
|
const node = nodes[randomNodeIndex];
|
4
|
-
console.log(`Getting random node from ${nodes.length} nodes: ${node.host}`);
|
4
|
+
console.log(`Getting random node from ${nodes.length} nodes: ${node.host}:${node.publicPort}`);
|
5
5
|
return fetch(`http://${node.host}:${node.publicPort}/node/info`)
|
6
6
|
.then(async (res) => {
|
7
7
|
if (res.ok)
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import chalk from "chalk";
|
1
2
|
import { clm } from "../clm.js";
|
2
3
|
import { configStore } from "../config-store.js";
|
3
4
|
import { clusterService } from "./cluster-service.js";
|
@@ -48,7 +49,7 @@ export const nodeService = {
|
|
48
49
|
return;
|
49
50
|
}
|
50
51
|
const layerPortInfo = configStore.getLayerPortInfo(layer);
|
51
|
-
const peerInfo = await clusterService.
|
52
|
+
const peerInfo = await clusterService.getClusterNodeInfo(layer);
|
52
53
|
const nodeId = peerInfo.id;
|
53
54
|
const nodeIp = peerInfo.host;
|
54
55
|
const cliPort = layerPortInfo.CLI;
|
@@ -105,25 +106,24 @@ export const nodeService = {
|
|
105
106
|
for (let i = 1; i <= 60; i++) {
|
106
107
|
// eslint-disable-next-line no-await-in-loop
|
107
108
|
const { state } = await this.getNodeInfo(layer);
|
108
|
-
if (state === "Unavailable" || state === "ReadyToJoin")
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
clm.echo(` [${layer}] Attempt ${i}: Current state is "${state}"`);
|
115
|
-
}
|
116
|
-
else {
|
117
|
-
clm.echo(` [${layer}] Attempt ${i}: Current state is "${state}"`);
|
118
|
-
}
|
109
|
+
if (expectedState === 'Offline' && (state === "Unavailable" || state === "ReadyToJoin" || state === "SessionStarted"))
|
110
|
+
return true;
|
111
|
+
clm.echoRepeatLine(`[${layer}] ${chalk.bgGray.cyan('Attempt ' + i)}: Current state is "${state}" `);
|
112
|
+
// eslint-disable-next-line no-await-in-loop
|
113
|
+
await sleep(0.5);
|
114
|
+
clm.echoRepeatLine(`[${layer}] Attempt ${i}: Current state is "${state}" `);
|
119
115
|
if (state === expectedState) {
|
120
|
-
clm.postStep(
|
116
|
+
clm.postStep(`${layer} is ${expectedState}`);
|
121
117
|
return true;
|
122
118
|
}
|
119
|
+
if (state === "Unavailable" && i > 2) {
|
120
|
+
clm.warn(`${layer} is not connectable. Please try again later.`);
|
121
|
+
return false;
|
122
|
+
}
|
123
123
|
// eslint-disable-next-line no-await-in-loop
|
124
124
|
await sleep(5);
|
125
125
|
}
|
126
|
-
clm.warn(
|
126
|
+
clm.warn(`${layer} is not ${expectedState} after 5 minutes`);
|
127
127
|
return false;
|
128
128
|
}
|
129
129
|
};
|
package/dist/test.d.ts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
package/dist/test.js
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
import * as crypto from "node:crypto";
|
2
|
+
// convert base64 to hex
|
3
|
+
const val = 'MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgeYLAOmnJ6FYQ3Uddr6lq5PEVgoiAdWIJ89x6fx3n8JihRANCAASNoaVq/vT5k5Akdzjv8ifybl9icGnMKRpeyZhOxTMnwxGjxANTuKLfUGWUOEngV6HaWGxgkXTU/VXRma+mu0hD';
|
4
|
+
// const val = 'MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgKy/2tKuoO5V0iXJmTlaWPl9PeDo8TO5ZD+JmD3pOlzihRANCAASffXYMsILTOYSM4pEuBiYO1RR/hfuO+k4WvnNup21HT7CGThWfRjIemS3QDMHncK0Shsy43nb6kD9Fo8DTKpI6';
|
5
|
+
const der = Buffer.from(val, 'base64').toString('hex');
|
6
|
+
console.log(der);
|
7
|
+
// convert DER to PEM
|
8
|
+
const ecKey = crypto.createPrivateKey({
|
9
|
+
encoding: "base64",
|
10
|
+
format: "der",
|
11
|
+
key: val,
|
12
|
+
type: "pkcs8",
|
13
|
+
});
|
14
|
+
console.log(ecKey.export({ 'format': 'jwk' }));
|
15
|
+
// Generate an RSA key pair
|
16
|
+
const { privateKey, publicKey } = crypto.generateKeyPairSync('rsa', {
|
17
|
+
modulusLength: 2048, // Recommended key size
|
18
|
+
privateKeyEncoding: {
|
19
|
+
format: 'der', // DER encoding for binary output
|
20
|
+
type: 'pkcs8' // PKCS#8 format
|
21
|
+
},
|
22
|
+
publicKeyEncoding: {
|
23
|
+
format: 'der',
|
24
|
+
type: 'spki' // SubjectPublicKeyInfo
|
25
|
+
}
|
26
|
+
});
|
27
|
+
// The 'privateKey' variable now holds a Buffer containing the PKCS#8 DER private key.
|
28
|
+
// To get the Base64 encoded string:
|
29
|
+
const privateKeyBase64 = privateKey.toString('base64');
|
30
|
+
console.log('PKCS#8 DER Private Key (Base64):');
|
31
|
+
console.log(privateKeyBase64);
|
32
|
+
// openssl pkcs8 -inform DER -in privatekey.der -outform PEM -out privatekey.pem
|
33
|
+
// openssl pkcs8 -inform DER -in privatekey.der -nocrypt -out privatekey.pem -traditional
|
34
|
+
async function createP256Pkcs8DerBase64PrivateKey() {
|
35
|
+
// Generate an ECDSA key pair with the P-256 named curve
|
36
|
+
const keyPair = await crypto.subtle.generateKey({
|
37
|
+
name: 'ECDSA',
|
38
|
+
namedCurve: 'P-256',
|
39
|
+
}, true, // extractable
|
40
|
+
['sign', 'verify']);
|
41
|
+
// Export the private key in PKCS#8 DER format
|
42
|
+
const privateKeyDerBuffer = await crypto.subtle.exportKey('pkcs8', // format
|
43
|
+
keyPair.privateKey);
|
44
|
+
console.log('PKCS#8 DER Private Key (DER Buffer): ' + Buffer.from(privateKeyDerBuffer).toString('hex'));
|
45
|
+
// Convert the DER buffer to a Base64 encoded string
|
46
|
+
const privateKeyBase64 = Buffer.from(privateKeyDerBuffer).toString('base64');
|
47
|
+
console.log('PKCS#8 DER Private Key (Base64):' + privateKeyBase64);
|
48
|
+
return privateKeyBase64;
|
49
|
+
}
|
50
|
+
await createP256Pkcs8DerBase64PrivateKey();
|
package/dist/types.d.ts
CHANGED
@@ -32,6 +32,12 @@ export type ClusterConsensusInfo = {
|
|
32
32
|
state: 'Ready';
|
33
33
|
}[];
|
34
34
|
};
|
35
|
+
export type ClusterStats = {
|
36
|
+
ordinal: number;
|
37
|
+
ready: number;
|
38
|
+
startTime: string;
|
39
|
+
total: number;
|
40
|
+
};
|
35
41
|
export type NodeStatusInfo = {
|
36
42
|
clusterSession: string;
|
37
43
|
id: string;
|
package/install-dependencies.sh
CHANGED
@@ -59,8 +59,6 @@ check_docker() {
|
|
59
59
|
fi
|
60
60
|
|
61
61
|
echo "⚠️ Docker not found. Will attempt to install Docker."
|
62
|
-
|
63
|
-
# curl -fsSL https://raw.githubusercontent.com/Constellation-Labs/node-pilot/refs/heads/main/install.sh -o install-node-pilot.sh; source install-node-pilot.sh
|
64
62
|
|
65
63
|
case "$(uname)" in
|
66
64
|
Linux)
|
package/oclif.manifest.json
CHANGED
@@ -51,7 +51,8 @@
|
|
51
51
|
"args": {
|
52
52
|
"layer": {
|
53
53
|
"description": "network layer to view. e.g. gl0",
|
54
|
-
"name": "layer"
|
54
|
+
"name": "layer",
|
55
|
+
"required": true
|
55
56
|
}
|
56
57
|
},
|
57
58
|
"description": "view validator node runtime logs",
|
@@ -92,12 +93,30 @@
|
|
92
93
|
},
|
93
94
|
"restart": {
|
94
95
|
"aliases": [],
|
95
|
-
"args": {
|
96
|
+
"args": {
|
97
|
+
"layer": {
|
98
|
+
"description": "network layer to view. e.g. gl0",
|
99
|
+
"name": "layer"
|
100
|
+
}
|
101
|
+
},
|
96
102
|
"description": "A full shutdown of the validator node, then restart",
|
97
103
|
"examples": [
|
98
104
|
"<%= config.bin %> <%= command.id %>"
|
99
105
|
],
|
100
|
-
"flags": {
|
106
|
+
"flags": {
|
107
|
+
"project": {
|
108
|
+
"char": "p",
|
109
|
+
"description": "Specify the project name to use",
|
110
|
+
"helpGroup": "GLOBAL",
|
111
|
+
"name": "project",
|
112
|
+
"hasDynamicHelp": false,
|
113
|
+
"multiple": false,
|
114
|
+
"options": [
|
115
|
+
"hypergraph"
|
116
|
+
],
|
117
|
+
"type": "option"
|
118
|
+
}
|
119
|
+
},
|
101
120
|
"hasDynamicHelp": false,
|
102
121
|
"hiddenAliases": [],
|
103
122
|
"id": "restart",
|
@@ -245,5 +264,5 @@
|
|
245
264
|
]
|
246
265
|
}
|
247
266
|
},
|
248
|
-
"version": "0.0.
|
267
|
+
"version": "0.0.9"
|
249
268
|
}
|
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.0.
|
4
|
+
"version": "0.0.9",
|
5
5
|
"author": "Frank Fox",
|
6
6
|
"bin": {
|
7
7
|
"cpilot": "bin/run.js"
|
@@ -63,13 +63,14 @@
|
|
63
63
|
"typescript": "^5"
|
64
64
|
},
|
65
65
|
"files": [
|
66
|
-
"
|
67
|
-
"
|
68
|
-
"
|
69
|
-
"
|
70
|
-
"
|
71
|
-
"
|
72
|
-
"
|
66
|
+
"bin",
|
67
|
+
"dist",
|
68
|
+
"oclif.manifest.json",
|
69
|
+
"install-dependencies.sh",
|
70
|
+
"projects",
|
71
|
+
"scripts",
|
72
|
+
"README.md",
|
73
|
+
"LICENSE"
|
73
74
|
],
|
74
75
|
"homepage": "https://github.com/Constellation-Labs/node-pilot",
|
75
76
|
"keywords": [
|
@@ -5,23 +5,28 @@ RUN apt update && apt install -y openjdk-11-jre
|
|
5
5
|
RUN apt install -y curl jq wget
|
6
6
|
|
7
7
|
# Install necessary dependencies for adding NodeSource repository
|
8
|
-
|
9
|
-
#
|
10
|
-
## Import the NodeSource GPG key
|
11
|
-
#RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
|
12
|
-
#
|
13
|
-
## Add the NodeSource repository for Node.js 22
|
14
|
-
#ENV NODE_MAJOR=22
|
15
|
-
#RUN echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list
|
16
|
-
#
|
17
|
-
## Update package lists and install Node.js and npm
|
18
|
-
#RUN apt-get update && apt-get install -y nodejs
|
19
|
-
#
|
20
|
-
## Verify the installation
|
21
|
-
#RUN node -v
|
22
|
-
#RUN npm -v
|
8
|
+
RUN apt-get update && apt-get install -y gnupg ca-certificates
|
23
9
|
|
10
|
+
# Import the NodeSource GPG key
|
11
|
+
RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
|
24
12
|
|
13
|
+
# Add the NodeSource repository for Node.js 22
|
14
|
+
ENV NODE_MAJOR=22
|
15
|
+
RUN echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list
|
16
|
+
|
17
|
+
# Update package lists and install Node.js and npm
|
18
|
+
RUN apt-get update && apt-get install -y nodejs
|
19
|
+
|
20
|
+
# Verify the installation
|
21
|
+
RUN node -v
|
22
|
+
RUN npm -v
|
23
|
+
|
24
|
+
# Create a directory for global npm packages
|
25
|
+
RUN mkdir -p /home/node/.npm-global
|
26
|
+
ENV NPM_CONFIG_PREFIX=/home/node/.npm-global
|
27
|
+
ENV PATH=$PATH:/home/node/.npm-global/bin
|
28
|
+
|
29
|
+
# Add app JARS
|
25
30
|
RUN mkdir -p /app/jars
|
26
31
|
|
27
32
|
COPY dist/keytool.jar /app/jars/keytool.jar
|
@@ -30,10 +35,14 @@ COPY dist/wallet.jar /app/jars/wallet.jar
|
|
30
35
|
COPY dist/gl1.jar /app/jars/gl1.jar
|
31
36
|
COPY dist/gl0.jar /app/jars/gl0.jar
|
32
37
|
|
33
|
-
|
34
|
-
|
35
|
-
#
|
38
|
+
# Add health-check
|
39
|
+
#COPY ./health-check /health-check
|
40
|
+
#RUN chmod +x /health-check/bin/run.sh
|
41
|
+
#RUN chmod +x /health-check/bin/hydrate.sh
|
42
|
+
RUN npm install -g "@constellation-network/node-pilot-health-check"
|
36
43
|
|
44
|
+
# Add entrypoint
|
45
|
+
COPY ./entrypoint.sh /app/entrypoint.sh
|
37
46
|
RUN chmod +x /app/entrypoint.sh
|
38
47
|
|
39
48
|
WORKDIR /app
|
@@ -3,12 +3,16 @@ networks:
|
|
3
3
|
driver: bridge
|
4
4
|
|
5
5
|
services:
|
6
|
+
autoheal:
|
7
|
+
image: willfarrell/autoheal
|
8
|
+
volumes:
|
9
|
+
- /var/run/docker.sock:/var/run/docker.sock
|
6
10
|
gl0:
|
7
11
|
image: constellationnetwork/tessellation${CL_DOCKER_CORE_REPO:-}:${DOCKER_IMAGE_VERSION:-latest}
|
8
12
|
container_name: gl0
|
9
13
|
networks:
|
10
14
|
- tessellation-network
|
11
|
-
|
15
|
+
restart: unless-stopped
|
12
16
|
env_file:
|
13
17
|
- gl0.env
|
14
18
|
ports:
|
@@ -19,18 +23,19 @@ services:
|
|
19
23
|
- ./seedlist:/app/seedlist:ro
|
20
24
|
- ./app-data/gl0-logs:/app/logs
|
21
25
|
- ./app-data/gl0-data:/app/data
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
26
|
+
healthcheck:
|
27
|
+
test: ["CMD", "cpilotHC"]
|
28
|
+
interval: 15s
|
29
|
+
retries: 1
|
30
|
+
timeout: 15s
|
31
|
+
start_period: 30s
|
28
32
|
profiles: ["gl0"]
|
29
|
-
|
33
|
+
labels:
|
34
|
+
autoheal: "true"
|
30
35
|
gl1:
|
31
36
|
image: constellationnetwork/tessellation${CL_DOCKER_CORE_REPO:-}:${DOCKER_IMAGE_VERSION:-latest}
|
32
37
|
container_name: gl1
|
33
|
-
|
38
|
+
restart: unless-stopped
|
34
39
|
networks:
|
35
40
|
- tessellation-network
|
36
41
|
env_file:
|
@@ -40,10 +45,8 @@ services:
|
|
40
45
|
- "9011:9011" # P2P HTTP
|
41
46
|
volumes:
|
42
47
|
- ./key.p12:/app/key.p12:ro
|
43
|
-
- ./seedlist:/app/seedlist:ro
|
44
48
|
- ./app-data/gl1-logs:/app/logs
|
45
49
|
- ./app-data/gl1-data:/app/data
|
46
|
-
- ${CL_DOCKER_PRIORITY_SEEDLIST:-/dev/null}:/app/priority-seedlist:ro
|
47
50
|
# healthcheck:
|
48
51
|
# test: ["CMD", "/app/internal-health-check.sh"]
|
49
52
|
# interval: 3s
|
@@ -51,4 +54,3 @@ services:
|
|
51
54
|
# retries: 5
|
52
55
|
# start_period: 10s
|
53
56
|
profiles: ["gl1"]
|
54
|
-
# user: ${DOCKER_USER_ID:-}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
CL_APP_ENV=integrationnet
|
2
|
+
CL_COLLATERAL=0
|
3
|
+
CL_L0_PEER_HTTP_HOST=13.52.205.240
|
4
|
+
CL_L0_PEER_ID=e2f4496e5872682d7a55aa06e507a58e96b5d48a5286bfdff7ed780fa464d9e789b2760ecd840f4cb3ee6e1c1d81b2ee844c88dbebf149b1084b7313eb680714
|
5
|
+
CL_L0_PEER_HTTP_PORT=9000
|
6
|
+
CL_GLOBAL_L0_PEER_HOST=13.52.205.240
|
7
|
+
CL_GLOBAL_L0_PEER_ID=e2f4496e5872682d7a55aa06e507a58e96b5d48a5286bfdff7ed780fa464d9e789b2760ecd840f4cb3ee6e1c1d81b2ee844c88dbebf149b1084b7313eb680714
|
8
|
+
CL_GLOBAL_L0_PEER_HTTP_PORT=9000
|
@@ -1,11 +1,3 @@
|
|
1
|
-
CL_APP_ENV=integrationnet
|
2
|
-
CL_COLLATERAL=0
|
3
|
-
CL_L0_PEER_HTTP_PORT=9000
|
4
|
-
CL_L0_PEER_HTTP_HOST=13.52.205.240
|
5
|
-
CL_L0_PEER_ID=e2f4496e5872682d7a55aa06e507a58e96b5d48a5286bfdff7ed780fa464d9e789b2760ecd840f4cb3ee6e1c1d81b2ee844c88dbebf149b1084b7313eb680714
|
6
|
-
CL_GLOBAL_L0_PEER_HTTP_PORT=9000
|
7
|
-
CL_GLOBAL_L0_PEER_HOST=13.52.205.240
|
8
|
-
CL_GLOBAL_L0_PEER_ID=e2f4496e5872682d7a55aa06e507a58e96b5d48a5286bfdff7ed780fa464d9e789b2760ecd840f4cb3ee6e1c1d81b2ee844c88dbebf149b1084b7313eb680714
|
9
1
|
SOURCE_NODE_1_PORT=9000
|
10
2
|
SOURCE_NODE_1_HOST=13.52.205.240
|
11
3
|
SOURCE_NODE_1_ID=e2f4496e5872682d7a55aa06e507a58e96b5d48a5286bfdff7ed780fa464d9e789b2760ecd840f4cb3ee6e1c1d81b2ee844c88dbebf149b1084b7313eb680714
|
@@ -14,4 +6,4 @@ SOURCE_NODE_2_HOST=50.18.155.22
|
|
14
6
|
SOURCE_NODE_2_ID=3458a688925a4bd89f2ac2c695362e44d2e0c2903bdbb41b341a4d39283b22d8c85b487bd33cc5d36dbe5e31b5b00a10a6eab802718ead4ed7192ade5a5d1941
|
15
7
|
SOURCE_NODE_3_PORT=9000
|
16
8
|
SOURCE_NODE_3_HOST=52.9.216.57
|
17
|
-
SOURCE_NODE_3_ID=46daea11ca239cb8c0c8cdeb27db9dbe9c03744908a8a389a60d14df2ddde409260a93334d74957331eec1af323f458b12b3a6c3b8e05885608aae7e3a77eac7
|
9
|
+
SOURCE_NODE_3_ID=46daea11ca239cb8c0c8cdeb27db9dbe9c03744908a8a389a60d14df2ddde409260a93334d74957331eec1af323f458b12b3a6c3b8e05885608aae7e3a77eac7
|
@@ -0,0 +1,8 @@
|
|
1
|
+
CL_APP_ENV=mainnet
|
2
|
+
CL_COLLATERAL=25000000000000
|
3
|
+
CL_L0_PEER_HTTP_PORT=9000
|
4
|
+
CL_L0_PEER_HTTP_HOST=52.53.46.33
|
5
|
+
CL_L0_PEER_ID=e0c1ee6ec43510f0e16d2969a7a7c074a5c8cdb477c074fe9c32a9aad8cbc8ff1dff60bb81923e0db437d2686a9b65b86c403e6a21fa32b6acc4e61be4d70925
|
6
|
+
#CL_GLOBAL_L0_PEER_HTTP_PORT=9000
|
7
|
+
#CL_GLOBAL_L0_PEER_HOST=52.53.46.33
|
8
|
+
#CL_GLOBAL_L0_PEER_ID=e0c1ee6ec43510f0e16d2969a7a7c074a5c8cdb477c074fe9c32a9aad8cbc8ff1dff60bb81923e0db437d2686a9b65b86c403e6a21fa32b6acc4e61be4d70925
|
@@ -1,11 +1,3 @@
|
|
1
|
-
CL_APP_ENV=mainnet
|
2
|
-
CL_COLLATERAL=25000000000000
|
3
|
-
CL_L0_PEER_HTTP_PORT=9000
|
4
|
-
CL_L0_PEER_HTTP_HOST=52.53.46.33
|
5
|
-
CL_L0_PEER_ID=e0c1ee6ec43510f0e16d2969a7a7c074a5c8cdb477c074fe9c32a9aad8cbc8ff1dff60bb81923e0db437d2686a9b65b86c403e6a21fa32b6acc4e61be4d70925
|
6
|
-
CL_GLOBAL_L0_PEER_HTTP_PORT=9000
|
7
|
-
CL_GLOBAL_L0_PEER_HOST=52.53.46.33
|
8
|
-
CL_GLOBAL_L0_PEER_ID=e0c1ee6ec43510f0e16d2969a7a7c074a5c8cdb477c074fe9c32a9aad8cbc8ff1dff60bb81923e0db437d2686a9b65b86c403e6a21fa32b6acc4e61be4d70925
|
9
1
|
SOURCE_NODE_1_PORT=9000
|
10
2
|
SOURCE_NODE_1_HOST=52.53.46.33
|
11
3
|
SOURCE_NODE_1_ID=e0c1ee6ec43510f0e16d2969a7a7c074a5c8cdb477c074fe9c32a9aad8cbc8ff1dff60bb81923e0db437d2686a9b65b86c403e6a21fa32b6acc4e61be4d70925
|
@@ -0,0 +1,8 @@
|
|
1
|
+
CL_APP_ENV=testnet
|
2
|
+
CL_COLLATERAL=0
|
3
|
+
CL_L0_PEER_HTTP_PORT=9000
|
4
|
+
CL_L0_PEER_HTTP_HOST=52.8.132.193
|
5
|
+
CL_L0_PEER_ID=e2f4496e5872682d7a55aa06e507a58e96b5d48a5286bfdff7ed780fa464d9e789b2760ecd840f4cb3ee6e1c1d81b2ee844c88dbebf149b1084b7313eb680714
|
6
|
+
#CL_GLOBAL_L0_PEER_HTTP_PORT=9000
|
7
|
+
#CL_GLOBAL_L0_PEER_HOST=52.8.132.193
|
8
|
+
#CL_GLOBAL_L0_PEER_ID=e2f4496e5872682d7a55aa06e507a58e96b5d48a5286bfdff7ed780fa464d9e789b2760ecd840f4cb3ee6e1c1d81b2ee844c88dbebf149b1084b7313eb680714
|
@@ -1,11 +1,3 @@
|
|
1
|
-
CL_APP_ENV=testnet
|
2
|
-
CL_COLLATERAL=0
|
3
|
-
CL_L0_PEER_HTTP_PORT=9000
|
4
|
-
CL_L0_PEER_HTTP_HOST=52.8.132.193
|
5
|
-
CL_L0_PEER_ID=e2f4496e5872682d7a55aa06e507a58e96b5d48a5286bfdff7ed780fa464d9e789b2760ecd840f4cb3ee6e1c1d81b2ee844c88dbebf149b1084b7313eb680714
|
6
|
-
CL_GLOBAL_L0_PEER_HTTP_PORT=9000
|
7
|
-
CL_GLOBAL_L0_PEER_HOST=52.8.132.193
|
8
|
-
CL_GLOBAL_L0_PEER_ID=e2f4496e5872682d7a55aa06e507a58e96b5d48a5286bfdff7ed780fa464d9e789b2760ecd840f4cb3ee6e1c1d81b2ee844c88dbebf149b1084b7313eb680714
|
9
1
|
SOURCE_NODE_1_PORT=9000
|
10
2
|
SOURCE_NODE_1_HOST=52.8.132.193
|
11
3
|
SOURCE_NODE_1_ID=e2f4496e5872682d7a55aa06e507a58e96b5d48a5286bfdff7ed780fa464d9e789b2760ecd840f4cb3ee6e1c1d81b2ee844c88dbebf149b1084b7313eb680714
|