Capsule allows templating for genesis file and node-set configurations like Vega, Tendermint, and Nomad. This is useful for generating configurations specific to a network, or for using one configuration for all node sets.
Capsule uses Go's text/template templating engine, extended by useful functions from the Sprig library.
Every template has a template context - a set of (usually runtime generated) variables passed to the template by Capsule and then used in the template. These template contexts are documented below.
There are some basic templates provided by Capsule and used by some of the provided configurations in the net_confs folder in the Vega Capsule GitHub repo.
Capsule includes a tool to test these templates before they get used in network config. Plese check vegacapsule template --help
for more information.
You can test the template tool by using some of the provided default templates after the network has been generated.
For example, run command below and compare the outcome with the template.
vegacapsule template node-sets --type vega --path net_confs/node_set_templates/default/vega_validators.tmpl --nodeset-name testnet-nodeset-validators-0-validator
-
NodeNumber
int - required -
Absolute index of the generated node.
-
NodeHomeDir
string - required -
NodeNumber
int - required -
NodeSet
types.NodeSet - required
-
HomeDir
string - required -
Path to home directory of the Faucet.
-
PublicKey
string - required -
Public key of the Faucet.
Template context also includes functions:
.GetEthContractAddr "contract_name"
- returns contract address based on name..GetVegaContractID "contract_name"
- returns contract vega ID based on name.
-
Addresses
map[string]genesis.SmartContract - required -
Ethereum smart contract addresses created by Vega. These can represent bridges or ERC20 tokens.
-
NetworkID
string - required -
Ethereum network ID.
-
ChainID
string - required -
Ethereum chain ID.
-
TendermintNodePrefix
string - required -
VegaNodePrefix
string - required -
NodeNumber
int - required -
NodesCount
int - required -
NodeSet
types.NodeSet - required
-
TendermintNodePrefix
string - required -
VegaNodePrefix
string - required -
DataNodePrefix
string - required -
ETHEndpoint
string - required -
NodeMode
string - required -
FaucetPublicKey
string - required -
NodeNumber
int - required -
NodeSet
types.NodeSet - required -
NodeHomeDir
string - required
-
NodeSet
types.NodeSet - required
-
TendermintNodePrefix
string - required -
VegaNodePrefix
string - required -
DataNodePrefix
string - required -
WalletPrefix
string - required -
Validators
[]types.NodeSet - required -
NonValidators
[]types.NodeSet - required
-
GroupName
string - required -
Name that represents a group of the same node sets.
-
Name
string - required -
Name of a specific node set in a node sets group.
-
Mode
string - required -
Mode of the node set. Can be
validator
orfull
(full means a non validating node). -
Index
int - required -
Index is a position and order in which the node set has been generated respective to all other created node sets. It goes from 0-N where N is the total number of node sets.
-
RelativeIndex
int - required -
RelativeIndex is a counter relative to current node set group. Related to GroupName.
-
GroupIndex
int - required -
GroupIndex is an index of the group that this node set belongs to. Related to GroupName.
-
Vega
types.VegaNode - required -
Information about generated Vega node.
-
Tendermint
types.TendermintNode - required -
Information about generated Tendermint node.
-
DataNode
types.DataNode - optional -
Information about generated Data node.
-
Visor
types.Visor - optional -
Information about generated Visor instance.
-
PreGenerateJobs
[]types.NomadJob - required -
Jobs that have been started before the nodes were generated.
-
PreStartProbe
types.ProbesConfig - optional -
Pre start probes.
-
NomadJobRaw
string - optional -
Stores custom Nomad job definition of this node set.
-
Ethereum
string - required -
Ethereum address.
-
Vega
string - required -
Vega contract ID.
Represents generated Vega node.
-
GeneratedService
types.GeneratedService - required -
General information about the node.
-
Mode
string - required -
Mode of the node -
validator
orfull
. -
NodeWalletPassFilePath
string - required -
Path to generated node wallet passphrase file.
Only present if `mode = validator`.
-
NodeWalletInfo
types.NodeWalletInfo - optional -
Information about generated/imported node wallets.
Only present if `mode = validator`.
-
BinaryPath
string - required -
Path to binary used to generate and run the node.
Represents generated Tendermint node.
-
GeneratedService
types.GeneratedService - required -
General information about the node.
-
NodeID
string - required -
ID of the Tendermint node.
-
GenesisFilePath
string - required -
File path of the genesis file used to bootstrap the network.
-
BinaryPath
string - required -
Path to binary used to generate and run the node.
-
ValidatorPublicKey
string - required -
Generated public key of the Tendermint validator.
-
GeneratedService
types.GeneratedService - required -
General information about the node.
-
BinaryPath
string - required -
Path to binary used to generate and run the node.
-
UniqueSwarmKey
string - required -
Unique IPFS swarm key for this network
-
GeneratedService
types.GeneratedService - required -
General information about Visor.
-
BinaryPath
string - required -
Path to binary used to generate and run the node.
Represents a raw Nomad job.
-
ID
string - required -
Custom selected ID - name of the job.
-
NomadJobRaw
string - required -
Nomad job definition.
Allows the user to define pre start probes on external services.
-
HTTP
types.HTTPProbe - optional -
Allows the user to probe HTTP endpoint.
-
TCP
types.TCPProbe - optional -
Allows the user to probe TCP socker.
-
Postgres
types.PostgresProbe - optional -
Allows the user to probe Postgres database with a query.
pre_start_probe {
...
}
Represents any generated Capsule service.
-
Name
string - required -
Name of the service.
-
HomeDir
string - required -
Path to home directory of the service.
-
ConfigFilePath
string - required -
Path to service configuration.
Information about node wallets.
-
EthereumAddress
string - required -
Ethereum account address.
Only available when Key Store wallet is used.
-
EthereumPrivateKey
string - required -
EthereumPassFilePath
string - required -
Path to file where Ethereum wallet key is stored.
-
EthereumClefRPCAddress
string - required -
Address of Clef wallet.
Only available when Clef wallet is used.
-
VegaWalletName
string - required -
Name of the Vega wallet.
-
VegaWalletID
string - required -
ID of Vega wallet.
-
VegaWalletPublicKey
string - required -
Public key used from the Vega wallet.
-
VegaWalletRecoveryPhrase
string - required -
Recovery phrase from the Vega wallet.
-
VegaWalletPassFilePath
string - required -
File path of the Vega wallet passphrase.
Allows the user to probe HTTP endpoint.
-
URL
string - required -
URL of the HTTP endpoint.
http {
url = "http://localhost:8002"
}
Allows the user to probe TCP socket.
-
Address
string - required -
Address of the TCP socket.
tcp {
address = "localhost:9009"
}
Allows the user to probe Postgres database.
-
Connection
string - required -
Postgres connection string.
-
Query
string - required -
Test query.
postgres {
connection = "user=vega dbname=vega password=vega port=5232 sslmode=disable"
query = "select 10 + 10"
}