mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-17 01:13:45 +00:00
:octocat: 🚧 Found missed EthStats refs
This commit is contained in:
parent
ed547b8d50
commit
56c58342f5
16 changed files with 60 additions and 60 deletions
|
|
@ -14,7 +14,7 @@
|
||||||
// You should have received a copy of the GNU Lesser General Public License
|
// You should have received a copy of the GNU Lesser General Public License
|
||||||
// along with the go-burnout library. If not, see <http://www.gnu.org/licenses/>.
|
// along with the go-burnout library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
package ethdb_test
|
package brndb_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
|
@ -29,7 +29,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func newTestLDB() (*brndb.LDBDatabase, func()) {
|
func newTestLDB() (*brndb.LDBDatabase, func()) {
|
||||||
dirname, err := ioutil.TempDir(os.TempDir(), "ethdb_test_")
|
dirname, err := ioutil.TempDir(os.TempDir(), "brndb_test_")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic("failed to create test file: " + err.Error())
|
panic("failed to create test file: " + err.Error())
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -318,7 +318,7 @@ func (s *Service) readLoop(conn *websocket.Conn) {
|
||||||
if !ok {
|
if !ok {
|
||||||
log.Warn("Invalid stats history request", "msg", msg["emit"][1])
|
log.Warn("Invalid stats history request", "msg", msg["emit"][1])
|
||||||
s.histCh <- nil
|
s.histCh <- nil
|
||||||
continue // Ethstats sometime sends invalid history requests, ignore those
|
continue // Brnstats sometime sends invalid history requests, ignore those
|
||||||
}
|
}
|
||||||
list, ok := request["list"].([]interface{})
|
list, ok := request["list"].([]interface{})
|
||||||
if !ok {
|
if !ok {
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@ var (
|
||||||
ethPortFlag = flag.Int("ethport", 30303, "Listener port for the devp2p connection")
|
ethPortFlag = flag.Int("ethport", 30303, "Listener port for the devp2p connection")
|
||||||
bootFlag = flag.String("bootnodes", "", "Comma separated bootnode enode URLs to seed with")
|
bootFlag = flag.String("bootnodes", "", "Comma separated bootnode enode URLs to seed with")
|
||||||
netFlag = flag.Uint64("network", 0, "Network ID to use for the Burnout protocol")
|
netFlag = flag.Uint64("network", 0, "Network ID to use for the Burnout protocol")
|
||||||
statsFlag = flag.String("brnstats", "", "Ethstats network monitoring auth string")
|
statsFlag = flag.String("brnstats", "", "Brnstats network monitoring auth string")
|
||||||
|
|
||||||
netnameFlag = flag.String("faucet.name", "", "Network name to assign to the faucet")
|
netnameFlag = flag.String("faucet.name", "", "Network name to assign to the faucet")
|
||||||
payoutFlag = flag.Int("faucet.amount", 1, "Number of Ethers to pay out per user request")
|
payoutFlag = flag.Int("faucet.amount", 1, "Number of Ethers to pay out per user request")
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,7 @@ var tomlSettings = toml.Config{
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
type ethstatsConfig struct {
|
type brnstatsConfig struct {
|
||||||
URL string `toml:",omitempty"`
|
URL string `toml:",omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -79,7 +79,7 @@ type gethConfig struct {
|
||||||
Eth brn.Config
|
Eth brn.Config
|
||||||
Shh whisper.Config
|
Shh whisper.Config
|
||||||
Node node.Config
|
Node node.Config
|
||||||
Ethstats ethstatsConfig
|
Brnstats brnstatsConfig
|
||||||
}
|
}
|
||||||
|
|
||||||
func loadConfig(file string, cfg *gethConfig) error {
|
func loadConfig(file string, cfg *gethConfig) error {
|
||||||
|
|
@ -129,8 +129,8 @@ func makeConfigNode(ctx *cli.Context) (*node.Node, gethConfig) {
|
||||||
utils.Fatalf("Failed to create the protocol stack: %v", err)
|
utils.Fatalf("Failed to create the protocol stack: %v", err)
|
||||||
}
|
}
|
||||||
utils.SetEthConfig(ctx, stack, &cfg.Eth)
|
utils.SetEthConfig(ctx, stack, &cfg.Eth)
|
||||||
if ctx.GlobalIsSet(utils.EthStatsURLFlag.Name) {
|
if ctx.GlobalIsSet(utils.BrnStatsURLFlag.Name) {
|
||||||
cfg.Ethstats.URL = ctx.GlobalString(utils.EthStatsURLFlag.Name)
|
cfg.Brnstats.URL = ctx.GlobalString(utils.BrnStatsURLFlag.Name)
|
||||||
}
|
}
|
||||||
|
|
||||||
utils.SetShhConfig(ctx, stack, &cfg.Shh)
|
utils.SetShhConfig(ctx, stack, &cfg.Shh)
|
||||||
|
|
@ -167,8 +167,8 @@ func makeFullNode(ctx *cli.Context) *node.Node {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add the Burnout Stats daemon if requested.
|
// Add the Burnout Stats daemon if requested.
|
||||||
if cfg.Ethstats.URL != "" {
|
if cfg.Brnstats.URL != "" {
|
||||||
utils.RegisterEthStatsService(stack, cfg.Ethstats.URL)
|
utils.RegisterBrnStatsService(stack, cfg.Brnstats.URL)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add the release oracle service so it boots along with node.
|
// Add the release oracle service so it boots along with node.
|
||||||
|
|
|
||||||
|
|
@ -105,7 +105,7 @@ var (
|
||||||
utils.VMEnableDebugFlag,
|
utils.VMEnableDebugFlag,
|
||||||
utils.NetworkIdFlag,
|
utils.NetworkIdFlag,
|
||||||
utils.RPCCORSDomainFlag,
|
utils.RPCCORSDomainFlag,
|
||||||
utils.EthStatsURLFlag,
|
utils.BrnStatsURLFlag,
|
||||||
utils.MetricsEnabledFlag,
|
utils.MetricsEnabledFlag,
|
||||||
utils.FakePoWFlag,
|
utils.FakePoWFlag,
|
||||||
utils.NoCompactionFlag,
|
utils.NoCompactionFlag,
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,7 @@ var AppHelpFlagGroups = []flagGroup{
|
||||||
utils.RinkebyFlag,
|
utils.RinkebyFlag,
|
||||||
utils.DevModeFlag,
|
utils.DevModeFlag,
|
||||||
utils.SyncModeFlag,
|
utils.SyncModeFlag,
|
||||||
utils.EthStatsURLFlag,
|
utils.BrnStatsURLFlag,
|
||||||
utils.IdentityFlag,
|
utils.IdentityFlag,
|
||||||
utils.LightServFlag,
|
utils.LightServFlag,
|
||||||
utils.LightPeersFlag,
|
utils.LightPeersFlag,
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,7 @@ var dashboardContent = `
|
||||||
<div id="sidebar-menu" class="main_menu_side hidden-print main_menu">
|
<div id="sidebar-menu" class="main_menu_side hidden-print main_menu">
|
||||||
<div class="menu_section">
|
<div class="menu_section">
|
||||||
<ul class="nav side-menu">
|
<ul class="nav side-menu">
|
||||||
{{if .EthstatsPage}}<li><a onclick="load('//{{.EthstatsPage}}')"><i class="fa fa-tachometer"></i> Network Stats</a></li>{{end}}
|
{{if .BrnstatsPage}}<li><a onclick="load('//{{.BrnstatsPage}}')"><i class="fa fa-tachometer"></i> Network Stats</a></li>{{end}}
|
||||||
{{if .ExplorerPage}}<li><a onclick="load('//{{.ExplorerPage}}')"><i class="fa fa-database"></i> Block Explorer</a></li>{{end}}
|
{{if .ExplorerPage}}<li><a onclick="load('//{{.ExplorerPage}}')"><i class="fa fa-database"></i> Block Explorer</a></li>{{end}}
|
||||||
{{if .WalletPage}}<li><a onclick="load('//{{.WalletPage}}')"><i class="fa fa-address-book-o"></i> Browser Wallet</a></li>{{end}}
|
{{if .WalletPage}}<li><a onclick="load('//{{.WalletPage}}')"><i class="fa fa-address-book-o"></i> Browser Wallet</a></li>{{end}}
|
||||||
{{if .FaucetPage}}<li><a onclick="load('//{{.FaucetPage}}')"><i class="fa fa-bath"></i> Crypto Faucet</a></li>{{end}}
|
{{if .FaucetPage}}<li><a onclick="load('//{{.FaucetPage}}')"><i class="fa fa-bath"></i> Crypto Faucet</a></li>{{end}}
|
||||||
|
|
@ -114,7 +114,7 @@ var dashboardContent = `
|
||||||
<br/>
|
<br/>
|
||||||
<p>To run an archive node, download <a href="/{{.GethGenesis}}"><code>{{.GethGenesis}}</code></a> and start Geth with:
|
<p>To run an archive node, download <a href="/{{.GethGenesis}}"><code>{{.GethGenesis}}</code></a> and start Geth with:
|
||||||
<pre>geth --datadir=$HOME/.{{.Network}} init {{.GethGenesis}}</pre>
|
<pre>geth --datadir=$HOME/.{{.Network}} init {{.GethGenesis}}</pre>
|
||||||
<pre>geth --networkid={{.NetworkID}} --datadir=$HOME/.{{.Network}} --cache=1024 --syncmode=full{{if .Ethstats}} --brnstats='{{.Ethstats}}'{{end}} --bootnodes={{.BootnodesFullFlat}}</pre>
|
<pre>geth --networkid={{.NetworkID}} --datadir=$HOME/.{{.Network}} --cache=1024 --syncmode=full{{if .Brnstats}} --brnstats='{{.Brnstats}}'{{end}} --bootnodes={{.BootnodesFullFlat}}</pre>
|
||||||
</p>
|
</p>
|
||||||
<br/>
|
<br/>
|
||||||
<p>You can download Geth from <a href="https://geth.burnout.org/downloads/" target="about:blank">https://geth.burnout.org/downloads/</a>.</p>
|
<p>You can download Geth from <a href="https://geth.burnout.org/downloads/" target="about:blank">https://geth.burnout.org/downloads/</a>.</p>
|
||||||
|
|
@ -133,7 +133,7 @@ var dashboardContent = `
|
||||||
<br/>
|
<br/>
|
||||||
<p>To run a full node, download <a href="/{{.GethGenesis}}"><code>{{.GethGenesis}}</code></a> and start Geth with:
|
<p>To run a full node, download <a href="/{{.GethGenesis}}"><code>{{.GethGenesis}}</code></a> and start Geth with:
|
||||||
<pre>geth --datadir=$HOME/.{{.Network}} init {{.GethGenesis}}</pre>
|
<pre>geth --datadir=$HOME/.{{.Network}} init {{.GethGenesis}}</pre>
|
||||||
<pre>geth --networkid={{.NetworkID}} --datadir=$HOME/.{{.Network}} --cache=512{{if .Ethstats}} --brnstats='{{.Ethstats}}'{{end}} --bootnodes={{.BootnodesFullFlat}}</pre>
|
<pre>geth --networkid={{.NetworkID}} --datadir=$HOME/.{{.Network}} --cache=512{{if .Brnstats}} --brnstats='{{.Brnstats}}'{{end}} --bootnodes={{.BootnodesFullFlat}}</pre>
|
||||||
</p>
|
</p>
|
||||||
<br/>
|
<br/>
|
||||||
<p>You can download Geth from <a href="https://geth.burnout.org/downloads/" target="about:blank">https://geth.burnout.org/downloads/</a>.</p>
|
<p>You can download Geth from <a href="https://geth.burnout.org/downloads/" target="about:blank">https://geth.burnout.org/downloads/</a>.</p>
|
||||||
|
|
@ -155,7 +155,7 @@ var dashboardContent = `
|
||||||
<br/>
|
<br/>
|
||||||
<p>To run a light node, download <a href="/{{.GethGenesis}}"><code>{{.GethGenesis}}</code></a> and start Geth with:
|
<p>To run a light node, download <a href="/{{.GethGenesis}}"><code>{{.GethGenesis}}</code></a> and start Geth with:
|
||||||
<pre>geth --datadir=$HOME/.{{.Network}} --light init {{.GethGenesis}}</pre>
|
<pre>geth --datadir=$HOME/.{{.Network}} --light init {{.GethGenesis}}</pre>
|
||||||
<pre>geth --networkid={{.NetworkID}} --datadir=$HOME/.{{.Network}} --syncmode=light{{if .Ethstats}} --brnstats='{{.Ethstats}}'{{end}} --bootnodes={{.BootnodesLightFlat}}</pre>
|
<pre>geth --networkid={{.NetworkID}} --datadir=$HOME/.{{.Network}} --syncmode=light{{if .Brnstats}} --brnstats='{{.Brnstats}}'{{end}} --bootnodes={{.BootnodesLightFlat}}</pre>
|
||||||
</p>
|
</p>
|
||||||
<br/>
|
<br/>
|
||||||
<p>You can download Geth from <a href="https://geth.burnout.org/downloads/" target="about:blank">https://geth.burnout.org/downloads/</a>.</p>
|
<p>You can download Geth from <a href="https://geth.burnout.org/downloads/" target="about:blank">https://geth.burnout.org/downloads/</a>.</p>
|
||||||
|
|
@ -174,7 +174,7 @@ var dashboardContent = `
|
||||||
<br/>
|
<br/>
|
||||||
<p>To run an embedded node, download <a href="/{{.GethGenesis}}"><code>{{.GethGenesis}}</code></a> and start Geth with:
|
<p>To run an embedded node, download <a href="/{{.GethGenesis}}"><code>{{.GethGenesis}}</code></a> and start Geth with:
|
||||||
<pre>geth --datadir=$HOME/.{{.Network}} --light init {{.GethGenesis}}</pre>
|
<pre>geth --datadir=$HOME/.{{.Network}} --light init {{.GethGenesis}}</pre>
|
||||||
<pre>geth --networkid={{.NetworkID}} --datadir=$HOME/.{{.Network}} --cache=32 --syncmode=light{{if .Ethstats}} --brnstats='{{.Ethstats}}'{{end}} --bootnodes={{.BootnodesLightFlat}}</pre>
|
<pre>geth --networkid={{.NetworkID}} --datadir=$HOME/.{{.Network}} --cache=32 --syncmode=light{{if .Brnstats}} --brnstats='{{.Brnstats}}'{{end}} --bootnodes={{.BootnodesLightFlat}}</pre>
|
||||||
</p>
|
</p>
|
||||||
<br/>
|
<br/>
|
||||||
<p>You can download Geth from <a href="https://geth.burnout.org/downloads/" target="about:blank">https://geth.burnout.org/downloads/</a>.</p>
|
<p>You can download Geth from <a href="https://geth.burnout.org/downloads/" target="about:blank">https://geth.burnout.org/downloads/</a>.</p>
|
||||||
|
|
@ -205,7 +205,7 @@ var dashboardContent = `
|
||||||
<pre>geth --datadir=$HOME/.{{.Network}} init {{.GethGenesis}}</pre>
|
<pre>geth --datadir=$HOME/.{{.Network}} init {{.GethGenesis}}</pre>
|
||||||
</p>
|
</p>
|
||||||
<p>With your local chain initialized, you can start the Burnout Wallet:
|
<p>With your local chain initialized, you can start the Burnout Wallet:
|
||||||
<pre>burnoutwallet --rpc $HOME/.{{.Network}}/geth.ipc --node-networkid={{.NetworkID}} --node-datadir=$HOME/.{{.Network}}{{if .Ethstats}} --node-brnstats='{{.Ethstats}}'{{end}} --node-bootnodes={{.BootnodesFullFlat}}</pre>
|
<pre>burnoutwallet --rpc $HOME/.{{.Network}}/geth.ipc --node-networkid={{.NetworkID}} --node-datadir=$HOME/.{{.Network}}{{if .Brnstats}} --node-brnstats='{{.Brnstats}}'{{end}} --node-bootnodes={{.BootnodesFullFlat}}</pre>
|
||||||
<p>
|
<p>
|
||||||
<br/>
|
<br/>
|
||||||
<p>You can download the Burnout Wallet from <a href="https://github.com/burnout/mist/releases" target="about:blank">https://github.com/burnout/mist/releases</a>.</p>
|
<p>You can download the Burnout Wallet from <a href="https://github.com/burnout/mist/releases" target="about:blank">https://github.com/burnout/mist/releases</a>.</p>
|
||||||
|
|
@ -226,7 +226,7 @@ var dashboardContent = `
|
||||||
<pre>geth --datadir=$HOME/.{{.Network}} init {{.GethGenesis}}</pre>
|
<pre>geth --datadir=$HOME/.{{.Network}} init {{.GethGenesis}}</pre>
|
||||||
</p>
|
</p>
|
||||||
<p>With your local chain initialized, you can start Mist:
|
<p>With your local chain initialized, you can start Mist:
|
||||||
<pre>mist --rpc $HOME/.{{.Network}}/geth.ipc --node-networkid={{.NetworkID}} --node-datadir=$HOME/.{{.Network}}{{if .Ethstats}} --node-brnstats='{{.Ethstats}}'{{end}} --node-bootnodes={{.BootnodesFullFlat}}</pre>
|
<pre>mist --rpc $HOME/.{{.Network}}/geth.ipc --node-networkid={{.NetworkID}} --node-datadir=$HOME/.{{.Network}}{{if .Brnstats}} --node-brnstats='{{.Brnstats}}'{{end}} --node-bootnodes={{.BootnodesFullFlat}}</pre>
|
||||||
<p>
|
<p>
|
||||||
<br/>
|
<br/>
|
||||||
<p>You can download the Mist browser from <a href="https://github.com/burnout/mist/releases" target="about:blank">https://github.com/burnout/mist/releases</a>.</p>
|
<p>You can download the Mist browser from <a href="https://github.com/burnout/mist/releases" target="about:blank">https://github.com/burnout/mist/releases</a>.</p>
|
||||||
|
|
@ -264,8 +264,8 @@ bootnodes.append(new Enode("{{.}}"));{{end}}
|
||||||
NodeConfig config = new NodeConfig();
|
NodeConfig config = new NodeConfig();
|
||||||
config.setBootstrapNodes(bootnodes);
|
config.setBootstrapNodes(bootnodes);
|
||||||
config.setBurnoutNetworkID({{.NetworkID}});
|
config.setBurnoutNetworkID({{.NetworkID}});
|
||||||
config.setBurnoutGenesis(genesis);{{if .Ethstats}}
|
config.setBurnoutGenesis(genesis);{{if .Brnstats}}
|
||||||
config.setBurnoutNetStats("{{.Ethstats}}");{{end}}
|
config.setBurnoutNetStats("{{.Brnstats}}");{{end}}
|
||||||
|
|
||||||
Node node = new Node(getFilesDir() + "/.{{.Network}}", config);
|
Node node = new Node(getFilesDir() + "/.{{.Network}}", config);
|
||||||
node.start();
|
node.start();
|
||||||
|
|
@ -297,8 +297,8 @@ bootnodes?.append(GethNewEnode("{{.}}", &error)){{end}}
|
||||||
let config = GethNewNodeConfig()
|
let config = GethNewNodeConfig()
|
||||||
config?.setBootstrapNodes(bootnodes)
|
config?.setBootstrapNodes(bootnodes)
|
||||||
config?.setBurnoutNetworkID({{.NetworkID}})
|
config?.setBurnoutNetworkID({{.NetworkID}})
|
||||||
config?.setBurnoutGenesis(genesis){{if .Ethstats}}
|
config?.setBurnoutGenesis(genesis){{if .Brnstats}}
|
||||||
config?.setBurnoutNetStats("{{.Ethstats}}"){{end}}
|
config?.setBurnoutNetStats("{{.Brnstats}}"){{end}}
|
||||||
|
|
||||||
let datadir = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)[0]
|
let datadir = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)[0]
|
||||||
let node = GethNewNode(datadir + "/.{{.Network}}", config, &error);
|
let node = GethNewNode(datadir + "/.{{.Network}}", config, &error);
|
||||||
|
|
@ -464,7 +464,7 @@ func deployDashboard(client *sshClient, network string, port int, vhost string,
|
||||||
"Network": network,
|
"Network": network,
|
||||||
"NetworkID": conf.genesis.Config.ChainId,
|
"NetworkID": conf.genesis.Config.ChainId,
|
||||||
"NetworkTitle": strings.Title(network),
|
"NetworkTitle": strings.Title(network),
|
||||||
"EthstatsPage": services["brnstats"],
|
"BrnstatsPage": services["brnstats"],
|
||||||
"ExplorerPage": services["explorer"],
|
"ExplorerPage": services["explorer"],
|
||||||
"WalletPage": services["wallet"],
|
"WalletPage": services["wallet"],
|
||||||
"FaucetPage": services["faucet"],
|
"FaucetPage": services["faucet"],
|
||||||
|
|
@ -473,7 +473,7 @@ func deployDashboard(client *sshClient, network string, port int, vhost string,
|
||||||
"BootnodesLight": conf.bootLight,
|
"BootnodesLight": conf.bootLight,
|
||||||
"BootnodesFullFlat": strings.Join(conf.bootFull, ","),
|
"BootnodesFullFlat": strings.Join(conf.bootFull, ","),
|
||||||
"BootnodesLightFlat": strings.Join(conf.bootLight, ","),
|
"BootnodesLightFlat": strings.Join(conf.bootLight, ","),
|
||||||
"Ethstats": statsLogin,
|
"Brnstats": statsLogin,
|
||||||
})
|
})
|
||||||
files[filepath.Join(workdir, "index.html")] = indexfile.Bytes()
|
files[filepath.Join(workdir, "index.html")] = indexfile.Bytes()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,9 +27,9 @@ import (
|
||||||
"github.com/burnout/go-burnout/log"
|
"github.com/burnout/go-burnout/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ethstatsDockerfile is the Dockerfile required to build an brnstats backend
|
// brnstatsDockerfile is the Dockerfile required to build an brnstats backend
|
||||||
// and associated monitoring site.
|
// and associated monitoring site.
|
||||||
var ethstatsDockerfile = `
|
var brnstatsDockerfile = `
|
||||||
FROM mhart/alpine-node:latest
|
FROM mhart/alpine-node:latest
|
||||||
|
|
||||||
RUN \
|
RUN \
|
||||||
|
|
@ -47,9 +47,9 @@ RUN echo 'module.exports = {trusted: [{{.Trusted}}], banned: [{{.Banned}}], rese
|
||||||
CMD ["npm", "start"]
|
CMD ["npm", "start"]
|
||||||
`
|
`
|
||||||
|
|
||||||
// ethstatsComposefile is the docker-compose.yml file required to deploy and
|
// brnstatsComposefile is the docker-compose.yml file required to deploy and
|
||||||
// maintain an brnstats monitoring site.
|
// maintain an brnstats monitoring site.
|
||||||
var ethstatsComposefile = `
|
var brnstatsComposefile = `
|
||||||
version: '2'
|
version: '2'
|
||||||
services:
|
services:
|
||||||
brnstats:
|
brnstats:
|
||||||
|
|
@ -69,10 +69,10 @@ services:
|
||||||
restart: always
|
restart: always
|
||||||
`
|
`
|
||||||
|
|
||||||
// deployEthstats deploys a new brnstats container to a remote machine via SSH,
|
// deployBrnstats deploys a new brnstats container to a remote machine via SSH,
|
||||||
// docker and docker-compose. If an instance with the specified network name
|
// 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 deployEthstats(client *sshClient, network string, port int, secret string, vhost string, trusted []string, banned []string) ([]byte, error) {
|
func deployBrnstats(client *sshClient, network string, port int, secret string, vhost string, trusted []string, banned []string) ([]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)
|
||||||
|
|
@ -87,14 +87,14 @@ func deployEthstats(client *sshClient, network string, port int, secret string,
|
||||||
}
|
}
|
||||||
|
|
||||||
dockerfile := new(bytes.Buffer)
|
dockerfile := new(bytes.Buffer)
|
||||||
template.Must(template.New("").Parse(ethstatsDockerfile)).Execute(dockerfile, map[string]interface{}{
|
template.Must(template.New("").Parse(brnstatsDockerfile)).Execute(dockerfile, map[string]interface{}{
|
||||||
"Trusted": strings.Join(trustedLabels, ", "),
|
"Trusted": strings.Join(trustedLabels, ", "),
|
||||||
"Banned": strings.Join(bannedLabels, ", "),
|
"Banned": strings.Join(bannedLabels, ", "),
|
||||||
})
|
})
|
||||||
files[filepath.Join(workdir, "Dockerfile")] = dockerfile.Bytes()
|
files[filepath.Join(workdir, "Dockerfile")] = dockerfile.Bytes()
|
||||||
|
|
||||||
composefile := new(bytes.Buffer)
|
composefile := new(bytes.Buffer)
|
||||||
template.Must(template.New("").Parse(ethstatsComposefile)).Execute(composefile, map[string]interface{}{
|
template.Must(template.New("").Parse(brnstatsComposefile)).Execute(composefile, map[string]interface{}{
|
||||||
"Network": network,
|
"Network": network,
|
||||||
"Port": port,
|
"Port": port,
|
||||||
"Secret": secret,
|
"Secret": secret,
|
||||||
|
|
@ -113,9 +113,9 @@ func deployEthstats(client *sshClient, network string, port int, secret string,
|
||||||
return nil, client.Stream(fmt.Sprintf("cd %s && docker-compose -p %s up -d --build", workdir, network))
|
return nil, client.Stream(fmt.Sprintf("cd %s && docker-compose -p %s up -d --build", workdir, network))
|
||||||
}
|
}
|
||||||
|
|
||||||
// ethstatsInfos is returned from an brnstats status check to allow reporting
|
// brnstatsInfos is returned from an brnstats status check to allow reporting
|
||||||
// various configuration parameters.
|
// various configuration parameters.
|
||||||
type ethstatsInfos struct {
|
type brnstatsInfos struct {
|
||||||
host string
|
host string
|
||||||
port int
|
port int
|
||||||
secret string
|
secret string
|
||||||
|
|
@ -124,15 +124,15 @@ type ethstatsInfos struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// String implements the stringer interface.
|
// String implements the stringer interface.
|
||||||
func (info *ethstatsInfos) String() string {
|
func (info *brnstatsInfos) String() string {
|
||||||
return fmt.Sprintf("host=%s, port=%d, secret=%s, banned=%v", info.host, info.port, info.secret, info.banned)
|
return fmt.Sprintf("host=%s, port=%d, secret=%s, banned=%v", info.host, info.port, info.secret, info.banned)
|
||||||
}
|
}
|
||||||
|
|
||||||
// checkEthstats does a health-check against an brnstats server to verify whether
|
// checkBrnstats does a health-check against an brnstats server to verify whether
|
||||||
// it's running, and if yes, gathering a collection of useful infos about it.
|
// it's running, and if yes, gathering a collection of useful infos about it.
|
||||||
func checkEthstats(client *sshClient, network string) (*ethstatsInfos, error) {
|
func checkBrnstats(client *sshClient, network string) (*brnstatsInfos, error) {
|
||||||
// Inspect a possible brnstats container on the host
|
// Inspect a possible brnstats container on the host
|
||||||
infos, err := inspectContainer(client, fmt.Sprintf("%s_ethstats_1", network))
|
infos, err := inspectContainer(client, fmt.Sprintf("%s_brnstats_1", network))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
@ -164,10 +164,10 @@ func checkEthstats(client *sshClient, network string) (*ethstatsInfos, error) {
|
||||||
|
|
||||||
// Run a sanity check to see if the port is reachable
|
// Run a sanity check to see if the port is reachable
|
||||||
if err = checkPort(host, port); err != nil {
|
if err = checkPort(host, port); err != nil {
|
||||||
log.Warn("Ethstats service seems unreachable", "server", host, "port", port, "err", err)
|
log.Warn("Brnstats service seems unreachable", "server", host, "port", port, "err", err)
|
||||||
}
|
}
|
||||||
// Container available, assemble and return the useful infos
|
// Container available, assemble and return the useful infos
|
||||||
return ðstatsInfos{
|
return &brnstatsInfos{
|
||||||
host: host,
|
host: host,
|
||||||
port: port,
|
port: port,
|
||||||
secret: secret,
|
secret: secret,
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ ADD account.pass /account.pass
|
||||||
EXPOSE 8080
|
EXPOSE 8080
|
||||||
|
|
||||||
CMD [ \
|
CMD [ \
|
||||||
"/faucet", "--genesis", "/genesis.json", "--network", "{{.NetworkID}}", "--bootnodes", "{{.Bootnodes}}", "--brnstats", "{{.Ethstats}}", "--ethport", "{{.EthPort}}", \
|
"/faucet", "--genesis", "/genesis.json", "--network", "{{.NetworkID}}", "--bootnodes", "{{.Bootnodes}}", "--brnstats", "{{.Brnstats}}", "--ethport", "{{.EthPort}}", \
|
||||||
"--faucet.name", "{{.FaucetName}}", "--faucet.amount", "{{.FaucetAmount}}", "--faucet.minutes", "{{.FaucetMinutes}}", "--faucet.tiers", "{{.FaucetTiers}}", \
|
"--faucet.name", "{{.FaucetName}}", "--faucet.amount", "{{.FaucetAmount}}", "--faucet.minutes", "{{.FaucetMinutes}}", "--faucet.tiers", "{{.FaucetTiers}}", \
|
||||||
"--github.user", "{{.GitHubUser}}", "--github.token", "{{.GitHubToken}}", "--account.json", "/account.json", "--account.pass", "/account.pass" \
|
"--github.user", "{{.GitHubUser}}", "--github.token", "{{.GitHubToken}}", "--account.json", "/account.json", "--account.pass", "/account.pass" \
|
||||||
{{if .CaptchaToken}}, "--captcha.token", "{{.CaptchaToken}}", "--captcha.secret", "{{.CaptchaSecret}}"{{end}} \
|
{{if .CaptchaToken}}, "--captcha.token", "{{.CaptchaToken}}", "--captcha.secret", "{{.CaptchaSecret}}"{{end}} \
|
||||||
|
|
@ -102,7 +102,7 @@ func deployFaucet(client *sshClient, network string, bootnodes []string, config
|
||||||
template.Must(template.New("").Parse(faucetDockerfile)).Execute(dockerfile, map[string]interface{}{
|
template.Must(template.New("").Parse(faucetDockerfile)).Execute(dockerfile, map[string]interface{}{
|
||||||
"NetworkID": config.node.network,
|
"NetworkID": config.node.network,
|
||||||
"Bootnodes": strings.Join(bootnodes, ","),
|
"Bootnodes": strings.Join(bootnodes, ","),
|
||||||
"Ethstats": config.node.brnstats,
|
"Brnstats": config.node.brnstats,
|
||||||
"EthPort": config.node.portFull,
|
"EthPort": config.node.portFull,
|
||||||
"GitHubUser": config.githubUser,
|
"GitHubUser": config.githubUser,
|
||||||
"GitHubToken": config.githubToken,
|
"GitHubToken": config.githubToken,
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ ADD genesis.json /genesis.json
|
||||||
RUN \
|
RUN \
|
||||||
echo 'geth init /genesis.json' > geth.sh && \{{if .Unlock}}
|
echo 'geth init /genesis.json' > geth.sh && \{{if .Unlock}}
|
||||||
echo 'mkdir -p /root/.burnout/keystore/ && cp /signer.json /root/.burnout/keystore/' >> geth.sh && \{{end}}
|
echo 'mkdir -p /root/.burnout/keystore/ && cp /signer.json /root/.burnout/keystore/' >> geth.sh && \{{end}}
|
||||||
echo $'geth --networkid {{.NetworkID}} --cache 512 --port {{.Port}} --maxpeers {{.Peers}} {{.LightFlag}} --brnstats \'{{.Ethstats}}\' {{if .BootV4}}--bootnodesv4 {{.BootV4}}{{end}} {{if .BootV5}}--bootnodesv5 {{.BootV5}}{{end}} {{if .Etherbase}}--etherbase {{.Etherbase}} --mine{{end}}{{if .Unlock}}--unlock 0 --password /signer.pass --mine{{end}} --targetgaslimit {{.GasTarget}} --gasprice {{.GasPrice}}' >> geth.sh
|
echo $'geth --networkid {{.NetworkID}} --cache 512 --port {{.Port}} --maxpeers {{.Peers}} {{.LightFlag}} --brnstats \'{{.Brnstats}}\' {{if .BootV4}}--bootnodesv4 {{.BootV4}}{{end}} {{if .BootV5}}--bootnodesv5 {{.BootV5}}{{end}} {{if .Etherbase}}--etherbase {{.Etherbase}} --mine{{end}}{{if .Unlock}}--unlock 0 --password /signer.pass --mine{{end}} --targetgaslimit {{.GasTarget}} --gasprice {{.GasPrice}}' >> geth.sh
|
||||||
|
|
||||||
ENTRYPOINT ["/bin/sh", "geth.sh"]
|
ENTRYPOINT ["/bin/sh", "geth.sh"]
|
||||||
`
|
`
|
||||||
|
|
@ -64,7 +64,7 @@ services:
|
||||||
- LIGHT_PORT={{.LightPort}}/udp
|
- LIGHT_PORT={{.LightPort}}/udp
|
||||||
- TOTAL_PEERS={{.TotalPeers}}
|
- TOTAL_PEERS={{.TotalPeers}}
|
||||||
- LIGHT_PEERS={{.LightPeers}}
|
- LIGHT_PEERS={{.LightPeers}}
|
||||||
- STATS_NAME={{.Ethstats}}
|
- STATS_NAME={{.Brnstats}}
|
||||||
- MINER_NAME={{.Etherbase}}
|
- MINER_NAME={{.Etherbase}}
|
||||||
- GAS_TARGET={{.GasTarget}}
|
- GAS_TARGET={{.GasTarget}}
|
||||||
- GAS_PRICE={{.GasPrice}}
|
- GAS_PRICE={{.GasPrice}}
|
||||||
|
|
@ -102,7 +102,7 @@ func deployNode(client *sshClient, network string, bootv4, bootv5 []string, conf
|
||||||
"LightFlag": lightFlag,
|
"LightFlag": lightFlag,
|
||||||
"BootV4": strings.Join(bootv4, ","),
|
"BootV4": strings.Join(bootv4, ","),
|
||||||
"BootV5": strings.Join(bootv5, ","),
|
"BootV5": strings.Join(bootv5, ","),
|
||||||
"Ethstats": config.brnstats,
|
"Brnstats": config.brnstats,
|
||||||
"Etherbase": config.etherbase,
|
"Etherbase": config.etherbase,
|
||||||
"GasTarget": uint64(1000000 * config.gasTarget),
|
"GasTarget": uint64(1000000 * config.gasTarget),
|
||||||
"GasPrice": uint64(1000000000 * config.gasPrice),
|
"GasPrice": uint64(1000000000 * config.gasPrice),
|
||||||
|
|
@ -120,7 +120,7 @@ func deployNode(client *sshClient, network string, bootv4, bootv5 []string, conf
|
||||||
"Light": config.peersLight > 0,
|
"Light": config.peersLight > 0,
|
||||||
"LightPort": config.portFull + 1,
|
"LightPort": config.portFull + 1,
|
||||||
"LightPeers": config.peersLight,
|
"LightPeers": config.peersLight,
|
||||||
"Ethstats": config.brnstats[:strings.Index(config.brnstats, ":")],
|
"Brnstats": config.brnstats[:strings.Index(config.brnstats, ":")],
|
||||||
"Etherbase": config.etherbase,
|
"Etherbase": config.etherbase,
|
||||||
"GasTarget": config.gasTarget,
|
"GasTarget": config.gasTarget,
|
||||||
"GasPrice": config.gasPrice,
|
"GasPrice": config.gasPrice,
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ type config struct {
|
||||||
genesis *core.Genesis // Genesis block to cache for node deploys
|
genesis *core.Genesis // Genesis block to cache for node deploys
|
||||||
bootFull []string // Bootnodes to always connect to by full nodes
|
bootFull []string // Bootnodes to always connect to by full nodes
|
||||||
bootLight []string // Bootnodes to always connect to by light nodes
|
bootLight []string // Bootnodes to always connect to by light nodes
|
||||||
brnstats string // Ethstats settings to cache for node deploys
|
brnstats string // Brnstats settings to cache for node deploys
|
||||||
|
|
||||||
Servers map[string][]byte `json:"servers,omitempty"`
|
Servers map[string][]byte `json:"servers,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,7 @@ func (w *wizard) deployDashboard() {
|
||||||
var port int
|
var port int
|
||||||
switch service {
|
switch service {
|
||||||
case "brnstats":
|
case "brnstats":
|
||||||
if infos, err := checkEthstats(client, w.network); err == nil {
|
if infos, err := checkBrnstats(client, w.network); err == nil {
|
||||||
port = infos.port
|
port = infos.port
|
||||||
}
|
}
|
||||||
case "faucet":
|
case "faucet":
|
||||||
|
|
|
||||||
|
|
@ -22,9 +22,9 @@ import (
|
||||||
"github.com/burnout/go-burnout/log"
|
"github.com/burnout/go-burnout/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
// deployEthstats queries the user for various input on deploying an brnstats
|
// deployBrnstats queries the user for various input on deploying an brnstats
|
||||||
// monitoring server, after which it executes it.
|
// monitoring server, after which it executes it.
|
||||||
func (w *wizard) deployEthstats() {
|
func (w *wizard) deployBrnstats() {
|
||||||
// Select the server to interact with
|
// Select the server to interact with
|
||||||
server := w.selectServer()
|
server := w.selectServer()
|
||||||
if server == "" {
|
if server == "" {
|
||||||
|
|
@ -33,9 +33,9 @@ func (w *wizard) deployEthstats() {
|
||||||
client := w.servers[server]
|
client := w.servers[server]
|
||||||
|
|
||||||
// Retrieve any active brnstats configurations from the server
|
// Retrieve any active brnstats configurations from the server
|
||||||
infos, err := checkEthstats(client, w.network)
|
infos, err := checkBrnstats(client, w.network)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
infos = ðstatsInfos{
|
infos = &brnstatsInfos{
|
||||||
port: 80,
|
port: 80,
|
||||||
host: client.server,
|
host: client.server,
|
||||||
secret: "",
|
secret: "",
|
||||||
|
|
@ -83,7 +83,7 @@ func (w *wizard) deployEthstats() {
|
||||||
trusted = append(trusted, client.address)
|
trusted = append(trusted, client.address)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if out, err := deployEthstats(client, w.network, infos.port, infos.secret, infos.host, trusted, infos.banned); err != nil {
|
if out, err := deployBrnstats(client, w.network, infos.port, infos.secret, infos.host, trusted, infos.banned); err != nil {
|
||||||
log.Error("Failed to deploy brnstats container", "err", err)
|
log.Error("Failed to deploy brnstats container", "err", err)
|
||||||
if len(out) > 0 {
|
if len(out) > 0 {
|
||||||
fmt.Printf("%s\n", out)
|
fmt.Printf("%s\n", out)
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ func (w *wizard) networkStats(tips bool) {
|
||||||
services["nginx"] = infos.String()
|
services["nginx"] = infos.String()
|
||||||
}
|
}
|
||||||
logger.Debug("Checking for brnstats availability")
|
logger.Debug("Checking for brnstats availability")
|
||||||
if infos, err := checkEthstats(client, w.network); err != nil {
|
if infos, err := checkBrnstats(client, w.network); err != nil {
|
||||||
if err != ErrServiceUnknown {
|
if err != ErrServiceUnknown {
|
||||||
services["brnstats"] = err.Error()
|
services["brnstats"] = err.Error()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -171,7 +171,7 @@ func (w *wizard) deployComponent() {
|
||||||
// Print all the things we can deploy and wait or user choice
|
// Print all the things we can deploy and wait or user choice
|
||||||
fmt.Println()
|
fmt.Println()
|
||||||
fmt.Println("What would you like to deploy? (recommended order)")
|
fmt.Println("What would you like to deploy? (recommended order)")
|
||||||
fmt.Println(" 1. Ethstats - Network monitoring tool")
|
fmt.Println(" 1. Brnstats - Network monitoring tool")
|
||||||
fmt.Println(" 2. Bootnode - Entry point of the network")
|
fmt.Println(" 2. Bootnode - Entry point of the network")
|
||||||
fmt.Println(" 3. Sealer - Full node minting new blocks")
|
fmt.Println(" 3. Sealer - Full node minting new blocks")
|
||||||
fmt.Println(" 4. Wallet - Browser wallet for quick sends (todo)")
|
fmt.Println(" 4. Wallet - Browser wallet for quick sends (todo)")
|
||||||
|
|
@ -180,7 +180,7 @@ func (w *wizard) deployComponent() {
|
||||||
|
|
||||||
switch w.read() {
|
switch w.read() {
|
||||||
case "1":
|
case "1":
|
||||||
w.deployEthstats()
|
w.deployBrnstats()
|
||||||
case "2":
|
case "2":
|
||||||
w.deployNode(true)
|
w.deployNode(true)
|
||||||
case "3":
|
case "3":
|
||||||
|
|
|
||||||
|
|
@ -314,7 +314,7 @@ var (
|
||||||
Usage: "Record information useful for VM and contract debugging",
|
Usage: "Record information useful for VM and contract debugging",
|
||||||
}
|
}
|
||||||
// Logging and debug settings
|
// Logging and debug settings
|
||||||
EthStatsURLFlag = cli.StringFlag{
|
BrnStatsURLFlag = cli.StringFlag{
|
||||||
Name: "brnstats",
|
Name: "brnstats",
|
||||||
Usage: "Reporting URL of a brnstats service (nodename:secret@host:port)",
|
Usage: "Reporting URL of a brnstats service (nodename:secret@host:port)",
|
||||||
}
|
}
|
||||||
|
|
@ -1028,9 +1028,9 @@ func RegisterShhService(stack *node.Node, cfg *whisper.Config) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// RegisterEthStatsService configures the Burnout Stats daemon and adds it to
|
// RegisterBrnStatsService configures the Burnout Stats daemon and adds it to
|
||||||
// th egiven node.
|
// th egiven node.
|
||||||
func RegisterEthStatsService(stack *node.Node, url string) {
|
func RegisterBrnStatsService(stack *node.Node, url string) {
|
||||||
if err := stack.Register(func(ctx *node.ServiceContext) (node.Service, error) {
|
if err := stack.Register(func(ctx *node.ServiceContext) (node.Service, error) {
|
||||||
// Retrieve both brn and les services
|
// Retrieve both brn and les services
|
||||||
var ethServ *brn.Burnout
|
var ethServ *brn.Burnout
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue