diff --git a/main.star b/main.star index 9adddbf..72176e7 100644 --- a/main.star +++ b/main.star @@ -1,11 +1,16 @@ parachain = import_module("./parachain/parachain.star") relay_chain = import_module("./relaychain/relay-chain.star") litentry = import_module("./parachain/litentry.star") +clover = import_module("./parachain/clover.star") def run(plan, args): plan.upload_files(src = "./parachain/static_files/configs", name = "configs") + service_details = {"relaychains": {}, "parachains": {}} if args["chain-type"] == "local": - relay_chain.spawn_multiple_relay(plan, 2) - litentry.run_litentry(plan) + service_details["relaychains"] = relay_chain.start_relay_chains_local(plan, args) + service_details["parachains"] = clover.run_clover(plan) + else: relay_chain.start_relay_chain(plan, args) + + return service_details diff --git a/parachain/clover.star b/parachain/clover.star new file mode 100644 index 0000000..90b8390 --- /dev/null +++ b/parachain/clover.star @@ -0,0 +1,30 @@ +def run_clover(plan): + exec_command = [ + "--chain=dev", + "--rpc-port=9933", + "--rpc-external", + "--rpc-cors=all", + "--rpc-methods=unsafe", + "--execution=wasm", + "--tmp", + "--unsafe-ws-external", + "--", + "--chain=/app/rococo-local.json", + "--execution=wasm" + ] + clover_service_config = ServiceConfig( + image = "cloverio/clover-para:v0.1.24", + files = { + "/app":"configs" + }, + ports = { + "ws": PortSpec(9944, transport_protocol="TCP"), + "tcp": PortSpec(9933, transport_protocol="TCP") + }, + cmd = exec_command, + entrypoint=["/opt/clover/bin/clover"] + ) + + service_details = plan.add_service(name="clover-node", config=clover_service_config) + + return service_details diff --git a/parachain/litentry.star b/parachain/litentry.star index 46fd4fb..9ad16df 100644 --- a/parachain/litentry.star +++ b/parachain/litentry.star @@ -7,6 +7,7 @@ def run_litentry(plan): "--rpc-methods=unsafe", "--execution=wasm", "--tmp", + "--unsafe-ws-external", "--", "--chain=/app/rococo-local.json", "--execution=wasm" @@ -20,11 +21,9 @@ def run_litentry(plan): "9944": PortSpec(9944, transport_protocol="TCP"), "9933": PortSpec(9933, transport_protocol="TCP") }, - public_ports = { - "9944": PortSpec(9432, transport_protocol="TCP"), - "9933": PortSpec(9431, transport_protocol="TCP") - - }, cmd = exec_command, ) - plan.add_service(name="litentry-node", config=litentry_service_config) + + service_details = plan.add_service(name="litentry-node", config=litentry_service_config) + + return service_details diff --git a/relaychain/relay-chain.star b/relaychain/relay-chain.star index fb97e1a..4c825d5 100644 --- a/relaychain/relay-chain.star +++ b/relaychain/relay-chain.star @@ -24,9 +24,17 @@ def spawn_multiple_relay(plan, count): port = port + count start_relay_chain_local(plan, list[i], port) +def start_relay_chains_local(plan, args): + relay_nodes = args["relaychain"]["nodes"] + relay_detail = {} + for node in relay_nodes: + service_details = start_relay_chain_local(plan, node["name"], node["port"]) + relay_detail["relay_service_" + node["name"]] = service_details + return relay_detail + def start_relay_chain_local(plan, name, port): exec_command = ["bin/sh", "-c", "polkadot --base-path=/data --chain=/app/rococo-local.json --validator --ws-external --rpc-external --rpc-cors=all --name=alice --{0} --rpc-methods=unsafe --execution=wasm".format(name)] - plan.add_service( + service_details = plan.add_service( name = "polkadot-{0}".format(name), config = ServiceConfig( image = "parity/polkadot:v0.9.31", @@ -42,3 +50,4 @@ def start_relay_chain_local(plan, name, port): entrypoint = exec_command, ), ) + return service_details