devopstools

command module
v0.73.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 14, 2023 License: MIT Imports: 22 Imported by: 0

README

devopstools

Scripts used by DevOps team at Vega

This repository contains shared packages imported and used by scripts in other repositories.

Setup

Create secret.txt in root directory of this repo, and put your GitHub token inside. (the scope of the token does not matter).

Reason: some of the commands require secrets (vega or eth wallets, or node secrets). Those are read automatically from HashiCorp Vault. We use GitHub authentication for HashiCorp Vault.

DevOps goals

We want to minimise usage of bash and replace it with Golang.

We assume that:

  • we have Go installed on every machine
  • we run our scripts go run main.go ... fashion, ineased of: tag version->complie->publish->download->run
  • we use cobra to manage all CLI aspects
Usual use-case

In a repo we create scripts directory, where we put DevOps Go scripts.

Example:

# Script to download latest checkpoint
go run scripts/main.go checkpoint download-latest --network fairground

The logic of that specific script is kept in scripts/cmd/checkpoint.go in that repository (or similar structure). Shared functionality used by that script (like list of nodes, ssh to machine or download file) is imported from devopstools repo (i.e. here).

Useful commands

Some useful commands not connected to any particular repo, are kept here.

Execute command on every node
go run main.go \
    ops pssh \
    --ssh-user fryderyk \
    --ssh-private-keyfile ~/.ssh/id_ed25519 \
    --network devnet1 \
    --command "pwd"
Vega Network statistics
# all stats
go run main.go live statistics --network devnet1
# version only
go run main.go live statistics --network devnet1 --version
# block only
go run main.go live statistics --network devnet1 --block
# from all nodes
go run main.go live statistics --network devnet1 --all
Vega Network - list of nodes
# list all healthy nodes
go run main.go live nodename --network fairground
# list all nodes
go run main.go live nodename --network devnet1 --all
# get one random healthy node
go run main.go live nodename --network devnet1 --random

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL