1
- # tmpnet ( temporary network fixture)
1
+ # tmpnet - temporary network orchestration
2
2
3
3
This package implements a simple orchestrator for the avalanchego
4
4
nodes of a temporary network. Configuration is stored on disk, and
@@ -31,6 +31,8 @@ the following non-test files:
31
31
| genesis.go | | Creates test genesis |
32
32
| network.go | Network | Orchestrates and configures temporary networks |
33
33
| node.go | Node | Orchestrates and configures nodes |
34
+ | node_config.go | Node | Reads and writes node configuration |
35
+ | node_process.go | NodeProcess | Orchestrates node processes |
34
36
| utils.go | | Defines shared utility functions |
35
37
36
38
## Usage
@@ -76,7 +78,7 @@ network, _ := tmpnet.StartNetwork(
76
78
ginkgo.GinkgoWriter , // Writer to report progress of network start
77
79
" " , // Use default root dir (~/.tmpnet)
78
80
&tmpnet.Network {
79
- DefaultRuntime : tmpnet.NodeRuntimeConfig {
81
+ NodeRuntimeConfig : tmpnet.NodeRuntimeConfig {
80
82
ExecPath: " /path/to/avalanchego" , // Defining the avalanchego exec path is required
81
83
},
82
84
},
@@ -102,7 +104,7 @@ network, _ := tmpnet.StartNetwork(
102
104
ginkgo.GinkgoWriter ,
103
105
" " ,
104
106
&tmpnet.Network {
105
- DefaultRuntime : tmpnet.NodeRuntimeConfig {
107
+ NodeRuntimeConfig : tmpnet.NodeRuntimeConfig {
106
108
ExecPath: " /path/to/avalanchego" ,
107
109
},
108
110
Nodes : []*Node{
@@ -147,9 +149,10 @@ HOME
147
149
├── NodeID-37E8UK3x2YFsHE3RdALmfWcppcZ1eTuj9 // The ID of a node is the name of its data dir
148
150
│ ├── chainData
149
151
│ │ └── ...
150
- │ ├── config.json // Node flags
152
+ │ ├── config.json // Node runtime configuration
151
153
│ ├── db
152
154
│ │ └── ...
155
+ │ ├── flags.json // Node flags
153
156
│ ├── logs
154
157
│ │ └── ...
155
158
│ ├── plugins
@@ -160,11 +163,7 @@ HOME
160
163
│ └── config.json // C-Chain config for all nodes
161
164
├── defaults.json // Default flags and configuration for network
162
165
├── genesis.json // Genesis for all nodes
163
- ├── network.env // Sets network dir env to simplify use of network
164
- └── ephemeral // Parent directory for ephemeral nodes (e.g. created by tests)
165
- └─ NodeID-FdxnAvr4jK9XXAwsYZPgWAHW2QnwSZ // Data dir for an ephemeral node
166
- └── ...
167
-
166
+ └── network.env // Sets network dir env var to simplify network usage
168
167
```
169
168
170
169
### Default flags and configuration
@@ -203,19 +202,33 @@ this file (i.e. `source network.env`) in a shell will configure ginkgo
203
202
e2e and the ` tmpnetctl ` cli to target the network path specified in
204
203
the env var.
205
204
205
+ Set ` TMPNET_ROOT_DIR ` to specify the root directory in which to create
206
+ the configuration directory of new networks
207
+ (e.g. ` $TMPNET_ROOT_DIR/[network-dir] ` ). The default root directory is
208
+ ` ~/.tmpdir/networks ` . Configuring the root directory is only relevant
209
+ when creating new networks as the path of existing networks will
210
+ already have been set.
211
+
206
212
### Node configuration
207
213
208
214
The data dir for a node is set by default to
209
215
` [network-path]/[node-id] ` . A node can be configured to use a
210
216
non-default path by explicitly setting the ` --data-dir `
211
217
flag.
212
218
219
+ #### Runtime config
220
+
221
+ The details required to configure a node's execution are written to
222
+ ` [network-path]/[node-id]/config.json ` . This file contains the
223
+ runtime-specific details like the path of the avalanchego binary to
224
+ start the node with.
225
+
213
226
#### Flags
214
227
215
228
All flags used to configure a node are written to
216
- ` [network-path]/[node-id]/config .json ` so that a node can be
229
+ ` [network-path]/[node-id]/flags .json ` so that a node can be
217
230
configured with only a single argument:
218
- ` --config-file=/path/to/config .json ` . This simplifies node launch and
231
+ ` --config-file=/path/to/flags .json ` . This simplifies node launch and
219
232
ensures all parameters used to launch a node can be modified by
220
233
editing the config file.
221
234
0 commit comments