@@ -525,22 +525,23 @@ def __init__(self) -> None:
525525
526526 def get_instance_ports (self , instance_num : int ) -> InstancePorts :
527527 """Return ports mapping for given cluster instance."""
528- offset = (50 + instance_num ) * 10
529- base = 30000 + offset
530- metrics_base = 30300 + offset
528+ ports_per_instance = 10
529+ offset = instance_num * ports_per_instance
530+ base = configuration .PORTS_BASE + offset
531+ last_port = base + ports_per_instance - 1
531532
532533 relay1_ports = NodePorts (
533534 num = 0 ,
534- node = base + 1 ,
535- ekg = metrics_base + 1 ,
536- prometheus = metrics_base + 2 ,
535+ node = base ,
536+ ekg = base + 1 ,
537+ prometheus = base + 2 ,
537538 )
538539
539540 ports = InstancePorts (
540541 base = base ,
541- webserver = 0 ,
542- metrics_submit_api = metrics_base ,
543- submit_api = base + 9 ,
542+ webserver = last_port ,
543+ metrics_submit_api = last_port - 1 ,
544+ submit_api = last_port - 2 ,
544545 supervisor = 12001 + instance_num ,
545546 relay1 = relay1_ports .node ,
546547 ekg_relay1 = relay1_ports .ekg ,
@@ -620,6 +621,8 @@ def _reconfigure_testnet(
620621 new_content = new_content .replace (
621622 "%%PROMETHEUS_PORT_RELAY1%%" , str (instance_ports .prometheus_relay1 )
622623 )
624+ # Reconfigure webserver port
625+ new_content = new_content .replace ("%%WEBSERVER_PORT%%" , str (instance_ports .webserver ))
623626
624627 with open (outfile , "w" , encoding = "utf-8" ) as out_fp :
625628 out_fp .write (new_content )
0 commit comments