Skip to content

Commit

Permalink
Merge pull request #35 from vitelabs/niklr_nodes
Browse files Browse the repository at this point in the history
feat: allow start of multiple nodes
  • Loading branch information
KarlChristomer authored Sep 11, 2022
2 parents 5e3a6fd + 68eb6b4 commit feccec7
Show file tree
Hide file tree
Showing 24 changed files with 182 additions and 71 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ bin/gvite-*
bin/ledger
bin/gvite.log
tsconfig.tsbuildinfo
test/configs/temp
2 changes: 1 addition & 1 deletion bin/node_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"EntropyStorePassword": "123",
"VMTestEnabled": true,
"VMDebug": true,
"DataDir": "ledger",
"DataDir": "ledger/23456",
"KeyStoreDir": "./",
"SubscribeEnabled": true,
"OpenPlugins": true,
Expand Down
8 changes: 5 additions & 3 deletions bin/shutdown.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/bin/bash
pgrep gvite | xargs kill -9
pgrep gvite | xargs wait
# keep the debug logs in ./ledger/devdata util the next start
pgrep gvite | xargs kill -9 > /dev/null 2>&1
pgrep gvite | xargs wait > /dev/null 2>&1
SCRIPT_DIR=$(cd $(dirname ${BASH_SOURCE[0]}); pwd)
rm -rf $SCRIPT_DIR/ledger
rm -f $SCRIPT_DIR/gvite-*.log
11 changes: 4 additions & 7 deletions bin/startup.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
#!/bin/bash
SCRIPT_DIR=$(cd $(dirname ${BASH_SOURCE[0]}); pwd)
rm -rf $SCRIPT_DIR/ledger
rm -f $SCRIPT_DIR/gvite.log
BIN_FILE=gvite
CFG_FILE=node_config.json
if [ $# == 1 ]; then
BIN_FILE=$1
fi
if [ $# == 2 ]; then
LOG_FILE=gvite.log
if [ $# == 3 ]; then
BIN_FILE=$1
CFG_FILE=$2
LOG_FILE=$3
fi
cd $SCRIPT_DIR
exec ./$BIN_FILE --config $CFG_FILE --pprof > ./gvite.log
exec ./$BIN_FILE --config $CFG_FILE --pprof > ./$LOG_FILE
18 changes: 16 additions & 2 deletions lib/cli.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/cli.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions lib/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import * as utils from "./utils";
import { compile } from "./compiler";
import { loadViteConfig, updateNodeConfig } from "./config";
import { compile as compileLegacy } from "./legacyCompiler";
import { startLocalNetwork, newProvider, newAccount } from "./vite";
import { startLocalNetwork, stopLocalNetworks, newProvider, newAccount } from "./vite";
import { UserAccount } from "./user";
import { Contract } from "./contract";
export { compile, compileLegacy, loadViteConfig, updateNodeConfig, utils, startLocalNetwork, newProvider, newAccount, UserAccount, Contract, };
export { compile, compileLegacy, loadViteConfig, updateNodeConfig, utils, startLocalNetwork, stopLocalNetworks, newProvider, newAccount, UserAccount, Contract, };
//# sourceMappingURL=index.d.ts.map
2 changes: 1 addition & 1 deletion lib/index.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion lib/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/index.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions lib/node.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/// <reference types="node" />
import { ChildProcess } from "child_process";
export declare function init({ name, version, type, }: {
name?: String;
version: String;
Expand All @@ -6,9 +8,11 @@ export declare function init({ name, version, type, }: {
export declare function binName(name: String, version: String): string;
export declare function binPath(): string;
export declare class Node {
process?: ChildProcess;
httpUrl: string;
binPath: string;
binName: string;
logFileName: string;
nodeCfgPath: string;
provider?: any;
stopped: boolean;
Expand Down
2 changes: 1 addition & 1 deletion lib/node.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 20 additions & 14 deletions lib/node.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit feccec7

Please sign in to comment.