aboutsummaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2017-10-27 19:36:49 +0800
committerPéter Szilágyi <peterke@gmail.com>2017-11-21 21:09:39 +0800
commitffc12f63ec57682e7c7f6653332856acbeef3183 (patch)
tree581a82231e18824c36f759421f78caa2cd83a8de /cmd
parent80be5e546398203c1958a0f512e651a2c36b1fe0 (diff)
downloaddexon-ffc12f63ec57682e7c7f6653332856acbeef3183.tar
dexon-ffc12f63ec57682e7c7f6653332856acbeef3183.tar.gz
dexon-ffc12f63ec57682e7c7f6653332856acbeef3183.tar.bz2
dexon-ffc12f63ec57682e7c7f6653332856acbeef3183.tar.lz
dexon-ffc12f63ec57682e7c7f6653332856acbeef3183.tar.xz
dexon-ffc12f63ec57682e7c7f6653332856acbeef3183.tar.zst
dexon-ffc12f63ec57682e7c7f6653332856acbeef3183.zip
cmd/puppeth: simplifications and pre-built docker images
Diffstat (limited to 'cmd')
-rw-r--r--cmd/puppeth/module_ethstats.go14
-rw-r--r--cmd/puppeth/module_explorer.go21
-rw-r--r--cmd/puppeth/module_faucet.go19
-rw-r--r--cmd/puppeth/module_wallet.go63
-rw-r--r--cmd/puppeth/ssh.go1
-rw-r--r--cmd/puppeth/wizard_dashboard.go13
-rw-r--r--cmd/puppeth/wizard_ethstats.go71
-rw-r--r--cmd/puppeth/wizard_explorer.go17
-rw-r--r--cmd/puppeth/wizard_faucet.go13
-rw-r--r--cmd/puppeth/wizard_network.go2
-rw-r--r--cmd/puppeth/wizard_nginx.go13
-rw-r--r--cmd/puppeth/wizard_node.go13
-rw-r--r--cmd/puppeth/wizard_wallet.go19
13 files changed, 115 insertions, 164 deletions
diff --git a/cmd/puppeth/module_ethstats.go b/cmd/puppeth/module_ethstats.go
index b9874cf58..cf9e66bc1 100644
--- a/cmd/puppeth/module_ethstats.go
+++ b/cmd/puppeth/module_ethstats.go
@@ -31,21 +31,9 @@ import (
// ethstatsDockerfile is the Dockerfile required to build an ethstats backend
// and associated monitoring site.
var ethstatsDockerfile = `
-FROM mhart/alpine-node:latest
-
-RUN \
- apk add --update git && \
- git clone --depth=1 https://github.com/puppeth/eth-netstats && \
- apk del git && rm -rf /var/cache/apk/* && \
- \
- cd /eth-netstats && npm install && npm install -g grunt-cli && grunt
-
-WORKDIR /eth-netstats
-EXPOSE 3000
+FROM puppeth/ethstats:latest
RUN echo 'module.exports = {trusted: [{{.Trusted}}], banned: [{{.Banned}}], reserved: ["yournode"]};' > lib/utils/config.js
-
-CMD ["npm", "start"]
`
// ethstatsComposefile is the docker-compose.yml file required to deploy and
diff --git a/cmd/puppeth/module_explorer.go b/cmd/puppeth/module_explorer.go
index 589b071e7..819f356c3 100644
--- a/cmd/puppeth/module_explorer.go
+++ b/cmd/puppeth/module_explorer.go
@@ -30,31 +30,16 @@ import (
// explorerDockerfile is the Dockerfile required to run a block explorer.
var explorerDockerfile = `
-FROM parity/parity:stable
-
-RUN \
- apt-get update && apt-get install -y curl git npm make g++ --no-install-recommends && \
- npm install -g n pm2 && n stable
-
-RUN \
- git clone --depth=1 https://github.com/puppeth/eth-net-intelligence-api && \
- cd eth-net-intelligence-api && npm install
-
-RUN \
- git clone --depth=1 https://github.com/puppeth/etherchain-light --recursive && \
- cd etherchain-light && npm install && mv config.js.example config.js && \
- sed -i '/this.bootstrapUrl/c\ this.bootstrapUrl = "https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css";' config.js
+FROM puppeth/explorer:latest
ADD ethstats.json /ethstats.json
ADD chain.json /chain.json
RUN \
- echo '(cd eth-net-intelligence-api && pm2 start /ethstats.json)' > explorer.sh && \
- echo '(cd etherchain-light && npm start &)' >> explorer.sh && \
+ echo '(cd ../eth-net-intelligence-api && pm2 start /ethstats.json)' > explorer.sh && \
+ echo '(cd ../etherchain-light && npm start &)' >> explorer.sh && \
echo '/parity/parity --chain=/chain.json --port={{.NodePort}} --tracing=on --fat-db=on --pruning=archive' >> explorer.sh
-EXPOSE 3000
-
ENTRYPOINT ["/bin/sh", "explorer.sh"]
`
diff --git a/cmd/puppeth/module_faucet.go b/cmd/puppeth/module_faucet.go
index 4e7805824..09113c3e6 100644
--- a/cmd/puppeth/module_faucet.go
+++ b/cmd/puppeth/module_faucet.go
@@ -33,27 +33,14 @@ import (
// faucetDockerfile is the Dockerfile required to build an faucet container to
// grant crypto tokens based on GitHub authentications.
var faucetDockerfile = `
-FROM alpine:latest
-
-RUN mkdir /go
-ENV GOPATH /go
-
-RUN \
- apk add --update git go make gcc musl-dev ca-certificates linux-headers && \
- mkdir -p $GOPATH/src/github.com/ethereum && \
- (cd $GOPATH/src/github.com/ethereum && git clone --depth=1 https://github.com/ethereum/go-ethereum) && \
- go build -v github.com/ethereum/go-ethereum/cmd/faucet && \
- apk del git go make gcc musl-dev linux-headers && \
- rm -rf $GOPATH && rm -rf /var/cache/apk/*
+FROM puppeth/faucet:latest
ADD genesis.json /genesis.json
ADD account.json /account.json
ADD account.pass /account.pass
-EXPOSE 8080
-
-CMD [ \
- "/faucet", "--genesis", "/genesis.json", "--network", "{{.NetworkID}}", "--bootnodes", "{{.Bootnodes}}", "--ethstats", "{{.Ethstats}}", "--ethport", "{{.EthPort}}", \
+ENTRYPOINT [ \
+ "faucet", "--genesis", "/genesis.json", "--network", "{{.NetworkID}}", "--bootnodes", "{{.Bootnodes}}", "--ethstats", "{{.Ethstats}}", "--ethport", "{{.EthPort}}", \
"--faucet.name", "{{.FaucetName}}", "--faucet.amount", "{{.FaucetAmount}}", "--faucet.minutes", "{{.FaucetMinutes}}", "--faucet.tiers", "{{.FaucetTiers}}", \
{{if .GitHubUser}}"--github.user", "{{.GitHubUser}}", "--github.token", "{{.GitHubToken}}", {{end}}"--account.json", "/account.json", "--account.pass", "/account.pass" \
{{if .CaptchaToken}}, "--captcha.token", "{{.CaptchaToken}}", "--captcha.secret", "{{.CaptchaSecret}}"{{end}}{{if .NoAuth}}, "--noauth"{{end}} \
diff --git a/cmd/puppeth/module_wallet.go b/cmd/puppeth/module_wallet.go
index 3ba17dece..78dc1ef51 100644
--- a/cmd/puppeth/module_wallet.go
+++ b/cmd/puppeth/module_wallet.go
@@ -30,61 +30,7 @@ import (
// walletDockerfile is the Dockerfile required to run a web wallet.
var walletDockerfile = `
-FROM ethereum/client-go:latest
-
-RUN \
- apk add --update git python make g++ libnotify nodejs-npm && \
- npm install -g gulp-cli
-
-RUN \
- git clone --depth=1 https://github.com/kvhnuke/etherwallet.git && \
- (cd etherwallet && npm install)
-WORKDIR etherwallet
-
-RUN \
- echo '"use strict";' > app/scripts/nodes.js && \
- echo 'var nodes = function() {}' >> app/scripts/nodes.js && \
- echo 'nodes.customNode = require("./nodeHelpers/customNode");' >> app/scripts/nodes.js && \
- echo 'nodes.nodeTypes = {' >> app/scripts/nodes.js && \
- echo ' {{.Network}}: "{{.Denom}} ETH",' >> app/scripts/nodes.js && \
- echo ' Custom: "CUSTOM ETH"' >> app/scripts/nodes.js && \
- echo '};' >> app/scripts/nodes.js && \
- echo 'nodes.ensNodeTypes = [];' >> app/scripts/nodes.js && \
- echo 'nodes.customNodeObj = {' >> app/scripts/nodes.js && \
- echo ' "name": "CUS",' >> app/scripts/nodes.js && \
- echo ' "type": nodes.nodeTypes.Custom,' >> app/scripts/nodes.js && \
- echo ' "eip155": false,' >> app/scripts/nodes.js && \
- echo ' "chainId": "",' >> app/scripts/nodes.js && \
- echo ' "tokenList": [],' >> app/scripts/nodes.js && \
- echo ' "abiList": [],' >> app/scripts/nodes.js && \
- echo ' "service": "Custom",' >> app/scripts/nodes.js && \
- echo ' "lib": null' >> app/scripts/nodes.js && \
- echo '}' >> app/scripts/nodes.js && \
- echo 'nodes.nodeList = {' >> app/scripts/nodes.js && \
- echo ' "eth_mew": {' >> app/scripts/nodes.js && \
- echo ' "name": "{{.Network}}",' >> app/scripts/nodes.js && \
- echo ' "type": nodes.nodeTypes.{{.Network}},' >> app/scripts/nodes.js && \
- echo ' "eip155": true,' >> app/scripts/nodes.js && \
- echo ' "chainId": {{.NetworkID}},' >> app/scripts/nodes.js && \
- echo ' "tokenList": [],' >> app/scripts/nodes.js && \
- echo ' "abiList": [],' >> app/scripts/nodes.js && \
- echo ' "service": "Go Ethereum",' >> app/scripts/nodes.js && \
- echo ' "lib": new nodes.customNode("http://{{.Host}}:{{.RPCPort}}", "")' >> app/scripts/nodes.js && \
- echo ' }' >> app/scripts/nodes.js && \
- echo '};' >> app/scripts/nodes.js && \
- echo 'nodes.ethPrice = require("./nodeHelpers/ethPrice");' >> app/scripts/nodes.js && \
- echo 'module.exports = nodes;' >> app/scripts/nodes.js
-
-RUN rm -rf dist && gulp prep && npm run dist
-
-RUN \
- npm install connect serve-static && \
- \
- echo 'var connect = require("connect");' > server.js && \
- echo 'var serveStatic = require("serve-static");' >> server.js && \
- echo 'connect().use(serveStatic("/etherwallet/dist")).listen(80, function(){' >> server.js && \
- echo ' console.log("Server running on 80...");' >> server.js && \
- echo '});' >> server.js
+FROM puppeth/wallet:latest
ADD genesis.json /genesis.json
@@ -93,7 +39,12 @@ RUN \
echo 'geth --cache 512 init /genesis.json' >> wallet.sh && \
echo $'geth --networkid {{.NetworkID}} --port {{.NodePort}} --bootnodes {{.Bootnodes}} --ethstats \'{{.Ethstats}}\' --cache=512 --rpc --rpcaddr=0.0.0.0 --rpccorsdomain "*"' >> wallet.sh
-EXPOSE 80 8545
+RUN \
+ sed -i 's/PuppethNetworkID/{{.NetworkID}}/g' dist/js/etherwallet-master.js && \
+ sed -i 's/PuppethNetwork/{{.Network}}/g' dist/js/etherwallet-master.js && \
+ sed -i 's/PuppethDenom/{{.Denom}}/g' dist/js/etherwallet-master.js && \
+ sed -i 's/PuppethHost/{{.Host}}/g' dist/js/etherwallet-master.js && \
+ sed -i 's/PuppethRPCPort/{{.RPCPort}}/g' dist/js/etherwallet-master.js
ENTRYPOINT ["/bin/sh", "wallet.sh"]
`
diff --git a/cmd/puppeth/ssh.go b/cmd/puppeth/ssh.go
index ec6a1b669..a254a7f7a 100644
--- a/cmd/puppeth/ssh.go
+++ b/cmd/puppeth/ssh.go
@@ -116,6 +116,7 @@ func dial(server string, pubkey []byte) (*sshClient, error) {
keycheck := func(hostname string, remote net.Addr, key ssh.PublicKey) error {
// If no public key is known for SSH, ask the user to confirm
if pubkey == nil {
+ fmt.Println()
fmt.Printf("The authenticity of host '%s (%s)' can't be established.\n", hostname, remote)
fmt.Printf("SSH key fingerprint is %s [MD5]\n", ssh.FingerprintLegacyMD5(key))
fmt.Printf("Are you sure you want to continue connecting (yes/no)? ")
diff --git a/cmd/puppeth/wizard_dashboard.go b/cmd/puppeth/wizard_dashboard.go
index 10aa6ee05..278b5533a 100644
--- a/cmd/puppeth/wizard_dashboard.go
+++ b/cmd/puppeth/wizard_dashboard.go
@@ -33,12 +33,15 @@ func (w *wizard) deployDashboard() {
client := w.servers[server]
// Retrieve any active dashboard configurations from the server
+ existed := true
+
infos, err := checkDashboard(client, w.network)
if err != nil {
infos = &dashboardInfos{
port: 80,
host: client.server,
}
+ existed = false
}
// Figure out which port to listen on
fmt.Println()
@@ -138,10 +141,12 @@ func (w *wizard) deployDashboard() {
infos.trusted = w.readDefaultString("y") == "y"
}
// Try to deploy the dashboard container on the host
- fmt.Println()
- fmt.Printf("Should the dashboard be built from scratch (y/n)? (default = no)\n")
- nocache := w.readDefaultString("n") != "n"
-
+ nocache := false
+ if existed {
+ fmt.Println()
+ fmt.Printf("Should the dashboard be built from scratch (y/n)? (default = no)\n")
+ nocache = w.readDefaultString("n") != "n"
+ }
if out, err := deployDashboard(client, w.network, &w.conf, infos, nocache); err != nil {
log.Error("Failed to deploy dashboard container", "err", err)
if len(out) > 0 {
diff --git a/cmd/puppeth/wizard_ethstats.go b/cmd/puppeth/wizard_ethstats.go
index 1bde5a3fd..56dbeb9b4 100644
--- a/cmd/puppeth/wizard_ethstats.go
+++ b/cmd/puppeth/wizard_ethstats.go
@@ -34,6 +34,8 @@ func (w *wizard) deployEthstats() {
client := w.servers[server]
// Retrieve any active ethstats configurations from the server
+ existed := true
+
infos, err := checkEthstats(client, w.network)
if err != nil {
infos = &ethstatsInfos{
@@ -41,6 +43,7 @@ func (w *wizard) deployEthstats() {
host: client.server,
secret: "",
}
+ existed = false
}
// Figure out which port to listen on
fmt.Println()
@@ -62,46 +65,50 @@ func (w *wizard) deployEthstats() {
infos.secret = w.readDefaultString(infos.secret)
}
// Gather any blacklists to ban from reporting
- fmt.Println()
- fmt.Printf("Keep existing IP %v blacklist (y/n)? (default = yes)\n", infos.banned)
- if w.readDefaultString("y") != "y" {
- // The user might want to clear the entire list, although generally probably not
- fmt.Println()
- fmt.Printf("Clear out blacklist and start over (y/n)? (default = no)\n")
- if w.readDefaultString("n") != "n" {
- infos.banned = nil
- }
- // Offer the user to explicitly add/remove certain IP addresses
+ if existed {
fmt.Println()
- fmt.Println("Which additional IP addresses should be blacklisted?")
- for {
- if ip := w.readIPAddress(); ip != "" {
- infos.banned = append(infos.banned, ip)
- continue
+ fmt.Printf("Keep existing IP %v blacklist (y/n)? (default = yes)\n", infos.banned)
+ if w.readDefaultString("y") != "y" {
+ // The user might want to clear the entire list, although generally probably not
+ fmt.Println()
+ fmt.Printf("Clear out blacklist and start over (y/n)? (default = no)\n")
+ if w.readDefaultString("n") != "n" {
+ infos.banned = nil
}
- break
- }
- fmt.Println()
- fmt.Println("Which IP addresses should not be blacklisted?")
- for {
- if ip := w.readIPAddress(); ip != "" {
- for i, addr := range infos.banned {
- if ip == addr {
- infos.banned = append(infos.banned[:i], infos.banned[i+1:]...)
- break
+ // Offer the user to explicitly add/remove certain IP addresses
+ fmt.Println()
+ fmt.Println("Which additional IP addresses should be blacklisted?")
+ for {
+ if ip := w.readIPAddress(); ip != "" {
+ infos.banned = append(infos.banned, ip)
+ continue
+ }
+ break
+ }
+ fmt.Println()
+ fmt.Println("Which IP addresses should not be blacklisted?")
+ for {
+ if ip := w.readIPAddress(); ip != "" {
+ for i, addr := range infos.banned {
+ if ip == addr {
+ infos.banned = append(infos.banned[:i], infos.banned[i+1:]...)
+ break
+ }
}
+ continue
}
- continue
+ break
}
- break
+ sort.Strings(infos.banned)
}
- sort.Strings(infos.banned)
}
// Try to deploy the ethstats server on the host
- fmt.Println()
- fmt.Printf("Should the ethstats be built from scratch (y/n)? (default = no)\n")
- nocache := w.readDefaultString("n") != "n"
-
+ nocache := false
+ if existed {
+ fmt.Println()
+ fmt.Printf("Should the ethstats be built from scratch (y/n)? (default = no)\n")
+ nocache = w.readDefaultString("n") != "n"
+ }
trusted := make([]string, 0, len(w.servers))
for _, client := range w.servers {
if client != nil {
diff --git a/cmd/puppeth/wizard_explorer.go b/cmd/puppeth/wizard_explorer.go
index bbbe1e275..ed586bc76 100644
--- a/cmd/puppeth/wizard_explorer.go
+++ b/cmd/puppeth/wizard_explorer.go
@@ -47,9 +47,14 @@ func (w *wizard) deployExplorer() {
client := w.servers[server]
// Retrieve any active node configurations from the server
+ existed := true
+
infos, err := checkExplorer(client, w.network)
if err != nil {
- infos = &explorerInfos{nodePort: 30303, webPort: 80, webHost: client.server}
+ infos = &explorerInfos{
+ nodePort: 30303, webPort: 80, webHost: client.server,
+ }
+ existed = false
}
chainspec, err := newParityChainSpec(w.network, w.conf.Genesis, w.conf.bootFull)
if err != nil {
@@ -92,10 +97,12 @@ func (w *wizard) deployExplorer() {
infos.ethstats = w.readDefaultString(infos.ethstats) + ":" + w.conf.ethstats
}
// Try to deploy the explorer on the host
- fmt.Println()
- fmt.Printf("Should the explorer be built from scratch (y/n)? (default = no)\n")
- nocache := w.readDefaultString("n") != "n"
-
+ nocache := false
+ if existed {
+ fmt.Println()
+ fmt.Printf("Should the explorer be built from scratch (y/n)? (default = no)\n")
+ nocache = w.readDefaultString("n") != "n"
+ }
if out, err := deployExplorer(client, w.network, chain, infos, nocache); err != nil {
log.Error("Failed to deploy explorer container", "err", err)
if len(out) > 0 {
diff --git a/cmd/puppeth/wizard_faucet.go b/cmd/puppeth/wizard_faucet.go
index 891a96197..e7d5ad488 100644
--- a/cmd/puppeth/wizard_faucet.go
+++ b/cmd/puppeth/wizard_faucet.go
@@ -36,6 +36,8 @@ func (w *wizard) deployFaucet() {
client := w.servers[server]
// Retrieve any active faucet configurations from the server
+ existed := true
+
infos, err := checkFaucet(client, w.network)
if err != nil {
infos = &faucetInfos{
@@ -46,6 +48,7 @@ func (w *wizard) deployFaucet() {
minutes: 1440,
tiers: 3,
}
+ existed = false
}
infos.node.genesis, _ = json.MarshalIndent(w.conf.Genesis, "", " ")
infos.node.network = w.conf.Genesis.Config.ChainId.Int64()
@@ -206,10 +209,12 @@ func (w *wizard) deployFaucet() {
infos.noauth = w.readDefaultString(noauth) != "n"
// Try to deploy the faucet server on the host
- fmt.Println()
- fmt.Printf("Should the faucet be built from scratch (y/n)? (default = no)\n")
- nocache := w.readDefaultString("n") != "n"
-
+ nocache := false
+ if existed {
+ fmt.Println()
+ fmt.Printf("Should the faucet be built from scratch (y/n)? (default = no)\n")
+ nocache = w.readDefaultString("n") != "n"
+ }
if out, err := deployFaucet(client, w.network, w.conf.bootLight, infos, nocache); err != nil {
log.Error("Failed to deploy faucet container", "err", err)
if len(out) > 0 {
diff --git a/cmd/puppeth/wizard_network.go b/cmd/puppeth/wizard_network.go
index afb0b34ef..d780c550b 100644
--- a/cmd/puppeth/wizard_network.go
+++ b/cmd/puppeth/wizard_network.go
@@ -175,7 +175,7 @@ func (w *wizard) deployComponent() {
fmt.Println(" 2. Bootnode - Entry point of the network")
fmt.Println(" 3. Sealer - Full node minting new blocks")
fmt.Println(" 4. Explorer - Chain analysis webservice (ethash only)")
- fmt.Println(" 5. Wallet - Browser wallet for quick sends (todo)")
+ fmt.Println(" 5. Wallet - Browser wallet for quick sends")
fmt.Println(" 6. Faucet - Crypto faucet to give away funds")
fmt.Println(" 7. Dashboard - Website listing above web-services")
diff --git a/cmd/puppeth/wizard_nginx.go b/cmd/puppeth/wizard_nginx.go
index 919ab270b..4eeae93a0 100644
--- a/cmd/puppeth/wizard_nginx.go
+++ b/cmd/puppeth/wizard_nginx.go
@@ -29,7 +29,8 @@ import (
//
// If the user elects not to use a reverse proxy, an empty hostname is returned!
func (w *wizard) ensureVirtualHost(client *sshClient, port int, def string) (string, error) {
- if proxy, _ := checkNginx(client, w.network); proxy != nil {
+ proxy, _ := checkNginx(client, w.network)
+ if proxy != nil {
// Reverse proxy is running, if ports match, we need a virtual host
if proxy.port == port {
fmt.Println()
@@ -41,10 +42,12 @@ func (w *wizard) ensureVirtualHost(client *sshClient, port int, def string) (str
fmt.Println()
fmt.Println("Allow sharing the port with other services (y/n)? (default = yes)")
if w.readDefaultString("y") == "y" {
- fmt.Println()
- fmt.Printf("Should the reverse-proxy be rebuilt from scratch (y/n)? (default = no)\n")
- nocache := w.readDefaultString("n") != "n"
-
+ nocache := false
+ if proxy != nil {
+ fmt.Println()
+ fmt.Printf("Should the reverse-proxy be rebuilt from scratch (y/n)? (default = no)\n")
+ nocache = w.readDefaultString("n") != "n"
+ }
if out, err := deployNginx(client, w.network, port, nocache); err != nil {
log.Error("Failed to deploy reverse-proxy", "err", err)
if len(out) > 0 {
diff --git a/cmd/puppeth/wizard_node.go b/cmd/puppeth/wizard_node.go
index a70178db2..8de1a1b0b 100644
--- a/cmd/puppeth/wizard_node.go
+++ b/cmd/puppeth/wizard_node.go
@@ -45,6 +45,8 @@ func (w *wizard) deployNode(boot bool) {
client := w.servers[server]
// Retrieve any active node configurations from the server
+ existed := true
+
infos, err := checkNode(client, w.network, boot)
if err != nil {
if boot {
@@ -52,6 +54,7 @@ func (w *wizard) deployNode(boot bool) {
} else {
infos = &nodeInfos{portFull: 30303, peersTotal: 50, peersLight: 0, gasTarget: 4.7, gasPrice: 18}
}
+ existed = false
}
infos.genesis, _ = json.MarshalIndent(w.conf.Genesis, "", " ")
infos.network = w.conf.Genesis.Config.ChainId.Int64()
@@ -155,10 +158,12 @@ func (w *wizard) deployNode(boot bool) {
infos.gasPrice = w.readDefaultFloat(infos.gasPrice)
}
// Try to deploy the full node on the host
- fmt.Println()
- fmt.Printf("Should the node be built from scratch (y/n)? (default = no)\n")
- nocache := w.readDefaultString("n") != "n"
-
+ nocache := false
+ if existed {
+ fmt.Println()
+ fmt.Printf("Should the node be built from scratch (y/n)? (default = no)\n")
+ nocache = w.readDefaultString("n") != "n"
+ }
if out, err := deployNode(client, w.network, w.conf.bootFull, w.conf.bootLight, infos, nocache); err != nil {
log.Error("Failed to deploy Ethereum node container", "err", err)
if len(out) > 0 {
diff --git a/cmd/puppeth/wizard_wallet.go b/cmd/puppeth/wizard_wallet.go
index 1165c5cdc..aa6d1c659 100644
--- a/cmd/puppeth/wizard_wallet.go
+++ b/cmd/puppeth/wizard_wallet.go
@@ -43,9 +43,14 @@ func (w *wizard) deployWallet() {
client := w.servers[server]
// Retrieve any active node configurations from the server
+ existed := true
+
infos, err := checkWallet(client, w.network)
if err != nil {
- infos = &walletInfos{nodePort: 30303, rpcPort: 8545, webPort: 80, webHost: client.server}
+ infos = &walletInfos{
+ nodePort: 30303, rpcPort: 8545, webPort: 80, webHost: client.server,
+ }
+ existed = false
}
infos.genesis, _ = json.MarshalIndent(w.conf.Genesis, "", " ")
infos.network = w.conf.Genesis.Config.ChainId.Int64()
@@ -75,7 +80,7 @@ func (w *wizard) deployWallet() {
infos.nodePort = w.readDefaultInt(infos.nodePort)
fmt.Println()
- fmt.Printf("Which TCP/UDP port should the backing RPC API listen on? (default = %d)\n", infos.rpcPort)
+ fmt.Printf("Which port should the backing RPC API listen on? (default = %d)\n", infos.rpcPort)
infos.rpcPort = w.readDefaultInt(infos.rpcPort)
// Set a proper name to report on the stats page
@@ -88,10 +93,12 @@ func (w *wizard) deployWallet() {
infos.ethstats = w.readDefaultString(infos.ethstats) + ":" + w.conf.ethstats
}
// Try to deploy the wallet on the host
- fmt.Println()
- fmt.Printf("Should the wallet be built from scratch (y/n)? (default = no)\n")
- nocache := w.readDefaultString("n") != "n"
-
+ nocache := false
+ if existed {
+ fmt.Println()
+ fmt.Printf("Should the wallet be built from scratch (y/n)? (default = no)\n")
+ nocache = w.readDefaultString("n") != "n"
+ }
if out, err := deployWallet(client, w.network, w.conf.bootFull, infos, nocache); err != nil {
log.Error("Failed to deploy wallet container", "err", err)
if len(out) > 0 {