Skip to content

Commit a925dab

Browse files
committed
fix
1 parent 6355d2c commit a925dab

File tree

4 files changed

+18
-18
lines changed

4 files changed

+18
-18
lines changed

deployment-generator/src/gen.env

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11

2-
NETWORK_NAME=x
3-
NUM_SUBNET=4
2+
NETWORK_NAME=gg
3+
NUM_SUBNET=3
44
PARENTNET=testnet
5-
PARENTNET_WALLET_PK=0x7a75e19af1ca86ba47c8a4b05fc660786dc58ab5a278f115be33f927a7a64544
5+
PARENTNET_WALLET_PK=0x4da0711c4780696f725dc6ad44751b6a9e15a80a0bcb41eca6bf4510de64172f
66
RELAYER_MODE=full
77

8-
MAIN_IP=1.1.1.1
9-
PUBLIC_IP=2.2.2.2
10-
NUM_MACHINE=2
8+
MAIN_IP=127.0.0.1
9+
NUM_MACHINE=1
1110

1211

deployment-generator/src/gen.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ subnetconf = [];
6565
for (let i = 1; i <= config.num_subnet; i++) {
6666
subnetconf.push(gen_env.genSubnetConfig(i, keys, ip_record));
6767
}
68-
deployconf = gen_env.genContractDeployEnv();
68+
deployconf = gen_env.genContractDeployEnv(ip_record);
6969

7070
const compose_content = yaml.dump(doc, {});
7171

deployment-generator/src/gen_compose.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,5 @@ function injectNetworkConfig(compose_object) {
151151

152152
compose_object["networks"] = network;
153153

154-
if (config.num_machines == 1){ //inject docker_net IP instead of machine IP if single machine deployment
155-
config.ip_1 = record_services_ip["bootnode"]
156-
}
157-
158154
return compose_object, record_services_ip;
159155
}

deployment-generator/src/gen_env.js

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,25 @@ module.exports = {
77
genContractDeployEnv,
88
};
99

10-
function genSubnetConfig(subnet_id, key) {
10+
function genSubnetConfig(subnet_id, key, ip_record) {
1111
const key_name = `key${subnet_id}`;
1212
let private_key = key[key_name]["PrivateKey"];
1313
private_key = private_key.slice(2, private_key.length); // remove 0x for subnet conf
1414
const port = 20303 + subnet_id - 1;
1515
const rpcport = 8545 + subnet_id - 1;
1616
const wsport = 9555 + subnet_id - 1;
17+
const bootnode_ip = config.num_machines === 1 ? ip_record["bootnode"] : config.ip_1;
18+
const stats_ip = config.num_machines === 1 ? ip_record["stats"] : config.ip_1
1719
const config_env = `
1820
INSTANCE_NAME=subnet${subnet_id}
1921
PRIVATE_KEY=${private_key}
2022
BOOTNODES=enode://cc566d1033f21c7eb0eb9f403bb651f3949b5f63b40683917\
2123
765c343f9c0c596e9cd021e2e8416908cbc3ab7d6f6671a83c85f7b121c1872f8be\
22-
50a591723a5d@${config.ip_1}:20301
24+
50a591723a5d@${bootnode_ip}:20301
2325
NETWORK_ID=${config.network_id}
2426
SYNC_MODE=full
2527
RPC_API=db,eth,debug,miner,net,shh,txpool,personal,web3,XDPoS
26-
STATS_SERVICE_ADDRESS=${config.ip_1}:5213
28+
STATS_SERVICE_ADDRESS=${stats_ip}:5213
2729
STATS_SECRET=${config.secret_string}
2830
PORT=${port}
2931
RPCPORT=${rpcport}
@@ -37,15 +39,17 @@ LOG_LEVEL=2
3739

3840
function genServicesConfig() {
3941
const url = config.parentnet.url;
42+
const bootnode_ip = config.num_machines === 1 ? ip_record["bootnode"] : config.ip_1;
43+
const subnet_ip = config.num_machines === 1 ? ip_record["subnet1"] : config.ip_1;
4044
let config_env = `
4145
# Bootnode
42-
EXTIP=${config.ip_1}
46+
EXTIP=${bootnode_ip}
4347
BOOTNODE_PORT=20301
4448
4549
# Stats and relayer
4650
PARENTNET_URL=${url}
4751
PARENTNET_WALLET=${config.parentnet.pubkey}
48-
SUBNET_URL=http://${config.ip_1}:8545
52+
SUBNET_URL=http://${subnet_ip}:8545
4953
RELAYER_MODE=${config.relayer_mode}
5054
SLACK_WEBHOOK=https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX
5155
CORS_ALLOW_ORIGIN=*
@@ -91,10 +95,11 @@ if (config.zero.zero_mode == 'one-directional'){
9195
}
9296

9397

94-
function genContractDeployEnv() {
98+
function genContractDeployEnv(ip_record) {
99+
const subnet_ip = config.num_machines === 1 ? ip_record["subnet1"] : config.ip_1
95100
const config_deploy = `
96101
PARENTNET_URL=${config.parentnet.url}
97-
SUBNET_URL=http://${config.ip_1}:8545
102+
SUBNET_URL=http://${subnet_ip}:8545
98103
99104
100105
PARENTNET_PK=${config.parentnet.privatekey}

0 commit comments

Comments
 (0)