Documentation ¶
Index ¶
- Constants
- func DefaultNetworkHome() (string, error)
- func ParseHCLFile(filePath string) (*hcl.File, error)
- func TemplateStruct(v reflect.Value, templateFunc func(templateRaw string) (*bytes.Buffer, error)) error
- type ClefConfig
- type Config
- func (c Config) BinariesDir() string
- func (c Config) GetSmartContractToken(name string) *types.SmartContractsToken
- func (c *Config) GetVegaBinary() string
- func (c *Config) GetWalletVegaBinary() *string
- func (c Config) LoadConfigTemplateFile(path string) (string, error)
- func (c Config) LogsDir() string
- func (c *Config) Persist() error
- func (c Config) PrimarySmartContractsInfo() (*types.SmartContractsInfo, error)
- func (c Config) SecondarySmartContractsInfo() (*types.SmartContractsInfo, error)
- func (c *Config) SetBinaryPaths(bins installer.InstalledBins)
- func (c *Config) Validate(configDir string) error
- type ConfigTemplates
- type DockerConfig
- type EthereumConfig
- type ExecConfig
- type FaucetConfig
- type NetworkConfig
- type NodeConfig
- type NodeConfigTemplateContext
- type NomadConfig
- type PStartConfig
- type PreGenerate
- type Resources
- type StaticPort
- type WalletConfig
Constants ¶
View Source
const ( WalletSubCmd = "wallet" DataNodeSubCmd = "datanode" FaucetSubCmd = "faucet" )
Variables ¶
This section is empty.
Functions ¶
func DefaultNetworkHome ¶
func ParseHCLFile ¶ added in v0.3.0
Types ¶
type ClefConfig ¶ added in v0.2.0
type ClefConfig struct { /* description: | List of Clef pre-generated Ethereum addresses that can be used by node set. note: | There should be enough available addresses for each node set. So when node set has `count = 2` there has to be minimum 2 addresses defined similarly when `count = 4` there has to be minimum 4 addresses defined etc. example: type: hcl value: | ethereum_account_addresses = ["0xc0ffee254729296a45a3885639AC7E10F9d54979", "0x999999cf1046e68e36E1aA2E0E07105eDDD1f08E"] */ AccountAddresses []string `hcl:"ethereum_account_addresses" template:""` /* description: Address of running Clef instance example: type: hcl value: | clef_rpc_address = "http://localhost:8555" */ ClefRPCAddr string `hcl:"clef_rpc_address" template:""` }
description: |
Allows to configure connetion to [Clef](https://geth.ethereum.org/docs/clef/introduction) Ethereum wallet.
example:
type: hcl value: | clef_wallet { ethereum_account_addresses = ["0xc0ffee254729296a45a3885639AC7E10F9d54979", "0x999999cf1046e68e36E1aA2E0E07105eDDD1f08E"] clef_rpc_address = "http://localhost:8555" }
type Config ¶
type Config struct { // description: Configuration of Vega network and its dependencies. Network NetworkConfig `hcl:"network,block"` /* description: | Directory path (relative or absolute) where Capsule stores generated folders, files, logs and configurations for network. default: ~/.vegacapsule/testnet */ OutputDir *string `hcl:"output_dir"` // description: Path (relative or absolute) to vega binary that will be used to generate and run the network. // default: vega VegaBinary *string `hcl:"vega_binary_path"` /* description: | Path (relative or absolute) of a Capsule binary. The Capsule binary is used to aggregate logs from running jobs and save them to local disk in Capsule home directory. See `vegacapsule nomad logscollector` for more info. default: Currently running Capsule instance binary note: This optional parameter is used internally. There should never be any need to set it to anything other than default. */ VegaCapsuleBinary *string `hcl:"vega_capsule_binary_path,optional"` // Non configurable section - internal variables NodeDirPrefix string TendermintNodePrefix string VegaNodePrefix string DataNodePrefix string WalletPrefix string FaucetPrefix string VisorPrefix string HCLBodyRaw []byte // contains filtered or unexported fields }
name: Root description: |
All parameters from this types are used directly in the config file. Most of the parameters here are optional and can be left alone. Please see the example below.
example:
type: hcl value: | vega_binary_path = "/path/to/vega" network "your_network_name" { ... }
func ApplyConfigContext ¶ added in v0.3.0
func ApplyConfigContext(conf *Config, genServices *types.GeneratedServices) (*Config, error)
func DefaultConfig ¶
func ParseConfigFile ¶
func ParseConfigFile(filePath, outputDir string, genServices types.GeneratedServices) (*Config, error)
func (Config) BinariesDir ¶ added in v0.2.3
func (Config) GetSmartContractToken ¶ added in v0.3.0
func (c Config) GetSmartContractToken(name string) *types.SmartContractsToken
func (*Config) GetVegaBinary ¶ added in v0.2.3
func (*Config) GetWalletVegaBinary ¶ added in v0.3.0
func (Config) LoadConfigTemplateFile ¶ added in v0.2.3
func (Config) PrimarySmartContractsInfo ¶ added in v0.76.8
func (c Config) PrimarySmartContractsInfo() (*types.SmartContractsInfo, error)
func (Config) SecondarySmartContractsInfo ¶ added in v0.76.8
func (c Config) SecondarySmartContractsInfo() (*types.SmartContractsInfo, error)
func (*Config) SetBinaryPaths ¶ added in v0.2.3
func (c *Config) SetBinaryPaths(bins installer.InstalledBins)
type ConfigTemplates ¶
type ConfigTemplates struct { /* description: | [Go template](templates.md) of Vega config. The [vega.ConfigTemplateContext](templates.md#vegaconfigtemplatecontext) can be used in the template. Example [example](net_confs/node_set_templates/default/vega_validators.tmpl). optional_if: vega_file note: | It is recommended that you use `vega_file` param instead. If both `vega` and `vega_file` are defined, then `vega` overrides `vega_file`. examples: - type: hcl value: | vega = <<EOH ... EOH */ Vega *string `hcl:"vega,optional"` /* description: | Same as `vega` but it allows the user to link the Vega config template as an external file. examples: - type: hcl value: | vega_file = "/your_path/vega_config.tmpl" */ VegaFile *string `hcl:"vega_file,optional"` /* description: | [Go template](templates.md) of Tendermint config. The [tendermint.ConfigTemplateContext](templates.md#tendermintconfigtemplatecontext) can be used in the template. Example [example](net_confs/node_set_templates/default/tendermint_validators.tmpl). optional_if: tendermint_file note: | It is recommended that you use `tendermint_file` param instead. If both `tendermint` and `tendermint_file` are defined, then `tendermint` overrides `tendermint_file`. examples: - type: hcl value: | tendermint = <<EOH ... EOH */ Tendermint *string `hcl:"tendermint,optional"` /* description: | Same as `tendermint` but it allows the user to link the Tendermint config template as an external file. examples: - type: hcl value: | tendermint_file = "/your_path/tendermint_config.tmpl" */ TendermintFile *string `hcl:"tendermint_file,optional"` /* description: | [Go template](templates.md) of Data Node config. The [datanode.ConfigTemplateContext](templates.md#datanodeconfigtemplatecontext) can be used in the template. Example [example](net_confs/node_set_templates/default/data_node_full_external_postgres.tmpl). optional_if: data_node_file note: | It is recommended that you use `data_node_file` param instead. If both `data_node` and `data_node_file` are defined, then `data_node` overrides `data_node_file`. example: type: hcl value: | data_node = <<EOH ... EOH */ DataNode *string `hcl:"data_node,optional"` /* description: | Same as `data_node` but it allows the user to link the Data Node config template as an external file. example: type: hcl value: | data_node_file = "/your_path/data_node_config.tmpl" */ DataNodeFile *string `hcl:"data_node_file,optional"` /* description: | [Go template](templates.md) of Visor genesis run config. The [visor.ConfigTemplateContext](templates.md#visorconfigtemplatecontext) can be used in the template. Example [example](net_confs/node_set_templates/default/visor_run.tmpl). Current Vega binary is automatically copied to the Visor genesis folder by Capsule so it can be used from this template. optional_if: visor_run_conf_file note: | It is recommended that you use `visor_run_conf_file` param instead. If both `visor_run_conf` and `visor_run_conf_file` are defined, then `visor_run_conf` overrides `visor_run_conf_file`. example: type: hcl value: | visor_run_conf = <<EOH ... EOH */ VisorRunConf *string `hcl:"visor_run_conf,optional"` /* description: | Same as `visor_run_conf` but it allows the user to link the Visor genesis run config template as an external file. example: type: hcl value: | visor_run_conf_file = "/your_path/visor_run_config.tmpl" */ VisorRunConfFile *string `hcl:"visor_run_conf_file,optional"` /* description: | [Go template](templates.md) of Visor config. The [visor.ConfigTemplateContext](templates.md#visorconfigtemplatecontext) can be used in the template. Example [example](net_confs/node_set_templates/default/visor_config.tmpl). optional_if: visor_conf_file note: | It is recommended that you use `visor_conf_file` param instead. If both `visor_conf` and `visor_conf_file` are defined, then `visor_conf` overrides `visor_conf_file`. example: type: hcl value: | visor_conf = <<EOH ... EOH */ VisorConf *string `hcl:"visor_conf,optional"` /* description: | Same as `visor_conf` but it allows the user to link the Visor genesis run config template as an external file. example: type: hcl value: | visor_conf_file = "/your_path/visor_config.tmpl" */ VisorConfFile *string `hcl:"visor_conf_file,optional"` }
description: |
Allow to add configuration template for certain services deployed by Capsule. Learn more about how configuration templating work here
type DockerConfig ¶
type DockerConfig struct { /* description: Name of the service that is going to be used as an identifier when service runs. example: type: hcl value: | docker_service "service-name" { ... } */ Name string `hcl:"name,label"` /* description: Name of publicly available Docker image. example: type: hcl value: | image = "vegaprotocol/ganache:latest" */ Image string `hcl:"image"` /* description: Command that will run at the image startup. example: type: hcl value: | cmd = "ganache-cli" */ Command string `hcl:"cmd,optional"` /* description: List of arguments that will be added to cmd. example: type: hcl value: | args = [ "--blockTime", "1", "--chainId", "1440", ] */ Args []string `hcl:"args"` /* description: Allows the user to set environment varibles for the container. example: type: hcl value: | env = { ENV_VAR="value" ENV_VAR_2="value-2" } */ Env map[string]string `hcl:"env,optional"` /* description: Allows the user to open a static port from container to host. example: type: hcl value: | static_port { value = 5232 to = 5432 } */ StaticPort *StaticPort `hcl:"static_port,block"` /* description: Defines whether or not the task fails on an authentication failure. note: Should be always `true` for public images. example: type: hcl value: | auth_soft_fail = true */ AuthSoftFail bool `hcl:"auth_soft_fail,optional"` /* description: Allows the user to define the minimum required hardware resources for the container. Note: In most cases the default values (not defined) should be sufficient. example: type: hcl value: | resources { cpu = 100 memory = 100 memory_max = 300 } */ Resources *Resources `hcl:"resources,block"` VolumeMounts []string `hcl:"volume_mounts,optional"` }
description: |
Allows the user to configure Docker container services that will run before or after the Vega network starts.
example:
type: hcl value: | docker_service "ganache-1" { image = "vegaprotocol/ganache:latest" cmd = "ganache-cli" args = [ "--blockTime", "1", "--chainId", "1440", "--networkId", "1441", "-h", "0.0.0.0", ] static_port { value = 8545 to = 8545 } auth_soft_fail = true }
type EthereumConfig ¶
type EthereumConfig struct { ChainID string `hcl:"chain_id"` NetworkID string `hcl:"network_id"` Endpoint string `hcl:"endpoint"` }
description: |
Allows the user to define the specific Ethereum network to be used. It can either be one of the [public networks](https://ethereum.org/en/developers/docs/networks/#public-networks) or a local instance of Ganache.
note: |
The chosen network needs to have deployed [Ethereum bridges](https://docs.vega.xyz/mainnet/api/bridge) on it that match the Ethereum network.
example:
type: hcl name: Setup for local Ganache value: | ethereum { chain_id = "1440" network_id = "1441" endpoint = "http://127.0.0.1:8545/" }
type ExecConfig ¶ added in v0.5.0
type ExecConfig struct { /* description: Name of the service that is going to be used as an identifier when service runs. example: type: hcl value: | docker_service "service-name" { ... } */ Name string `hcl:"name,label"` /* description: Command that will run example: type: hcl value: | cmd = "ganache-cli" */ Command string `hcl:"cmd,optional"` /* description: List of arguments that will be added to cmd. example: type: hcl value: | args = [ "--blockTime", "1", "--chainId", "1440", ] */ Args []string `hcl:"args"` /* description: Allows the user to set environment variables launched process. example: type: hcl value: | env = { ENV_VAR="value" ENV_VAR_2="value-2" } */ Env map[string]string `hcl:"env,optional"` }
type FaucetConfig ¶
type FaucetConfig struct { /* description: Name of the faucet. It will be used as an identifier when the faucet runs. example: type: hcl value: | wallet "wallet-name" { ... } */ Name string `hcl:"name,label"` /* description: Passphrase for the wallet. example: type: hcl value: wallet_pass = "passphrase" */ Pass string `hcl:"wallet_pass"` /* description: | [Go template](templates.md) of a Vega Faucet config. The [faucet.ConfigTemplateContext](templates.md#faucetconfigtemplatecontext) can be used in the template. Example can be found in [default network config](net_confs/config.hcl). examples: - type: hcl value: | template = <<EOH ... EOH */ Template string `hcl:"template,optional"` }
description: |
Represents a configuration of a Vega Faucet service.
example:
type: hcl value: | faucet "faucet-1" { { wallet_pass = "wallet_pass" template = <<-EOT ... EOT }
type NetworkConfig ¶
type NetworkConfig struct { /* description: | Name of the network. All folders generated are placed in the folder with this name. All Nomad jobs are prefixed with this name. example: type: hcl value: | network "name" { ... } */ Name string `hcl:"name,label"` /* description: | [Go template](templates.md) of the genesis file that will be used to bootrap the Vega network. [Example of templated mainnet genesis file](https://github.com/vegaprotocol/networks/blob/master/mainnet1/genesis.json). The [GenesisTemplateContext](templates.md#genesistemplatecontext) can be used in the template. Example [example](net_confs/genesis.tmpl). optional_if: genesis_template_file note: | It is recommended that you use `genesis_template_file` param instead. If both `genesis_template` and `genesis_template_file` are defined, then `genesis_template` overrides `genesis_template_file`. examples: - type: hcl value: | genesis_template = <<EOH { "app_state": { ... } .. } EOH */ GenesisTemplate *string `hcl:"genesis_template"` /* description: | Same as `genesis_template` but it allows the user to link the genesis file template as an external file. examples: - type: hcl value: | genesis_template_file = "/your_path/genesis.tmpl" */ GenesisTemplateFile *string `hcl:"genesis_template_file"` /* description: | Same as `genesis_template` but it allows the user to download a template file from the URL examples: - type: hcl value: | genesis_template_url = "https://example.com/genesis.json.tmpl" */ GenesisTemplateURL *string `hcl:"genesis_template_url"` /* description: | Allows the user to define the applicable primary Ethereum network configuration. This is necessary because the Vega network needs to be connected to [Ethereum bridges](https://docs.vega.xyz/mainnet/api/bridge) or it cannot function. examples: - type: hcl value: | ethereum { ... } */ Ethereum EthereumConfig `hcl:"ethereum,block"` /* description: | Allows the user to define the applicable secondary Ethereum network configuration. This is necessary because the Vega network needs to be connected to [Ethereum bridges](https://docs.vega.xyz/mainnet/api/bridge) or it cannot function. examples: - type: hcl value: | secondary_ethereum { ... } */ SecondaryEthereum EthereumConfig `hcl:"secondary_ethereum,block"` /* description: | Smart contract addresses are addresses of primary [Ethereum bridge](https://docs.vega.xyz/mainnet/api/bridge) contracts in JSON format. These addresses need to correspond to the chosen network in the primary [Ethereum network](#EthereumConfig) and can be used in various types of templates in Capsule. [Example of smart contract address from mainnet](https://github.com/vegaprotocol/networks/blob/master/mainnet1/smart-contracts.json). note: | It is recommended that you use the `smart_contracts_addresses_file` param instead. If both `smart_contracts_addresses` and `smart_contracts_addresses_file` are defined, then `genesis_template` overrides `smart_contracts_addresses_file`. optional_if: smart_contracts_addresses_file examples: - type: hcl value: | smart_contracts_addresses = <<EOH { "erc20_bridge": "...", "staking_bridge": "...", ... } EOH */ SmartContractsAddresses *string `hcl:"smart_contracts_addresses,optional"` /* description: | Same as `smart_contracts_addresses` but it allows you to link the smart contracts as an external file. examples: - type: hcl value: | smart_contracts_addresses_file = "/your_path/smart-contracts.json" */ SmartContractsAddressesFile *string `hcl:"smart_contracts_addresses_file,optional"` /* description: | Smart contract addresses are addresses of secondary [Ethereum bridge](https://docs.vega.xyz/mainnet/api/bridge) contracts in JSON format. These addresses need to correspond to the chosen network in the secondary [Ethereum network](#EthereumConfig) and can be used in various types of templates in Capsule. [Example of smart contract address from mainnet](https://github.com/vegaprotocol/networks/blob/master/mainnet1/smart-contracts.json). note: | It is recommended that you use the `secondary_smart_contracts_addresses_file` param instead. If both `secondary_smart_contracts_addresses` and `secondary_smart_contracts_addresses_file` are defined, then `genesis_template` overrides `secondary_smart_contracts_addresses_file`. optional_if: secondary_smart_contracts_addresses_file examples: - type: hcl value: | secondary_smart_contracts_addresses = <<EOH { "erc20_bridge": "0x...", "asset_pool": "0x...", "multisig": "0x..." } EOH */ SecondarySmartContractsAddresses *string `hcl:"secondary_smart_contracts_addresses,optional"` /* description: | Same as `secondary_smart_contracts_addresses` but it allows you to link the smart contracts as an external file. examples: - type: hcl value: | secondary_smart_contracts_addresses_file = "/your_path/secondary_smart-contracts.json" */ SecondarySmartContractsAddressesFile *string `hcl:"secondary_smart_contracts_addresses_file,optional"` /* description: | Allows a user to define multiple node sets and their specific configurations. A node set is a representation of Vega and Data Node nodes. The node set is the essential building block of the Vega network. examples: - type: hcl name: Validators node set value: | node_set "validator-nodes" { ... } - type: hcl name: Full nodes node set value: | node_set "full-nodes" { ... } */ Nodes []NodeConfig `hcl:"node_set,block" cty:"node_set"` /* description: | Allows for deploying and configuring the [Vega Wallet](https://docs.vega.xyz/mainnet/tools/vega-wallet) instance. Wallet will not be deployed if this block is not defined. examples: - type: hcl value: | wallet "wallet-name" { ... } */ Wallet *WalletConfig `hcl:"wallet,block"` /* description: | Allows for deploying and configuring the [Vega Core Faucet](https://github.com/vegaprotocol/vega/tree/develop/core/faucet#faucet) instance, for supplying builtin assets. Faucet will not be deployed if this block is not defined. examples: - type: hcl value: | faucet "faucet-name" { ... } */ Faucet *FaucetConfig `hcl:"faucet,block"` /* description: | Allows the user to define jobs that should run before the node sets start. It can be used for node sets' dependencies, like databases, mock Ethereum chain, etc.. examples: - type: hcl value: | pre_start { docker_service "ganache-1" { ... } docker_service "postgres-1" { ... } } */ PreStart *PStartConfig `hcl:"pre_start,block"` /* description: | Allows the user to define jobs that should run after the node sets start. It can be used for services that depend on a network that is already running, like block explorer or Console. examples: - type: hcl value: | post_start { docker_service "bloc-explorer-1" { ... } docker_service "vega-console-1" { ... } } */ PostStart *PStartConfig `hcl:"post_start,block"` TokenAddresses map[string]types.SmartContractsToken }
description: |
Network configuration allows a user to customise the Capsule Vega network into different shapes based on personal needs. It also allows the configuration and deployment of different Vega nodes' setups (validator, full - full means a non validating node) and their dependencies (like Ethereum or Postgres). It can run custom Docker images before and after the network nodes have started and much more.
example:
type: hcl value: | network "testnet" { ethereum { ... } secondary_ethereum { ... } pre_start { ... } genesis_template_file = "..." smart_contracts_addresses_file = "..." secondary_smart_contracts_addresses_file = "..." node_set "validator-nodes" { ... } node_set "full-nodes" { ... } }
func (NetworkConfig) GetNodeConfig ¶
func (nc NetworkConfig) GetNodeConfig(name string) (*NodeConfig, error)
type NodeConfig ¶
type NodeConfig struct { /* description: | Name of the node set. Nomad instances that are part of these nodes are prefixed with this name. example: type: hcl value: | node_set "validators-1" { ... } */ Name string `hcl:"name,label" cty:"name"` /* description: | Determines what mode the node set should run in. values: - validator - full */ Mode string `hcl:"mode" cty:"mode"` /* description: | Defines how many node sets with this exact configuration should be created. */ Count int `hcl:"count" cty:"count"` /* description: Defines the password for the automatically generated node wallet associated with the created node. required_if: mode=validator */ NodeWalletPass string `hcl:"node_wallet_pass,optional" template:"" cty:"node_wallet_pass"` /* description: Defines password for automatically generated Ethereum wallet in node wallet. required_if: mode=validator */ EthereumWalletPass string `hcl:"ethereum_wallet_pass,optional" template:"" cty:"ethereum_wallet_pass"` /* description: Defines password for automatically generated Vega wallet in node wallet. required_if: mode=validator */ VegaWalletPass string `hcl:"vega_wallet_pass,optional" template:"" cty:"vega_wallet_pass"` /* description: Whether or not Data Node should be deployed on node set. */ UseDataNode bool `hcl:"use_data_node,optional" cty:"use_data_node"` /* description: | Path to [Visor](https://github.com/vegaprotocol/vega/tree/develop/visor) binary. If defined, Visor is automatically used to deploy Vega and Data nodes. The relative or absolute path can be used, if only the binary name is defined it automatically looks for it in $PATH. */ VisorBinary string `hcl:"visor_binary,optional"` /* description: Templates that can be used for configurations of Vega and Data nodes, Tendermint and other services. example: type: hcl value: | config_templates { vega_file = "./path/vega.tmpl" tendermint_file = "./path/tendermint.tmpl" data_node_file = "./path/data_node.tmpl" } */ ConfigTemplates ConfigTemplates `hcl:"config_templates,block"` /* description: | Allows user to define a Vega binary to be used in specific node set only. A relative or absolute path can be used. If only the binary name is defined, it automatically looks for it in $PATH. This can help with testing different version compatibilities or a protocol upgrade. note: Using versions that are not compatible could break the network - therefore this should be used in advanced cases only. */ VegaBinary *string `hcl:"vega_binary_path,optional"` /* description: | Allows a user to run a custom service before the node set is generated. This can be very useful when generating the node set might have some extenal dependency, such as a [Clef wallet](https://geth.ethereum.org/docs/clef/introduction). note: | Clef wallet is a good example - since generating a validator node set requires the Ethereum key to be generated, Clef can be started before the generation starts so that Capsule can generate the Ethereum key inside of it during the generation process. example: type: hcl value: | pre_generate { ... } */ PreGenerate *PreGenerate `hcl:"pre_generate,block"` /* description: Allows the user to run checks that have to be fulfilled before the node starts. note: | This can be useful for checking whether some dependent services have already started or not. Examples: databases, mocked services, etc.. example: type: hcl value: | pre_start_probe { ... } */ PreStartProbe *types.ProbesConfig `hcl:"pre_start_probe,block" template:""` /* description: | [Clef](https://geth.ethereum.org/docs/clef/introduction) is one of the [supported Ethereum wallets](https://docs.vega.xyz/mainnet/node-operators/setup-validator#using-clef) for Vega node. Capsule supports using Clef and can automatically import pre-generated Ethereum keys from Clef during node set generation process. By configuring this paramater, Capsule will automatically generate Ethereum keys in Clef and tell Vega to use them. An example Capsule config setup with Clef can be seen in [config_clef](net_confs/config_clef.hcl). example: type: hcl value: | clef_wallet { ... } */ ClefWallet *ClefConfig `hcl:"clef_wallet,block" template:""` /* description: | [Go template](templates.md) of custom Nomad job for node set. By default Capsule uses predefined Nomad jobs to run the node set on Nomad. This parameter allows users to provide a custom Nomad job to represent the generated node set. The [types.NodeSet](templates.md#types.nodeset) can be used in the template. Using custom Nomad jobs for node sets can break Capsule functionality. Very detailed knowledge is required - therefore it is not recommend to use this parameter unless you are an advanced user. note: | It is recommended that you use `nomad_job_template_file` param instead. If both `nomad_job_template` and `nomad_job_template_file` are defined, then `vega` overrides `nomad_job_template_file`. example: type: hcl value: | nomad_job_template = <<EOH ... EOH */ NomadJobTemplate *string `hcl:"nomad_job_template,optional"` /* description: | Same as `nomad_job_template` but it allows the user to link the Nomad job template as an external file. examples: - type: hcl value: | nomad_job_template_file = "/your_path/vega_config.tmpl" */ NomadJobTemplateFile *string `hcl:"nomad_job_template_file,optional"` }
description: |
Represents, and allows the user to configure, a set of Vega (with Tendermint) and Data Node nodes. One node set definition can be used by applied to multiple node sets (see `count` field) and it uses templating to distinguish between different nodes and names/ports and other collisions.
example:
type: hcl name: Node set with 2 validator nodes value: | node_set "validators" { count = 2 mode = "validator" node_wallet_pass = "n0d3w4ll3t-p4ssphr4e3" vega_wallet_pass = "w4ll3t-p4ssphr4e3" ethereum_wallet_pass = "ch41nw4ll3t-3th3r3um-p4ssphr4e3" config_templates { vega_file = "./path/vega_validator.tmpl" tendermint_file = "./path/tendermint_validator.tmpl" } }
func TemplateNodeConfig ¶ added in v0.3.0
func TemplateNodeConfig(templateContext NodeConfigTemplateContext, n NodeConfig) (*NodeConfig, error)
func (NodeConfig) Clone ¶ added in v0.2.0
func (nc NodeConfig) Clone() (*NodeConfig, error)
type NodeConfigTemplateContext ¶ added in v0.3.0
type NodeConfigTemplateContext struct { // description: Absolute index of the generated node. NodeNumber int }
type NomadConfig ¶ added in v0.2.0
type NomadConfig struct { /* description: | Name of the Nomad job. example: type: hcl value: | nomad_job "service-1" { ... } */ Name string `hcl:"name,label"` /* description: | [Go template](templates.md) of a Nomad job template. The [nomad.PreGenerateTemplateCtx](templates.md#nomadpregeneratetemplatectx) can be used in the template. Example [example](jobs/clef.tmpl). optional_if: job_template_file note: | It is recommended that you use `job_template_file` param instead. If both `job_template` and `job_template_file` are defined, then `job_template` overrides `job_template_file`. examples: - type: hcl value: | job_template = <<EOH ... EOH */ JobTemplate *string `hcl:"job_template,optional"` /* description: | Same as `job_template` but it allows the user to link the Nomad job template as an external file. examples: - type: hcl value: | job_template_file = "/your_path/nomad-job.tmpl" */ JobTemplateFile *string `hcl:"job_template_file,optional"` }
description: |
Allows the user to configure a [Nomad job](https://developer.hashicorp.com/nomad/docs/job-specification) definition to be run on Capsule.
example:
type: hcl value: | nomad_job "clef" { job_template = "/path-to/nomad-job.tmpl" }
type PStartConfig ¶
type PStartConfig struct { /* description: | Allows the user to define multiple services to be run inside [Docker](https://www.docker.com/). example: type: hcl value: | docker_service "service-1" { ... } */ Docker []DockerConfig `hcl:"docker_service,block"` Exec []ExecConfig `hcl:"exec_service,block"` }
description: |
Allows the user to configure services that will run before or after the network starts.
example:
type: hcl value: | post_start { docker_service "bloc-explorer-1" { ... } }
type PreGenerate ¶ added in v0.2.0
type PreGenerate struct { /* description: Allows to define raw [Nomad jobs](https://developer.hashicorp.com/nomad/docs/job-specification). example: type: hcl value: | nomad_job "service-1" { ... } nomad_job "service-2" { ... } */ Nomad []NomadConfig `hcl:"nomad_job,block"` }
description: Allows to define service that will run before generation step. example:
type: hcl value: | pre_generate { nomad_job "clef" { ... } }
type Resources ¶ added in v0.2.3
type Resources struct { // description: Minimum required CPU in MHz CPU *int `hcl:"cpu,optional"` // description: Number of minimum required CPU cores Cores *int `hcl:"cores,optional"` // description: Minimum required RAM in Mb MemoryMB *int `hcl:"memory,optional"` // description: Maximum allowed RAM in Mb MemoryMaxMB *int `hcl:"memory_max,optional"` // description: Minimum required disk space in Mb DiskMB *int `hcl:"disk,optional"` }
description: Allows the user to define hardware resource requirements example:
type: hcl value: | resources { cpu = 100 memory = 100 memory_max = 300 }
type StaticPort ¶
type StaticPort struct { // description: Represents port value on the host. Value int `hcl:"value"` // description: Represents port value inside of the container. To int `hcl:"to,optional"` }
description: Represents static port mapping from host to container. example:
type: hcl value: | static_port { value = 8001 to = 8002 }
type WalletConfig ¶
type WalletConfig struct { /* description: Name of the wallet. It will be used as an identifier when wallet runs. example: type: hcl value: | wallet "wallet-name" { ... } */ Name string `hcl:"name,label"` /* description: | By default, the wallet config inherits the Vega binary from the main network config, but this parameter allows a user to define a different Vega binary to be used in wallet. This can be used if a different wallet version is required. A relative or absolute path can be used. If only the binary name is defined, it automatically looks for it in $PATH. note: Using a Vega wallet version that is not compatible with the network version will not work - therefore this should be used in advanced cases only. example: type: hcl value: vega_binary_path = "binary_path" */ VegaBinary *string `hcl:"vega_binary_path,optional"` /* description: | Path to the file that contains the password used to protect the API token to wallet. API tokens are keys linked to a wallet that allow third party apps and bots to connect and send transactions without the need for user interaction. If this value is not defined, api tokens will not be enabled. A relative or absolute path can be used. example: type: hcl value: token_passphrase_path = "file_path" */ TokenPassphraseFile *string `hcl:"token_passphrase_path,optional"` /* description: | [Go template](templates.md) of a Vega Wallet network configuration. The [wallet.ConfigTemplateContext](templates.md#walletconfigtemplatecontext) can be used in the template. Example can be found in [default network config](net_confs/config.hcl). examples: - type: hcl value: | template = <<EOH ... EOH */ Template string `hcl:"template,optional"` }
description: |
Represents a configuration of a Vega Wallet service.
example:
type: hcl value: | wallet "wallet-1" { template = <<-EOT ... EOT }
Click to show internal directories.
Click to hide internal directories.