config

package
v0.68.0-prev1 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2023 License: MIT Imports: 10 Imported by: 1

Documentation

Index

Constants

View Source
const (
	RunConfigFileName  = "run-config.toml"
	VegaBinaryName     = "vega"
	DataNodeBinaryName = "data-node"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Asset added in v0.68.0

type Asset struct {
	// description: Name of the asset on Github.
	AssetName string `toml:"assset_name"`
	/*
		description: |
			Binary name definition can be used if the asset is a zip file and the binary is included inside of it.
	*/
	BinaryName *string `toml:"binary_name"`
}

func (Asset) GetBinaryPath added in v0.68.0

func (a Asset) GetBinaryPath() string

type AssetsConfig

type AssetsConfig struct {
	/*
		description: Allows you to define the name of the asset to be downloaded.
	*/
	Vega Asset `toml:"vega"`
	/*
		description: Allows you to define the name of the asset to be downloaded.
	*/
	DataNode *Asset `toml:"data_node"`
}

func (AssetsConfig) AssetsNames added in v0.68.0

func (ac AssetsConfig) AssetsNames() []string

type AutoInstallConfig

type AutoInstallConfig struct {
	/*
		description: Whether or not autoinstall should be used
		default: true
	*/
	Enabled bool `toml:"enabled"`
	/*
		description: Owner of the repository from where the assets should be downloaded.
		default: vegaprotocol
	*/
	GithubRepositoryOwner string `toml:"repositoryOwner"`
	/*
		description: Name of the repository from where the assets should be downloaded.
		default: vega
	*/
	GithubRepository string `toml:"repository"`
	/*
		description: Definitions of the assets that should be downloaded from the GitHub repository.
		example:
			type: toml
			value: |
				[autoInstall.assets]
					[autoInstall.assets.vega]
						assset_name = "vega-darwin-amd64.zip"
						binary_name = "vega"
	*/
	Assets AssetsConfig `toml:"assets"`
}

description: Allows you to define the assets that should be automatically downloaded from GitHub for a specific release.

example:

type: toml
value: |
	[autoInstall]
		enabled = true
		repositoryOwner = "vegaprotocol"
		repository = "vega"
		[autoInstall.assets]
			[autoInstall.assets.vega]
				assset_name = "vega-darwin-amd64.zip"
				binary_name = "vega"

type BinaryConfig

type BinaryConfig struct {
	/*
		description: Path to the binary.
		note: |
			The absolute or relative path can be used.
			Relative path is relative to a parent folder of this config file.
	*/
	Path string `toml:"path"`
	/*
		description: Arguments that will be applied to the binary.
		note: |
			Each element the list represents one space separated argument.
	*/
	Args []string `toml:"args"`
}

description: Allows you to configure a binary and its arguments. example:

type: toml
value: |
	path = "/path/binary"
	args = ["--arg1", "val1", "--arg2"]

type DataNodeConfig

type DataNodeConfig struct {
	Binary BinaryConfig `toml:"binary"`
}

description: Allows you to configure a data node binary and its arguments. example:

type: toml
value: |
	[data_node]
		[data_node.binary]
			path = "/path/data-node-binary"
			args = ["--arg1", "val1", "--arg2"]

type RPCConfig

type RPCConfig struct {
	/*
		description: Path of the mounted socket.
		note: This path can be configured in Vega core node configuration.
	*/
	SocketPath string `toml:"socketPath"`
	/*
		description: HTTP path of the socket path.
		note: This path can be configured in Vega core node configuration.
	*/
	HTTPPath string `toml:"httpPath"`
}

description: Allows you to configure a connection to a core node's exposed UNIX socket RPC API. example:

type: toml
value: |
	[vega.rpc]
		socketPath = "/path/socket.sock"
		httpPath = "/rpc"

type RunConfig

type RunConfig struct {
	/*
		description: Name of the upgrade.
		note: It is recommended that you use the upgrade version as the name.
	*/
	Name string `toml:"name"`
	// description: Configuration of a Vega node.
	Vega VegaConfig `toml:"vega"`
	// description: Configuration of a data node.
	DataNode *DataNodeConfig `toml:"data_node"`
}

description: Root of the config file example:

type: toml
value: |
	name = "v1.65.0"

	[vega]
		[vega.binary]
			path = "/path/vega-binary"
			args = ["--arg1", "val1", "--arg2"]
		[vega.rpc]
			socketPath = "/path/socket.sock"
			httpPath = "/rpc"

func ExampleRunConfig

func ExampleRunConfig(name string, withDataNode bool) *RunConfig

func ParseRunConfig

func ParseRunConfig(path string) (*RunConfig, error)

func (*RunConfig) WriteToFile

func (rc *RunConfig) WriteToFile(path string) error

type VegaConfig

type VegaConfig struct {
	/*
		description: Configuration of Vega binary to be run.
		example:
			type: toml
			value: |
				[vega.binary]
					path = "/path/vega-binary"
					args = ["--arg1", "val1", "--arg2"]
	*/
	Binary BinaryConfig `toml:"binary"`

	/*
		description: |
			Visor communicates with the core node via RPC API that runs over UNIX socket.
			This parameter allows you to configure the UNIX socket to match the core node configuration.
		example:
			type: toml
			value: |
				[vega.binary]
					path = "/path/vega-binary"
					args = ["--arg1", "val1", "--arg2"]
	*/
	RCP RPCConfig `toml:"rpc"`
}

description: Allows you to configure the Vega binary and its arguments. example:

type: toml
value: |
	[vega]
		[vega.binary]
			path = "/path/vega-binary"
			args = ["--arg1", "val1", "--arg2"]
		[vega.rpc]
			socketPath = "/path/socket.sock"
			httpPath = "/rpc"

type VisorConfig

type VisorConfig struct {
	// contains filtered or unexported fields
}

func DefaultVisorConfig

func DefaultVisorConfig(log *logging.Logger, homePath string) *VisorConfig

func NewVisorConfig

func NewVisorConfig(log *logging.Logger, homePath string) (*VisorConfig, error)

func (*VisorConfig) AutoInstall

func (pc *VisorConfig) AutoInstall() AutoInstallConfig

func (*VisorConfig) CurrentFolder

func (pc *VisorConfig) CurrentFolder() string

func (*VisorConfig) CurrentRunConfigPath

func (pc *VisorConfig) CurrentRunConfigPath() string

func (*VisorConfig) GenesisFolder

func (pc *VisorConfig) GenesisFolder() string

func (*VisorConfig) MaxNumberOfFirstConnectionRetries added in v0.62.0

func (pc *VisorConfig) MaxNumberOfFirstConnectionRetries() int

func (*VisorConfig) MaxNumberOfRestarts

func (pc *VisorConfig) MaxNumberOfRestarts() int

func (*VisorConfig) RestartsDelaySeconds

func (pc *VisorConfig) RestartsDelaySeconds() int

func (*VisorConfig) StopSignalTimeoutSeconds

func (pc *VisorConfig) StopSignalTimeoutSeconds() int

func (*VisorConfig) UpgradeFolder

func (pc *VisorConfig) UpgradeFolder(releaseTag string) string

func (*VisorConfig) WatchForUpdate

func (pc *VisorConfig) WatchForUpdate(ctx context.Context) error

func (*VisorConfig) WriteToFile

func (pc *VisorConfig) WriteToFile() error

type VisorConfigFile

type VisorConfigFile struct {
	/*
		description: |
			Visor communicates with the core node via RPC API.
			This variable allows a validator to specify how many times Visor should try to establish a connection to the core node before the Visor process fails.
			The `maxNumberOfFirstConnectionRetries` is only taken into account during the first start up of the Core node process - not restarts.
		note: |
			There is a 2 second delay between each attempt. Setting the max retry number to 5 means Visor will try to establish a connection 5 times in 10 seconds.
		default: 10
	*/
	MaxNumberOfFirstConnectionRetries int `toml:"maxNumberOfFirstConnectionRetries,optional"`
	/*
		description: |
			Visor starts and manages the processes of provided binaries.
			This allows a user to define the maximum number of restarts in case any of
			the processes have failed before the Visor process fails.
		note: |
			The amount of time Visor waits between restarts can be set by `restartsDelaySeconds`.
		default: 3
	*/
	MaxNumberOfRestarts int `toml:"maxNumberOfRestarts,optional"`
	/*
		description: |
			Number of seconds that Visor waits before it tries to re-start the processes.
		default: 5
	*/
	RestartsDelaySeconds int `toml:"restartsDelaySeconds,optional"`
	/*
		description: |
			Number of seconds that Visor waits after it sends termination signal (SIGTERM) to running processes.
			After the time has elapsed Visor force-kills (SIGKILL) any running processes.
		default: 15
	*/
	StopSignalTimeoutSeconds int `toml:"stopSignalTimeoutSeconds,optional"`

	/*
		description: |
			During the upgrade, by default Visor looks for a folder with a name identical to the upgrade version.
			The default behaviour can be changed by providing mapping between `version` and `custom_folder_name`.
			If a custom mapping is provided, during the upgrade Visor uses the folder given in the mapping for specific version.

		example:
			type: toml
			value: |
				[upgradeFolders]
					"v99.9.9" = "custom_upgrade_folder_name"
	*/
	UpgradeFolders map[string]string `toml:"upgradeFolders,optional"`

	/*
		description: |
			Allows you to define the assets that should be automatically downloaded from Github for a specific release.

		example:
			type: toml
			value: |
				[autoInstall]
					enabled = true
					repositoryOwner = "vegaprotocol"
					repository = "vega"
					[autoInstall.assets]
						[autoInstall.assets.vega]
							assset_name = "vega-darwin-amd64.zip"
							binary_name = "vega"

	*/
	AutoInstall AutoInstallConfig `toml:"autoInstall"`
}

description: Root of the config file example:

type: toml
value: |
	maxNumberOfRestarts = 3
	restartsDelaySeconds = 5

	[upgradeFolders]
		"vX.X.X" = "vX.X.X"

	[autoInstall]
		enabled = false

Jump to

Keyboard shortcuts

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