Skip to content

Commit

Permalink
detect network and avalanchego version
Browse files Browse the repository at this point in the history
  • Loading branch information
arturrez committed Jul 30, 2024
1 parent 21acc05 commit f77bbc3
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 15 deletions.
11 changes: 10 additions & 1 deletion examples/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ func CreateNodes() {
// Avalanche-CLI dependency by Avalanche nodes will be deprecated in the next release
// of Avalanche Tooling SDK
const (
avalancheGoVersion = "v1.11.8"
avalancheGoVersion = "v1.11.8"
subnetIDsToValidate = []string{"xxxxxxxxxxxxxxxxxxxyyyyyyyyyyyyyyyzzzzzzzzzzzzzzz"}
)

// Create two new Avalanche Validator nodes on Fuji Network on AWS without Elastic IPs
Expand Down Expand Up @@ -102,6 +103,14 @@ func CreateNodes() {
}
}

// examle of how to reconfigure the created nodes to track a subnet
for _, h := range hosts {
fmt.Println("Reconfiguring node %s to track subnet %s", h.NodeID, subnetIDsToValidate)
if err := h.TrackSubnet(subnetIDsToValidate); err != nil {
panic(err)
}
}

// Create a monitoring node.
// Monitoring node enables you to have a centralized Grafana Dashboard where you can view
// metrics relevant to any Validator & API nodes that the monitoring node is linked to as well
Expand Down
14 changes: 0 additions & 14 deletions node/dockerConfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
package node

import (
"encoding/json"
"os"

"github.com/ava-labs/avalanche-tooling-sdk-go/constants"
Expand Down Expand Up @@ -53,19 +52,6 @@ func (h *Node) RunSSHRenderAvalancheNodeConfig(networkID string, trackSubnets []
return nil
}

func (h *Node) GetAvalancheGoConfigData() (map[string]interface{}, error) {
// get remote node.json file
nodeJSON, err := h.ReadFileBytes(remoteconfig.GetRemoteAvalancheNodeConfig(), constants.SSHFileOpsTimeout)
if err != nil {
return nil, err
}
var avagoConfig map[string]interface{}
if err := json.Unmarshal(nodeJSON, &avagoConfig); err != nil {
return nil, err
}
return avagoConfig, nil
}

func prepareGrafanaConfig() (string, string, string, string, error) {
grafanaDataSource, err := remoteconfig.RenderGrafanaLokiDataSourceConfig()
if err != nil {
Expand Down
7 changes: 7 additions & 0 deletions node/dockerSsh.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,13 @@ func (h *Node) WasNodeSetupWithMonitoring() (bool, error) {
return h.HasRemoteComposeService(utils.GetRemoteComposeFile(), constants.ServicePromtail, constants.SSHScriptTimeout)
}

func (h *Node) GetAvalancheGoVersion() (string, error) {

Check failure on line 73 in node/dockerSsh.go

View workflow job for this annotation

GitHub Actions / Lint

method Node.GetAvalancheGoVersion already declared at node/avalanchego.go:16:16

Check failure on line 73 in node/dockerSsh.go

View workflow job for this annotation

GitHub Actions / Lint

method Node.GetAvalancheGoVersion already declared at node/avalanchego.go:16:16
if withAvago, err := h.HasRemoteComposeService(utils.GetRemoteComposeFile(), constants.ServiceAvalanchego, constants.SSHScriptTimeout); err != nil || !withAvago {
return "", err
} else {
}
}

Check failure on line 78 in node/dockerSsh.go

View workflow job for this annotation

GitHub Actions / Lint

missing return) (typecheck)

Check failure on line 78 in node/dockerSsh.go

View workflow job for this annotation

GitHub Actions / Lint

missing return (typecheck)

// ComposeSSHSetupMonitoring sets up monitoring using docker-compose.
func (h *Node) ComposeSSHSetupMonitoring() error {
grafanaConfigFile, grafanaDashboardsFile, grafanaLokiDatasourceFile, grafanaPromDatasourceFile, err := prepareGrafanaConfig()
Expand Down

0 comments on commit f77bbc3

Please sign in to comment.