mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
cmd/puppeth: expose debug namespace for blockscout
This commit is contained in:
parent
88b7dcb627
commit
4fe257462b
2 changed files with 10 additions and 3 deletions
|
|
@ -32,10 +32,11 @@ import (
|
||||||
var explorerDockerfile = `
|
var explorerDockerfile = `
|
||||||
FROM puppeth/blockscout:latest
|
FROM puppeth/blockscout:latest
|
||||||
|
|
||||||
|
|
||||||
ADD genesis.json /genesis.json
|
ADD genesis.json /genesis.json
|
||||||
RUN \
|
RUN \
|
||||||
echo 'geth --cache 512 init /genesis.json' > explorer.sh && \
|
echo 'geth --cache 512 init /genesis.json' > explorer.sh && \
|
||||||
echo $'exec geth --networkid {{.NetworkID}} --syncmode "full" --port {{.NodePort}} --bootnodes {{.Bootnodes}} --ethstats \'{{.Ethstats}}\' --cache=512 --rpc --rpccorsdomain "*" --rpcvhosts "*" --ws --wsorigins "*" &' >> explorer.sh && \
|
echo $'exec geth --networkid {{.NetworkID}} --syncmode "full" --port {{.NodePort}} --bootnodes {{.Bootnodes}} --ethstats \'{{.Ethstats}}\' --cache=512 --rpc --rpcapi "net,web3,eth,shh,debug" --rpccorsdomain "*" --rpcvhosts "*" --ws --wsorigins "*" &' >> explorer.sh && \
|
||||||
echo '/usr/local/bin/docker-entrypoint.sh postgres &' >> explorer.sh && \
|
echo '/usr/local/bin/docker-entrypoint.sh postgres &' >> explorer.sh && \
|
||||||
echo 'sleep 5' >> explorer.sh && \
|
echo 'sleep 5' >> explorer.sh && \
|
||||||
echo 'mix do ecto.drop --force, ecto.create, ecto.migrate' >> explorer.sh && \
|
echo 'mix do ecto.drop --force, ecto.create, ecto.migrate' >> explorer.sh && \
|
||||||
|
|
@ -63,6 +64,7 @@ services:
|
||||||
- VIRTUAL_PORT=4000{{end}}
|
- VIRTUAL_PORT=4000{{end}}
|
||||||
- NODE_PORT={{.NodePort}}/tcp
|
- NODE_PORT={{.NodePort}}/tcp
|
||||||
- STATS={{.Ethstats}}
|
- STATS={{.Ethstats}}
|
||||||
|
- BLOCK_TRANSFORMER={{.Transformer}}
|
||||||
volumes:
|
volumes:
|
||||||
- {{.Datadir}}:/root/.ethereum
|
- {{.Datadir}}:/root/.ethereum
|
||||||
- {{.DBDir}}:/var/lib/postgresql/data
|
- {{.DBDir}}:/var/lib/postgresql/data
|
||||||
|
|
@ -77,7 +79,7 @@ services:
|
||||||
// deployExplorer deploys a new block explorer container to a remote machine via
|
// deployExplorer deploys a new block explorer container to a remote machine via
|
||||||
// SSH, docker and docker-compose. If an instance with the specified network name
|
// SSH, docker and docker-compose. If an instance with the specified network name
|
||||||
// already exists there, it will be overwritten!
|
// already exists there, it will be overwritten!
|
||||||
func deployExplorer(client *sshClient, network string, bootnodes []string, config *explorerInfos, nocache bool) ([]byte, error) {
|
func deployExplorer(client *sshClient, network string, bootnodes []string, config *explorerInfos, nocache bool, isClique bool) ([]byte, error) {
|
||||||
// Generate the content to upload to the server
|
// Generate the content to upload to the server
|
||||||
workdir := fmt.Sprintf("%d", rand.Int63())
|
workdir := fmt.Sprintf("%d", rand.Int63())
|
||||||
files := make(map[string][]byte)
|
files := make(map[string][]byte)
|
||||||
|
|
@ -91,6 +93,10 @@ func deployExplorer(client *sshClient, network string, bootnodes []string, confi
|
||||||
})
|
})
|
||||||
files[filepath.Join(workdir, "Dockerfile")] = dockerfile.Bytes()
|
files[filepath.Join(workdir, "Dockerfile")] = dockerfile.Bytes()
|
||||||
|
|
||||||
|
transformer := "base"
|
||||||
|
if isClique {
|
||||||
|
transformer = "clique"
|
||||||
|
}
|
||||||
composefile := new(bytes.Buffer)
|
composefile := new(bytes.Buffer)
|
||||||
template.Must(template.New("").Parse(explorerComposefile)).Execute(composefile, map[string]interface{}{
|
template.Must(template.New("").Parse(explorerComposefile)).Execute(composefile, map[string]interface{}{
|
||||||
"NetworkName": network,
|
"NetworkName": network,
|
||||||
|
|
@ -101,6 +107,7 @@ func deployExplorer(client *sshClient, network string, bootnodes []string, confi
|
||||||
"Network": network,
|
"Network": network,
|
||||||
"NodePort": config.nodePort,
|
"NodePort": config.nodePort,
|
||||||
"WebPort": config.webPort,
|
"WebPort": config.webPort,
|
||||||
|
"Transformer": transformer,
|
||||||
})
|
})
|
||||||
files[filepath.Join(workdir, "docker-compose.yaml")] = composefile.Bytes()
|
files[filepath.Join(workdir, "docker-compose.yaml")] = composefile.Bytes()
|
||||||
files[filepath.Join(workdir, "genesis.json")] = config.genesis
|
files[filepath.Join(workdir, "genesis.json")] = config.genesis
|
||||||
|
|
|
||||||
|
|
@ -103,7 +103,7 @@ func (w *wizard) deployExplorer() {
|
||||||
fmt.Printf("Should the explorer be built from scratch (y/n)? (default = no)\n")
|
fmt.Printf("Should the explorer be built from scratch (y/n)? (default = no)\n")
|
||||||
nocache = w.readDefaultYesNo(false)
|
nocache = w.readDefaultYesNo(false)
|
||||||
}
|
}
|
||||||
if out, err := deployExplorer(client, w.network, w.conf.bootnodes, infos, nocache); err != nil {
|
if out, err := deployExplorer(client, w.network, w.conf.bootnodes, infos, nocache, w.conf.Genesis.Config.Clique != nil); err != nil {
|
||||||
log.Error("Failed to deploy explorer container", "err", err)
|
log.Error("Failed to deploy explorer container", "err", err)
|
||||||
if len(out) > 0 {
|
if len(out) > 0 {
|
||||||
fmt.Printf("%s\n", out)
|
fmt.Printf("%s\n", out)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue