@@ -32,31 +32,33 @@ type nodeSpec struct {
32
32
}
33
33
34
34
type clusterSpec struct {
35
- NilServerName string `yaml:"nil_server_name"`
36
- NilCertEmail string `yaml:"nil_cert_email"`
37
- NildConfigDir string `yaml:"nild_config_dir"`
38
- NildCredentialsDir string `yaml:"nild_credentials_dir"`
39
- NildPromBasePort int `yaml:"nild_prom_base_port"`
40
- NildP2PBaseTCPPort int `yaml:"nild_p2p_base_tcp_port"`
41
- PprofBaseTCPPort int `yaml:"pprof_base_tcp_port"`
42
- NilWipeOnUpdate bool `yaml:"nil_wipe_on_update"`
43
- NShards uint32 `yaml:"nShards"`
44
- NilRPCHost string `yaml:"nil_rpc_host"`
45
- NilRPCPort int `yaml:"nil_rpc_port"`
46
- EnableRPCOnValidators bool `yaml:"nil_rpc_enable_on_validators"`
47
- ClickhouseHost string `yaml:"clickhouse_host"`
48
- ClickhousePort int `yaml:"clickhouse_port"`
49
- ClickhouseLogin string `yaml:"clickhouse_login"`
50
- ClickhouseDatabase string `yaml:"clickhouse_database"`
51
- CometaRPCHost string `yaml:"cometa_rpc_host"`
52
- CometaPort int `yaml:"cometa_port"`
53
- FaucetRPCHost string `yaml:"faucet_rpc_host"`
54
- FaucetPort int `yaml:"faucet_port"`
55
- NilLoadgenHost string `yaml:"nil_loadgen_host"`
56
- NilLoadgenPort int `yaml:"nil_loadgen_port"`
57
- NilUpdateRetryInterval int `yaml:"nil_update_retry_interval_sec"`
58
- InstanceEnv string `yaml:"instance_env"`
59
- SignozJournaldLogs []string `yaml:"signoz_journald_logs"`
35
+ NilServerName string `yaml:"nil_server_name"`
36
+ NilCertEmail string `yaml:"nil_cert_email"`
37
+ NildConfigDir string `yaml:"nild_config_dir"`
38
+ NildCredentialsDir string `yaml:"nild_credentials_dir"`
39
+ NildPromBasePort int `yaml:"nild_prom_base_port"`
40
+ NildP2PBaseTCPPort int `yaml:"nild_p2p_base_tcp_port"`
41
+ PprofBaseTCPPort int `yaml:"pprof_base_tcp_port"`
42
+ NilWipeOnUpdate bool `yaml:"nil_wipe_on_update"`
43
+ NShards uint32 `yaml:"nShards"`
44
+ NilRPCHost string `yaml:"nil_rpc_host"`
45
+ NilRPCPort int `yaml:"nil_rpc_port"`
46
+ EnableRPCOnValidators bool `yaml:"nil_rpc_enable_on_validators"`
47
+ Relays network.AddrInfoSlice `yaml:"nil_relays"`
48
+ RelayPublicAddress network.AddrInfo `yaml:"nil_relay_public_address"`
49
+ ClickhouseHost string `yaml:"clickhouse_host"`
50
+ ClickhousePort int `yaml:"clickhouse_port"`
51
+ ClickhouseLogin string `yaml:"clickhouse_login"`
52
+ ClickhouseDatabase string `yaml:"clickhouse_database"`
53
+ CometaRPCHost string `yaml:"cometa_rpc_host"`
54
+ CometaPort int `yaml:"cometa_port"`
55
+ FaucetRPCHost string `yaml:"faucet_rpc_host"`
56
+ FaucetPort int `yaml:"faucet_port"`
57
+ NilLoadgenHost string `yaml:"nil_loadgen_host"`
58
+ NilLoadgenPort int `yaml:"nil_loadgen_port"`
59
+ NilUpdateRetryInterval int `yaml:"nil_update_retry_interval_sec"`
60
+ InstanceEnv string `yaml:"instance_env"`
61
+ SignozJournaldLogs []string `yaml:"signoz_journald_logs"`
60
62
61
63
NilConfig []nodeSpec `yaml:"nil_config"`
62
64
NilArchiveConfig []nodeSpec `yaml:"nil_archive_config"`
@@ -66,18 +68,20 @@ type clusterSpec struct {
66
68
}
67
69
68
70
type server struct {
69
- service string
70
- name string
71
- identity string
72
- p2pPort int
73
- promPort int
74
- pprofPort int
75
- rpcPort int
76
- credsDir string
77
- workDir string
78
- nodeSpec nodeSpec
79
- logClientEvents bool
80
- vkm * keys.ValidatorKeysManager
71
+ service string
72
+ name string
73
+ identity string
74
+ relays network.AddrInfoSlice
75
+ relayPublicAddress network.AddrInfo
76
+ p2pPort int
77
+ promPort int
78
+ pprofPort int
79
+ rpcPort int
80
+ credsDir string
81
+ workDir string
82
+ nodeSpec nodeSpec
83
+ logClientEvents bool
84
+ vkm * keys.ValidatorKeysManager
81
85
}
82
86
83
87
type cluster struct {
@@ -194,9 +198,17 @@ func genDevnet(cmd *cobra.Command, args []string) error {
194
198
if spec .EnableRPCOnValidators {
195
199
validatorRPCBasePort = spec .NilRPCPort + len (spec .NilRPCConfig )
196
200
}
197
- validators , err := spec .makeServers (spec .NilConfig ,
198
- spec .NildP2PBaseTCPPort , spec .NildPromBasePort , spec .PprofBaseTCPPort , validatorRPCBasePort ,
199
- "nil" , baseDir , false )
201
+ validators , err := spec .makeServers (
202
+ spec .NilConfig ,
203
+ spec .NildP2PBaseTCPPort ,
204
+ spec .NildPromBasePort ,
205
+ spec .PprofBaseTCPPort ,
206
+ validatorRPCBasePort ,
207
+ spec .Relays ,
208
+ spec .RelayPublicAddress ,
209
+ "nil" ,
210
+ baseDir ,
211
+ false )
200
212
if err != nil {
201
213
return fmt .Errorf ("failed to setup validator nodes: %w" , err )
202
214
}
@@ -216,18 +228,34 @@ func genDevnet(cmd *cobra.Command, args []string) error {
216
228
archiveBasePprof = spec .PprofBaseTCPPort + len (validators )
217
229
}
218
230
219
- c .archivers , err = spec .makeServers (spec .NilArchiveConfig ,
220
- archiveBaseP2P , archiveBaseProm , archiveBasePprof , 0 ,
221
- "nil-archive" , baseDir , false )
231
+ c .archivers , err = spec .makeServers (
232
+ spec .NilArchiveConfig ,
233
+ archiveBaseP2P ,
234
+ archiveBaseProm ,
235
+ archiveBasePprof ,
236
+ 0 ,
237
+ spec .Relays ,
238
+ spec .RelayPublicAddress ,
239
+ "nil-archive" ,
240
+ baseDir ,
241
+ false )
222
242
if err != nil {
223
243
return fmt .Errorf ("failed to setup archive nodes: %w" , err )
224
244
}
225
245
226
246
rpcBasePprof := spec .PprofBaseTCPPort + len (validators ) + len (c .archivers )
227
247
228
- c .rpcNodes , err = spec .makeServers (spec .NilRPCConfig ,
229
- 0 , 0 , rpcBasePprof , spec .NilRPCPort ,
230
- "nil-rpc" , baseDir , true )
248
+ c .rpcNodes , err = spec .makeServers (
249
+ spec .NilRPCConfig ,
250
+ 0 ,
251
+ 0 ,
252
+ rpcBasePprof ,
253
+ spec .NilRPCPort ,
254
+ nil ,
255
+ network.AddrInfo {},
256
+ "nil-rpc" ,
257
+ baseDir ,
258
+ true )
231
259
if err != nil {
232
260
return fmt .Errorf ("failed to setup rpc nodes: %w" , err )
233
261
}
@@ -277,6 +305,8 @@ func (spec *clusterSpec) makeServers(
277
305
basePromPort int ,
278
306
basePprofPort int ,
279
307
baseHTTPPort int ,
308
+ relays network.AddrInfoSlice ,
309
+ relayPublicAddress network.AddrInfo ,
280
310
service string ,
281
311
baseDir string ,
282
312
logClientEvents bool ,
@@ -286,6 +316,8 @@ func (spec *clusterSpec) makeServers(
286
316
servers [i ].service = service
287
317
servers [i ].name = fmt .Sprintf ("%s-%d" , service , i )
288
318
servers [i ].nodeSpec = nodeSpec
319
+ servers [i ].relays = relays
320
+ servers [i ].relayPublicAddress = relayPublicAddress
289
321
servers [i ].logClientEvents = logClientEvents
290
322
if baseP2pPort != 0 {
291
323
servers [i ].p2pPort = baseP2pPort + i
@@ -333,7 +365,10 @@ func (spec *clusterSpec) EnsureIdentity(srv server) (string, error) {
333
365
return "" , fmt .Errorf ("failed to load or generate keys: %w" , err )
334
366
}
335
367
_ , _ , identity , err := network .SerializeKeys (privKey )
336
- return identity .String (), err
368
+ if err != nil {
369
+ return "" , fmt .Errorf ("failed to serialize keys: %w" , err )
370
+ }
371
+ return identity .String (), nil
337
372
}
338
373
339
374
func (c * cluster ) writeServerConfig (instanceId int , srv server , only string ) error {
@@ -363,8 +398,10 @@ func (c *cluster) writeServerConfig(instanceId int, srv server, only string) err
363
398
Network : & network.Config {
364
399
TcpPort : srv .p2pPort ,
365
400
366
- DHTEnabled : true ,
367
- DHTBootstrapPeers : getPeers (c .validators , inst .DHTBootstrapPeersIdx ),
401
+ DHTEnabled : true ,
402
+ DHTBootstrapPeers : getPeers (c .validators , inst .DHTBootstrapPeersIdx ),
403
+ Relays : srv .relays ,
404
+ RelayPublicAddress : srv .relayPublicAddress ,
368
405
},
369
406
Telemetry : & telemetry.Config {
370
407
ExportMetrics : true ,
0 commit comments