aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/puppeth
diff options
context:
space:
mode:
authorFelix Lange <fjl@users.noreply.github.com>2018-10-04 17:34:49 +0800
committerPéter Szilágyi <peterke@gmail.com>2018-10-04 17:34:49 +0800
commitb8a0daf0cce00ef13f72c97baa983d6835332e3f (patch)
tree99f8ace7824d8eca75bbf52da2c76b0e740be5d5 /cmd/puppeth
parentbfa0f96822c310759394640dc2965fceb091a3a4 (diff)
downloaddexon-b8a0daf0cce00ef13f72c97baa983d6835332e3f.tar
dexon-b8a0daf0cce00ef13f72c97baa983d6835332e3f.tar.gz
dexon-b8a0daf0cce00ef13f72c97baa983d6835332e3f.tar.bz2
dexon-b8a0daf0cce00ef13f72c97baa983d6835332e3f.tar.lz
dexon-b8a0daf0cce00ef13f72c97baa983d6835332e3f.tar.xz
dexon-b8a0daf0cce00ef13f72c97baa983d6835332e3f.tar.zst
dexon-b8a0daf0cce00ef13f72c97baa983d6835332e3f.zip
cmd/puppeth: fix node URL in health check (#17802)
* cmd/puppeth: fix node URL in health check * cmd/puppeth: set external IP for geth * cmd/puppeth: fix enode cast issue
Diffstat (limited to 'cmd/puppeth')
-rw-r--r--cmd/puppeth/module_node.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/cmd/puppeth/module_node.go b/cmd/puppeth/module_node.go
index 038152a3e..069adfe4f 100644
--- a/cmd/puppeth/module_node.go
+++ b/cmd/puppeth/module_node.go
@@ -42,7 +42,7 @@ ADD genesis.json /genesis.json
RUN \
echo 'geth --cache 512 init /genesis.json' > geth.sh && \{{if .Unlock}}
echo 'mkdir -p /root/.ethereum/keystore/ && cp /signer.json /root/.ethereum/keystore/' >> geth.sh && \{{end}}
- echo $'exec geth --networkid {{.NetworkID}} --cache 512 --port {{.Port}} --maxpeers {{.Peers}} {{.LightFlag}} --ethstats \'{{.Ethstats}}\' {{if .Bootnodes}}--bootnodes {{.Bootnodes}}{{end}} {{if .Etherbase}}--miner.etherbase {{.Etherbase}} --mine --miner.threads 1{{end}} {{if .Unlock}}--unlock 0 --password /signer.pass --mine{{end}} --miner.gastarget {{.GasTarget}} --miner.gaslimit {{.GasLimit}} --miner.gasprice {{.GasPrice}}' >> geth.sh
+ echo $'exec geth --networkid {{.NetworkID}} --cache 512 --port {{.Port}} --nat extip:{{.IP}} --maxpeers {{.Peers}} {{.LightFlag}} --ethstats \'{{.Ethstats}}\' {{if .Bootnodes}}--bootnodes {{.Bootnodes}}{{end}} {{if .Etherbase}}--miner.etherbase {{.Etherbase}} --mine --miner.threads 1{{end}} {{if .Unlock}}--unlock 0 --password /signer.pass --mine{{end}} --miner.gastarget {{.GasTarget}} --miner.gaslimit {{.GasLimit}} --miner.gasprice {{.GasPrice}}' >> geth.sh
ENTRYPOINT ["/bin/sh", "geth.sh"]
`
@@ -99,6 +99,7 @@ func deployNode(client *sshClient, network string, bootnodes []string, config *n
template.Must(template.New("").Parse(nodeDockerfile)).Execute(dockerfile, map[string]interface{}{
"NetworkID": config.network,
"Port": config.port,
+ "IP": client.address,
"Peers": config.peersTotal,
"LightFlag": lightFlag,
"Bootnodes": strings.Join(bootnodes, ","),
@@ -227,10 +228,10 @@ func checkNode(client *sshClient, network string, boot bool) (*nodeInfos, error)
// Container available, retrieve its node ID and its genesis json
var out []byte
- if out, err = client.Run(fmt.Sprintf("docker exec %s_%s_1 geth --exec admin.nodeInfo.id --cache=16 attach", network, kind)); err != nil {
+ if out, err = client.Run(fmt.Sprintf("docker exec %s_%s_1 geth --exec admin.nodeInfo.enode --cache=16 attach", network, kind)); err != nil {
return nil, ErrServiceUnreachable
}
- id := bytes.Trim(bytes.TrimSpace(out), "\"")
+ enode := bytes.Trim(bytes.TrimSpace(out), "\"")
if out, err = client.Run(fmt.Sprintf("docker exec %s_%s_1 cat /genesis.json", network, kind)); err != nil {
return nil, ErrServiceUnreachable
@@ -265,7 +266,7 @@ func checkNode(client *sshClient, network string, boot bool) (*nodeInfos, error)
gasLimit: gasLimit,
gasPrice: gasPrice,
}
- stats.enode = fmt.Sprintf("enode://%s@%s:%d", id, client.address, stats.port)
+ stats.enode = string(enode)
return stats, nil
}