Skip to content

Commit b58ce84

Browse files
committed
add optional public_ip config and frontend rpc config
1 parent 64d3003 commit b58ce84

File tree

4 files changed

+24
-20
lines changed

4 files changed

+24
-20
lines changed
Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,23 @@
1-
21
#subnet config
32
NETWORK_NAME=localsubnet
43
NUM_MACHINE=1
54
NUM_SUBNET=3
65
MAIN_IP=192.168.1.1
6+
# optional
7+
# PUBLIC_IP
78

89
#parentchain config
9-
PARENTNET=devnet
10+
PARENTNET=testnet
1011
PARENTNET_WALLET_PK=0x1111111111111111111111111111111111111111111111111111111111111111
1112

1213

13-
# OS=mac
1414

15-
#docker image versions, default to stable
15+
16+
#OS=mac
17+
18+
# docker image versions, default to stable
1619
# VERSION_SUBNET
1720
# VERSION_BOOTNODE
1821
# VERSION_RELAYER
1922
# VERSION_STATS
20-
# VERSION_FRONTEND
23+
# VERSION_FRONTEND

subnet/deployment-generator/script/generate.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
2-
VERSION_GENERATOR="latest"
2+
VERSION_GENERATOR="v0.3.0"
33
VERSION_CSC="v0.1.1"
4-
VERSION_SUBNET="v0.2.2"
4+
VERSION_GENESIS="v0.2.2"
55

66
current_dir="$(cd "$(dirname "$0")" && pwd)"
77
echo 'checking for docker.env'
@@ -23,8 +23,8 @@ fi
2323
if [[ -z "$(docker images -q xinfinorg/csc:$VERSION_CSC)" ]]; then # || echo "doesn't exist"
2424
docker pull xinfinorg/csc:$VERSION_CSC
2525
fi
26-
if [[ -z "$(docker images -q xinfinorg/xdcsubnets:$VERSION_SUBNET)" ]]; then # || echo "doesn't exist"
27-
docker pull xinfinorg/xdcsubnets:$VERSION_SUBNET
26+
if [[ -z "$(docker images -q xinfinorg/xdcsubnets:$VERSION_GENESIS)" ]]; then # || echo "doesn't exist"
27+
docker pull xinfinorg/xdcsubnets:$VERSION_GENESIS
2828
fi
2929

3030
echo ''
@@ -37,7 +37,7 @@ if [[ $gen_success == false ]]; then
3737
fi
3838

3939
echo 'generating genesis.json'
40-
docker run -v $current_dir/generated/:/app/generated/ --entrypoint 'bash' xinfinorg/xdcsubnets:$VERSION_SUBNET /work/puppeth.sh || pup_success=false
40+
docker run -v $current_dir/generated/:/app/generated/ --entrypoint 'bash' xinfinorg/xdcsubnets:$VERSION_GENESIS /work/puppeth.sh || pup_success=false
4141
if [[ $pup_success == false ]]; then
4242
echo 'genesis.json generation failed'
4343
exit 1

subnet/deployment-generator/src/config_gen.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,25 @@ const config = {
1010
num_machines: parseInt(process.env.NUM_MACHINE),
1111
num_subnet: parseInt(process.env.NUM_SUBNET),
1212
ip_1: (process.env.MAIN_IP || ''),
13+
public_ip: (process.env.PUBLIC_IP || ''),
1314
network_name: (process.env.NETWORK_NAME),
1415
network_id: parseInt(process.env.NETWORK_ID || Math.floor(Math.random() * (65536 - 1) + 1)),
1516
secret_string: (process.env.SERVICES_SECRET || crypto.randomBytes(10).toString('hex')),
1617
relayer_mode: (process.env.RELAYER_MODE || 'full'), //full or lite //in upgradable csc both are deployed
1718
docker_image_name: (process.env.IMAGE_NAME || 'xinfinorg/subnet-generator:latest'),
1819
operating_system: (process.env.OS || 'linux'),
1920
version: {
20-
subnet: (process.env.VERSION_SUBNET || 'v0.2.1'),
21+
subnet: (process.env.VERSION_SUBNET || 'v0.2.1'),
2122
bootnode: (process.env.VERSION_BOOTNODE || 'v0.2.1'),
2223
// observer: (process.env.VERSION_OBSERVER || 'latest'),
2324
relayer: (process.env.VERSION_RELAYER || 'v0.2.2'),
24-
stats: (process.env.VERSION_STATS || 'v0.1.8'),
25-
frontend: (process.env.VERSION_FRONTEND || 'v0.1.8'),
25+
stats: (process.env.VERSION_STATS || 'v0.1.8'),
26+
frontend: (process.env.VERSION_FRONTEND || 'v0.1.9'),
2627
csc: (process.env.VERSION_CSC || 'v0.1.1'),
2728
// zero: (process.env.VERSION_ZERO || 'v0.1.1')
2829
},
2930
parentnet:{
30-
network: (process.env.PARENTNET || 'devnet'),
31+
network: (process.env.PARENTNET || 'testnet'),
3132
url: '',
3233
pubkey: '' ,
3334
privatekey: (process.env.PARENTNET_WALLET_PK || ''),
@@ -92,16 +93,14 @@ function configSanityCheck (config) {
9293
}
9394

9495
if (config.parentnet.network === 'devnet' ||
95-
config.parentnet.network === 'testnet' ||
96-
config.parentnet.network === 'mainnet' ){
96+
config.parentnet.network === 'testnet' ){
9797
let official_urls = {
9898
'devnet':'https://devnetstats.apothem.network/devnet' ,
9999
'testnet':'https://erpc.apothem.network/' ,
100-
'mainnet': 'https://devnetstats.apothem.network/mainnet' //confirm url
101100
}
102101
config.parentnet.url = official_urls[config.parentnet.network]
103102
} else {
104-
console.log('PARENTNET must be devnet, testnet, or mainnet ')
103+
console.log('PARENTNET must be devnet or testnet')
105104
process.exit(1)
106105
}
107106

subnet/deployment-generator/src/gen_env.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,9 @@ CHECKPOINT_CONTRACT=0x0000000000000000000000000000000000000000
7979
SLACK_WEBHOOK=https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX
8080
CORS_ALLOW_ORIGIN=*
8181
82-
# Frontend
83-
VITE_SUBNET_URL=http://${config.ip_1}:3000
82+
# Frontend
83+
VITE_SUBNET_URL=http://${config.public_ip}:3000
84+
VITE_SUBNET_RPC=http://${config.public_ip}:8545
8485
8586
# Share Variable
8687
STATS_SECRET=${config.secret_string}
@@ -110,6 +111,7 @@ CORS_ALLOW_ORIGIN=*
110111
111112
# Frontend
112113
VITE_SUBNET_URL=http://127.0.0.1:3000
114+
VITE_SUBNET_RPC=http://127.0.0.1:8545
113115
114116
# Share Variable
115117
STATS_SECRET=${config.secret_string}

0 commit comments

Comments
 (0)