nodectl

package module
v0.0.0-...-61e8f65 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2022 License: GPL-3.0 Imports: 24 Imported by: 0

README

nodectl

The nodectl is a command-line interface for managing Darknodes on Ren. It is installed on your local workspace, and will automatically create and update machines for you. Currently it supports macOS and Linux.

Installing the tool

To download and install nodectl, open a terminal and run:

curl https://www.github.com/renproject/nodectl/releases/latest/download/install.sh -sSfL | sh

This will download the required binaries and install them to the $HOME/.nodectl directory. Open a new terminal to begin using nodectl.

If you are using a custom shell, you'll need to manually add it to your PATH.

export PATH=$PATH:$HOME/.nodectl/bin

Updating the tool

Before updating nodectl, please make sure you do not have the tool running in any terminal.

To update your nodectl, open a terminal and run:

curl https://www.github.com/renproject/nodectl/releases/latest/download/update.sh -sSfL | sh

This will update your nodectl to the latest version without affecting any of your deployed nodes.

Note: make sure you are using Terraform version > 1.0.0 ! To upgrade Terraform, download the executable for your operating system from https://www.terraform.io/downloads.html and copy it to $HOME/.nodectl/bin/terraform.

Usage

Deploy a Darknode
AWS

To deploy a Darknode on AWS, open a terminal and run:

nodectl up --name my-first-darknode --network testnet --aws --aws-access-key YOUR-AWS-ACCESS-KEY --aws-secret-key YOUR-AWS-SECRET-KEY

The nodectl will automatically use the credentials available at $HOME/.aws/credentials if you do not explicitly set the --access-key and --secret-key arguments. By default, it will use the credentials of default profile.

You can also specify the region and instance type you want to use for the Darknode:

nodectl up --name my-first-darknode --network testnet --aws --aws-access-key YOUR-AWS-ACCESS-KEY --aws-secret-key YOUR-AWS-SECRET-KEY --aws-region eu-west-1 --aws-instance t2.small

The default instance type is t3.micro and region will be random. You can find all available regions and instance types at AWS.

Digital Ocean

You first need to create an API token. To deploy a Darknode on Digital Ocean, open a terminal and run:

nodectl up --name my-first-darknode --network testnet --do --do-token YOUR-API-TOKEN

You can also specify the region and droplet size you want to use for the Darknode:

nodectl up --name my-first-darknode --network testnet --do --do-token YOUR-API-TOKEN --do-region nyc1 --do-droplet s-2vcpu-2gb

The default droplet size is s-1vcpu-1gb and region will be random. Be aware some region and droplet size are not available to all users.

You can find all available regions and droplet size slug by using the digital ocean API.

Destroy a Darknode

WARNING: Before destroying a Darknode make sure you have de-registered it, and withdrawn all fees earned! You will not be able to destroy your darknode if it's not fully deregistered. The CLI will guide you to the page where you can deregister your node

Destroying a Darknode will turn it off and tear down all resources allocated by the cloud provider. To destroy a Darknode, open a terminal and run:

nodectl destroy my-first-darknode

To avoid the command-line prompt confirming the destruction, use the --force argument:

nodectl destroy --force my-first-darknode 

We do not recommend using the --force argument unless you are developing custom tools that manage your Darknodes automatically.

Get Darknode's peer address

To get the Darknode's peer address, open a terminal and run:

nodectl address my-first-darknode 

You can send your Darknode's peer address to others to be included in other Darknode's config files.

List all Darknodes

The nodectl supports deploying multiple Darknodes. To list all available Darknodes, open a terminal and run:

nodectl list
Start/Stop/Restart Darknode

To turn off your darknode, open a terminal and run:

nodectl stop my-first-darknode

Note this won't shut down the cloud instance, so you will still be charged by your cloud provider. If it is already off, stop will do nothing.

To turn on your darknode, open a terminal and run:

nodectl start my-first-darknode

If it is already on, start will do nothing.

To restart your darknode, open a terminal and run:

nodectl restart my-first-darknode
SSH into Darknode

To access your Darknode using SSH, open a terminal and run:

nodectl ssh my-first-darknode

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ActionStart   = "systemctl --user start darknode"
	ActionStop    = "systemctl --user stop darknode"
	ActionRestart = "systemctl --user restart darknode"
)

Commands for different actions to darknodes.

