Skip to content

Commit ce1f337

Browse files
authored
fix: beaconchain explorer (ethereum#538)
1 parent 8ef5c57 commit ce1f337

File tree

10 files changed

+71
-53
lines changed

10 files changed

+71
-53
lines changed

main.star

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,7 @@ def run(plan, args={}):
395395
full_beaconchain_explorer.launch_full_beacon(
396396
plan,
397397
full_beaconchain_explorer_config_template,
398+
el_cl_data_files_artifact_uuid,
398399
all_cl_contexts,
399400
all_el_contexts,
400401
persistent,

src/cl/cl_context.star

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
def new_cl_context(
22
client_name,
33
enr,
4+
ip_addr,
5+
http_port,
46
beacon_http_url,
57
cl_nodes_metrics_info,
68
beacon_service_name,
@@ -14,6 +16,8 @@ def new_cl_context(
1416
return struct(
1517
client_name=client_name,
1618
enr=enr,
19+
ip_addr=ip_addr,
20+
http_port=http_port,
1721
beacon_http_url=beacon_http_url,
1822
cl_nodes_metrics_info=cl_nodes_metrics_info,
1923
beacon_service_name=beacon_service_name,

src/cl/grandine/grandine_launcher.star

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,8 @@ def launch(
187187
return cl_context.new_cl_context(
188188
"grandine",
189189
beacon_node_enr,
190+
beacon_service.ip_address,
191+
beacon_http_port.number,
190192
beacon_http_url,
191193
nodes_metrics_info,
192194
beacon_service_name,

src/cl/lighthouse/lighthouse_launcher.star

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,8 @@ def launch(
204204
return cl_context.new_cl_context(
205205
"lighthouse",
206206
beacon_node_enr,
207+
beacon_service.ip_address,
208+
beacon_http_port.number,
207209
beacon_http_url,
208210
nodes_metrics_info,
209211
beacon_service_name,

src/cl/lodestar/lodestar_launcher.star

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,8 @@ def launch(
196196
return cl_context.new_cl_context(
197197
"lodestar",
198198
beacon_node_enr,
199+
beacon_service.ip_address,
200+
beacon_http_port.number,
199201
beacon_http_url,
200202
nodes_metrics_info,
201203
beacon_service_name,

src/cl/nimbus/nimbus_launcher.star

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,8 @@ def launch(
199199
return cl_context.new_cl_context(
200200
"nimbus",
201201
beacon_node_enr,
202+
beacon_service.ip_address,
203+
beacon_http_port.number,
202204
beacon_http_url,
203205
nodes_metrics_info,
204206
beacon_service_name,

src/cl/prysm/prysm_launcher.star

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,8 @@ def launch(
180180
return cl_context.new_cl_context(
181181
"prysm",
182182
beacon_node_enr,
183+
beacon_service.ip_address,
184+
beacon_http_port.number,
183185
beacon_http_url,
184186
nodes_metrics_info,
185187
beacon_service_name,

src/cl/teku/teku_launcher.star

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,8 @@ def launch(
192192
return cl_context.new_cl_context(
193193
"teku",
194194
beacon_node_enr,
195+
beacon_service.ip_address,
196+
beacon_http_port.number,
195197
beacon_http_url,
196198
nodes_metrics_info,
197199
beacon_service_name,

src/full_beaconchain/full_beaconchain_launcher.star

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
shared_utils = import_module("../shared_utils/shared_utils.star")
22
postgres = import_module("github.com/kurtosis-tech/postgres-package/main.star")
33
redis = import_module("github.com/kurtosis-tech/redis-package/main.star")
4-
4+
constants = import_module("../package_io/constants.star")
55
IMAGE_NAME = "gobitfly/eth2-beaconchain-explorer:latest"
66

77
POSTGRES_PORT_ID = "postgres"
@@ -19,8 +19,7 @@ FRONTEND_PORT_NUMBER = 8080
1919
LITTLE_BIGTABLE_PORT_ID = "littlebigtable"
2020
LITTLE_BIGTABLE_PORT_NUMBER = 9000
2121

22-
FULL_BEACONCHAIN_CONFIG_FILENAME = "config.yml"
23-
22+
FULL_BEACONCHAIN_CONFIG_FILENAME = "beaconchain-config.yml"
2423

2524
USED_PORTS = {
2625
FRONTEND_PORT_ID: shared_utils.new_port_spec(
@@ -94,6 +93,7 @@ FRONTEND_MAX_MEMORY = 2048
9493
def launch_full_beacon(
9594
plan,
9695
config_template,
96+
el_cl_data_files_artifact_uuid,
9797
cl_contexts,
9898
el_contexts,
9999
persistent,
@@ -147,16 +147,14 @@ def launch_full_beacon(
147147
)
148148
redis_url = "{}:{}".format(redis_output.hostname, redis_output.port_number)
149149

150-
cl_url = cl_contexts[0].beacon_http_url[7:] # Remove the "http://"
151-
cl_port = cl_contexts[0].beacon_http_url.split(":")[2] # Get the port number
152-
153150
template_data = new_config_template_data(
154-
cl_url,
155-
cl_port,
151+
cl_contexts[0].ip_addr,
152+
cl_contexts[0].http_port,
153+
cl_contexts[0].client_name,
156154
el_uri,
157155
little_bigtable.ip_address,
158156
LITTLE_BIGTABLE_PORT_NUMBER,
159-
postgres_output.url,
157+
postgres_output.service.name,
160158
POSTGRES_PORT_NUMBER,
161159
redis_url,
162160
FRONTEND_PORT_NUMBER,
@@ -171,17 +169,20 @@ def launch_full_beacon(
171169
] = template_and_data
172170

173171
config_files_artifact_name = plan.render_templates(
174-
template_and_data_by_rel_dest_filepath, "config.yml"
172+
template_and_data_by_rel_dest_filepath, "beaconchain-config.yml"
175173
)
176174

175+
files = {
176+
"/app/config/": config_files_artifact_name,
177+
constants.GENESIS_DATA_MOUNTPOINT_ON_CLIENTS: el_cl_data_files_artifact_uuid,
178+
}
179+
177180
# Initialize the db schema
178181
initdbschema = plan.add_service(
179182
name="beaconchain-schema-initializer",
180183
config=ServiceConfig(
181184
image=IMAGE_NAME,
182-
files={
183-
"/app/config/": config_files_artifact_name,
184-
},
185+
files=files,
185186
entrypoint=["tail", "-f", "/dev/null"],
186187
min_cpu=INIT_MIN_CPU,
187188
max_cpu=INIT_MAX_CPU,
@@ -195,7 +196,13 @@ def launch_full_beacon(
195196
plan.exec(
196197
service_name=initdbschema.name,
197198
recipe=ExecRecipe(
198-
["./misc", "-config", "/app/config/config.yml", "-command", "applyDbSchema"]
199+
[
200+
"./misc",
201+
"-config",
202+
"/app/config/beaconchain-config.yml",
203+
"-command",
204+
"applyDbSchema",
205+
]
199206
),
200207
)
201208

@@ -207,7 +214,7 @@ def launch_full_beacon(
207214
[
208215
"./misc",
209216
"-config",
210-
"/app/config/config.yml",
217+
"/app/config/beaconchain-config.yml",
211218
"-command",
212219
"initBigtableSchema",
213220
]
@@ -219,13 +226,11 @@ def launch_full_beacon(
219226
name="beaconchain-indexer",
220227
config=ServiceConfig(
221228
image=IMAGE_NAME,
222-
files={
223-
"/app/config/": config_files_artifact_name,
224-
},
229+
files=files,
225230
entrypoint=["./explorer"],
226231
cmd=[
227232
"-config",
228-
"/app/config/config.yml",
233+
"/app/config/beaconchain-config.yml",
229234
],
230235
env_vars={
231236
"INDEXER_ENABLED": "TRUE",
@@ -242,13 +247,11 @@ def launch_full_beacon(
242247
name="beaconchain-eth1indexer",
243248
config=ServiceConfig(
244249
image=IMAGE_NAME,
245-
files={
246-
"/app/config/": config_files_artifact_name,
247-
},
250+
files=files,
248251
entrypoint=["./eth1indexer"],
249252
cmd=[
250253
"-config",
251-
"/app/config/config.yml",
254+
"/app/config/beaconchain-config.yml",
252255
"-blocks.concurrency",
253256
"1",
254257
"-blocks.tracemode",
@@ -269,13 +272,11 @@ def launch_full_beacon(
269272
name="beaconchain-rewardsexporter",
270273
config=ServiceConfig(
271274
image=IMAGE_NAME,
272-
files={
273-
"/app/config/": config_files_artifact_name,
274-
},
275+
files=files,
275276
entrypoint=["./rewards-exporter"],
276277
cmd=[
277278
"-config",
278-
"/app/config/config.yml",
279+
"/app/config/beaconchain-config.yml",
279280
],
280281
min_cpu=REWARDSEXPORTER_MIN_CPU,
281282
max_cpu=REWARDSEXPORTER_MAX_CPU,
@@ -289,13 +290,11 @@ def launch_full_beacon(
289290
name="beaconchain-statistics",
290291
config=ServiceConfig(
291292
image=IMAGE_NAME,
292-
files={
293-
"/app/config/": config_files_artifact_name,
294-
},
293+
files=files,
295294
entrypoint=["./statistics"],
296295
cmd=[
297296
"-config",
298-
"/app/config/config.yml",
297+
"/app/config/beaconchain-config.yml",
299298
"-charts.enabled",
300299
"-graffiti.enabled",
301300
"-validators.enabled",
@@ -312,13 +311,11 @@ def launch_full_beacon(
312311
name="beaconchain-fdu",
313312
config=ServiceConfig(
314313
image=IMAGE_NAME,
315-
files={
316-
"/app/config/": config_files_artifact_name,
317-
},
314+
files=files,
318315
entrypoint=["./frontend-data-updater"],
319316
cmd=[
320317
"-config",
321-
"/app/config/config.yml",
318+
"/app/config/beaconchain-config.yml",
322319
],
323320
min_cpu=FDU_MIN_CPU,
324321
max_cpu=FDU_MAX_CPU,
@@ -332,13 +329,11 @@ def launch_full_beacon(
332329
name="beaconchain-frontend",
333330
config=ServiceConfig(
334331
image=IMAGE_NAME,
335-
files={
336-
"/app/config/": config_files_artifact_name,
337-
},
332+
files=files,
338333
entrypoint=["./explorer"],
339334
cmd=[
340335
"-config",
341-
"/app/config/config.yml",
336+
"/app/config/beaconchain-config.yml",
342337
],
343338
env_vars={
344339
"FRONTEND_ENABLED": "TRUE",
@@ -360,6 +355,7 @@ def launch_full_beacon(
360355
def new_config_template_data(
361356
cl_url,
362357
cl_port,
358+
cl_type,
363359
el_uri,
364360
lbt_host,
365361
lbt_port,
@@ -371,9 +367,13 @@ def new_config_template_data(
371367
return {
372368
"CLNodeHost": cl_url,
373369
"CLNodePort": cl_port,
370+
"CLNodeType": cl_type,
374371
"ELNodeEndpoint": el_uri,
375372
"LBTHost": lbt_host,
376373
"LBTPort": lbt_port,
374+
"DBName": POSTGRES_DB,
375+
"DBUser": POSTGRES_USER,
376+
"DBPass": POSTGRES_PASSWORD,
377377
"DBHost": db_host,
378378
"DBPort": db_port,
379379
"RedisEndpoint": redis_url,

static_files/full-beaconchain-config/config.yaml.tmpl

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
chain:
2-
configPath: 'node'
2+
clConfigPath: 'node'
3+
elConfigPath: '/network-configs/network-configs/genesis.json'
34
readerDatabase:
4-
name: db
5+
name: {{.DBName}}
56
host: {{.DBHost}}
67
port: {{.DBPort}}
7-
user: postgres
8-
password: "pass"
8+
user: {{.DBUser}}
9+
password: {{.DBPass}}
910
writerDatabase:
10-
name: db
11+
name: {{.DBName}}
1112
host: {{.DBHost}}
1213
port: {{.DBPort}}
13-
user: postgres
14-
password: "pass"
14+
user: {{.DBUser}}
15+
password: {{.DBPass}}
1516
bigtable:
1617
project: explorer
1718
instance: explorer
@@ -30,17 +31,17 @@ frontend:
3031
host: '0.0.0.0' # Address to listen on
3132
port: '{{.FrontendPort}}' # Port to listen on
3233
readerDatabase:
33-
name: db
34+
name: {{.DBName}}
3435
host: {{.DBHost}}
3536
port: {{.DBPort}}
36-
user: postgres
37-
password: "pass"
37+
user: {{.DBUser}}
38+
password: {{.DBPass}}
3839
writerDatabase:
39-
name: db
40+
name: {{.DBName}}
4041
host: {{.DBHost}}
4142
port: {{.DBPort}}
42-
user: postgres
43-
password: "pass"
43+
user: {{.DBUser}}
44+
password: {{.DBPass}}
4445
sessionSecret: "11111111111111111111111111111111"
4546
jwtSigningSecret: "1111111111111111111111111111111111111111111111111111111111111111"
4647
jwtIssuer: "localhost"
@@ -58,5 +59,5 @@ indexer:
5859
node:
5960
host: '{{.CLNodeHost}}'
6061
port: '{{.CLNodePort}}'
61-
type: lighthouse
62+
type: '{{.CLNodeType}}'
6263
eth1DepositContractFirstBlock: 0

0 commit comments

Comments
 (0)