diff --git a/main.star b/main.star index 25396b1..dbbf0cb 100644 --- a/main.star +++ b/main.star @@ -13,22 +13,22 @@ def run(plan, chain_type = "local", relaychain = None, parachains = None, explor Args: chain_type (string): The type of chain (local, testnet or mainnet). Default is local. - relaychain (dict): A dict containing data for relay chain config. + relaychain (dict, optional): A dict containing data for relay chain config. - name (string): Name of relay chain. - - node (dict): A dict of node details. + - nodes (list): A list of dicts containing node details. - name (string): Name of node. - node_type (string): Type of node. - prometheus (bool): Boolean value to enable metrics for a given node. - parachains (list): A list containing data for para chain config. Each item in the list has the following: + parachains (list, optional): A list containing data for para chain config. Each item in the list is a dict containing the following: - name (string): Name of para chain. - - node (dict): A dict of node details. + - nodes (list): A list of dicts containing node details. - name (string): Name of node. - node_type (string): Type of node. - prometheus (bool): Boolean value to enable metrics for a given node. - explorer (bool): A boolean value indicating whether to enable polkadot js explorer or not. + explorer (bool, optional): A boolean value indicating whether to enable polkadot js explorer or not. Returns: - dict: Service details containing information about relay chains, parachains, and Prometheus. + service_details (dict): Service details containing information about relay chains, parachains, and Prometheus. """ service_details = run_polkadot_setup(plan, chain_type, relaychain, parachains, explorer) return service_details diff --git a/package_io/grafana.star b/package_io/grafana.star index 2e3fd5c..d2df803 100644 --- a/package_io/grafana.star +++ b/package_io/grafana.star @@ -7,33 +7,41 @@ def prometheus_grafana_service(plan, service_name, image, port, command, build_f if build_file != None: files["/build"] = build_file + if port != None: + public_ports = {"polkadot": PortSpec(port, transport_protocol = "TCP")} + else: + public_ports = {} service = plan.add_service( name = service_name, config = ServiceConfig( image = image, files = files, - ports = { - "polkadot": PortSpec(port, transport_protocol = "TCP"), + env_vars={ + "GF_AUTH_ANONYMOUS_ENABLED": "true", + "GF_AUTH_ANONYMOUS_ORG_ROLE": "Admin", + "GF_AUTH_ANONYMOUS_ORG_NAME": "Main Org.", }, - public_ports = { - "polkadot": PortSpec(port, transport_protocol = "TCP"), + ports = { + "polkadot": PortSpec(3000, transport_protocol = "TCP"), }, + public_ports = public_ports, entrypoint = command, ), ) return service -def launch_grafana(plan): +def launch_grafana(plan, port = None): command = ["/run.sh"] - service = prometheus_grafana_service(plan, "grafana", "grafana/grafana-dev:10.3.0-147071", 3000, command, None) + service = prometheus_grafana_service(plan, "grafana", "grafana/grafana-dev:10.3.0-147071", port, command, None) grafana_service_details = {} all_grafana_service_details = {} grafana_service_details["service_name"] = "grafana" grafana_service_details["endpoint"] = utils.get_service_url("http", service.ip_address, 3000) - + if port != None: + grafana_service_details["endpoint_public"] = utils.get_service_url("http", "127.0.0.1", port) all_grafana_service_details[service.name] = grafana_service_details - return all_grafana_service_details + return all_grafana_service_details \ No newline at end of file diff --git a/package_io/promethues.star b/package_io/promethues.star index af1340b..ffc42b2 100644 --- a/package_io/promethues.star +++ b/package_io/promethues.star @@ -20,7 +20,8 @@ USED_PORTS = { def launch_prometheus( plan, - service_details + service_details, + http_port_number = None ): template_data = new_config_template_data( plan, @@ -44,27 +45,38 @@ def launch_prometheus( prometheus_service_details = {} all_prometheus_service_details = {} - config = get_config(config_files_artifact_name) + config = get_config(config_files_artifact_name, http_port_number) prometheus_service = plan.add_service(SERVICE_NAME, config) private_ip_address = prometheus_service.ip_address prometheus_service_http_port = prometheus_service.ports[HTTP_PORT_ID].number prometheus_service_details["service_name"] = SERVICE_NAME prometheus_service_details["endpoint"] = "http://{0}:{1}".format(private_ip_address, prometheus_service_http_port) - + if http_port_number != None: + prometheus_service_details["endpoint_public"] = "http://{0}:{1}".format("127.0.0.1", http_port_number) + all_prometheus_service_details[prometheus_service.name] = prometheus_service_details - return all_prometheus_service_details -def get_config(config_files_artifact_name): +def get_config(config_files_artifact_name, http_port_number): config_file_path = shared_utils.path_join( CONFIG_DIR_MOUNTPOINT_ON_PROMETHEUS, shared_utils.path_base(CONFIG_FILENAME), ) + if http_port_number == None: + public_ports = {} + else: + public_ports = { + HTTP_PORT_ID: shared_utils.new_port_spec( + http_port_number, + "TCP", + "http", + ), + } return ServiceConfig( image = IMAGE_NAME, ports = USED_PORTS, - public_ports = USED_PORTS, + public_ports = public_ports, files = {CONFIG_DIR_MOUNTPOINT_ON_PROMETHEUS: config_files_artifact_name}, cmd = [ "--config.file=" + config_file_path, diff --git a/parachain/static_files/images.star b/parachain/static_files/images.star index 483de9a..6b6c587 100644 --- a/parachain/static_files/images.star +++ b/parachain/static_files/images.star @@ -108,7 +108,7 @@ parachain_images = { "encointer": { "image": "encointer/parachain:1.5.1", "entrypoint": "/usr/local/bin/encointer-collator", - "base": ["encointer-rococo-local", "encointer-rococo", "encointer-kusama"], + "base": ["encointer-rococo-local-dev", "encointer-rococo", "encointer-kusama"], }, "altair": { "image": "centrifugeio/centrifuge-chain:test-PR1628-354d76c-23-11-28",