View Source
var (
	NameFlag = &cli.StringFlag{
		Name:  "name",
		Usage: "A unique human-readable `string` for identifying the darknode",
	}
	TagsFlag = &cli.StringFlag{
		Name:  "tags",
		Usage: "Multiple human-readable comma separated `strings` for identifying groups of darknodeS",
	}
	ConfigFlag = &cli.StringFlag{
		Name:  "config",
		Usage: "Config file for your darknode",
	}
	SnapshotFlag = &cli.StringFlag{
		Name:  "snapshot",
		Usage: "Snapshot of the darknode to recover",
	}
	NetworkFlag = &cli.StringFlag{
		Name:        "network",
		Value:       "mainnet",
		Usage:       "Network of RenVM you want to join",
		DefaultText: "mainnet",
	}
	VersionFlag = &cli.StringFlag{
		Name:  "version",
		Usage: "Version of darknode you want to upgrade to",
	}
	DowngradeFlag = &cli.BoolFlag{
		Name:  "downgrade",
		Usage: "Force downgrading to an older version without interactive prompts",
	}
	ForceFlag = &cli.BoolFlag{
		Name:    "force",
		Aliases: []string{"f"},
		Usage:   "Force destruction without interactive prompts",
	}
	VerboseFlag = &cli.BoolFlag{
		Name:    "verbose",
		Aliases: []string{"v"},
		Usage:   "Show additional details of darknodes",
	}
	DependencyFlag = &cli.BoolFlag{
		Name:  "dep",
		Usage: "Update the dependency for your darknode",
	}
	ConfigUpdateFlag = &cli.BoolFlag{
		Name:  "config",
		Usage: "Update the config file for your darknodes",
	}
)

General flags

View Source
var (
	AwsFlag = &cli.BoolFlag{
		Name:  provider.NameAws,
		Usage: "AWS will be used to provision the darknode",
	}
	AwsAccessKeyFlag = &cli.StringFlag{
		Name:    "aws-access-key",
		Aliases: []string{"access-key", "ak"},
		Usage:   "AWS access `key` for programmatic access",
	}
	AwsSecretKeyFlag = &cli.StringFlag{
		Name:    "aws-secret-key",
		Aliases: []string{"secret-key", "sk"},
		Usage:   "AWS secret `key` for programmatic access",
	}
	AwsRegionFlag = &cli.StringFlag{
		Name:        "aws-region",
		Usage:       "An optional AWS region",
		DefaultText: "random",
	}
	AwsInstanceFlag = &cli.StringFlag{
		Name:        "aws-instance",
		Value:       provider.DefaultAWSInstance,
		Usage:       "An optional AWS EC2 instance type",
		DefaultText: provider.DefaultAWSInstance,
	}
	AwsProfileFlag = &cli.StringFlag{
		Name:  "aws-profile",
		Value: "default",
		Usage: "Name of the profile containing the credentials",
	}
)

AWS flags

View Source
var (
	DoFlag = &cli.BoolFlag{
		Name:  provider.NameDo,
		Usage: "Digital Ocean will be used to provision the darknode",
	}
	DoTokenFlag = &cli.StringFlag{
		Name:  "do-token",
		Usage: "Digital Ocean API token for programmatic access",
	}
	DoRegionFlag = &cli.StringFlag{
		Name:        "do-region",
		Usage:       "An optional Digital Ocean region",
		DefaultText: "random",
	}
	DoSizeFlag = &cli.StringFlag{
		Name:        "do-droplet",
		Value:       provider.DefaultDigitalOceanDroplet,
		Usage:       "An optional Digital Ocean droplet size",
		DefaultText: "Basic 1CPU/1G/25G",
	}
)

Digital ocean flags

View Source
var (
	GcpFlag = &cli.BoolFlag{
		Name:  provider.NameGcp,
		Usage: "Google Cloud Platform will be used to provision the darknode",
	}
	GcpCredFlag = &cli.StringFlag{
		Name:  "gcp-credentials",
		Usage: "Path of the Service Account credential file (JSON) to be used",
	}
	GcpMachineFlag = &cli.StringFlag{
		Name:        "gcp-machine",
		Value:       "n1-standard-1",
		Usage:       "An optional Google Cloud machine type",
		DefaultText: "n1-standard-1",
	}
	GcpRegionFlag = &cli.StringFlag{
		Name:        "gcp-region",
		Usage:       "An optional Google Cloud Region",
		DefaultText: "random",
	}
)

Google cloud platform flags

View Source
var (
	BucketRegion = "ap-southeast-1"

	BucketName = "darknode.renproject.io"
)

Functions

func App

func App() *cli.App

App creates a new cli application.

func RecoverDarknode

func RecoverDarknode(ctx *cli.Context) error

func UpdateDarknode

func UpdateDarknode(ctx *cli.Context) error

func Upload

func Upload(ctx *cli.Context) error

Types

type NodeInfo

type NodeInfo struct {
	Name     string
	IP       string
	EthAddr  string
	Provider string
	Tags     string
}

func GetNodeInfo

func GetNodeInfo(name string) (NodeInfo, error)

func (NodeInfo) String

func (info NodeInfo) String() string

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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