2020-08-19 05:23:00 -07:00
|
|
|
config.define_string("num", False, "Number of guardian nodes to run")
|
|
|
|
cfg = config.parse()
|
|
|
|
num_guardians = int(cfg.get("num", "5"))
|
|
|
|
|
2020-08-15 13:14:24 -07:00
|
|
|
# protos
|
|
|
|
|
|
|
|
local_resource(
|
|
|
|
name = "proto-gen",
|
2020-08-20 09:42:46 -07:00
|
|
|
deps = ["./proto", "./generate-protos.sh"],
|
2020-08-17 14:01:59 -07:00
|
|
|
cmd = "./generate-protos.sh",
|
2020-08-15 13:14:24 -07:00
|
|
|
)
|
|
|
|
|
|
|
|
# bridge
|
|
|
|
|
|
|
|
docker_build(
|
|
|
|
ref = "guardiand-image",
|
|
|
|
context = "bridge",
|
|
|
|
dockerfile = "bridge/Dockerfile",
|
|
|
|
)
|
|
|
|
|
2020-08-19 05:23:00 -07:00
|
|
|
def build_bridge_yaml():
|
|
|
|
bridge_yaml = read_yaml_stream("devnet/bridge.yaml")
|
|
|
|
|
|
|
|
for obj in bridge_yaml:
|
2020-08-20 09:56:35 -07:00
|
|
|
if obj["kind"] == "StatefulSet" and obj["metadata"]["name"] == "guardian":
|
|
|
|
obj["spec"]["replicas"] = num_guardians
|
|
|
|
container = obj["spec"]["template"]["spec"]["containers"][0]
|
|
|
|
if container["name"] != "guardiand":
|
2020-08-19 05:23:00 -07:00
|
|
|
fail("container 0 is not guardiand")
|
2020-10-28 14:41:38 -07:00
|
|
|
container["command"] += ["--devNumGuardians", str(num_guardians)]
|
2020-08-19 05:23:00 -07:00
|
|
|
|
|
|
|
return encode_yaml_stream(bridge_yaml)
|
|
|
|
|
|
|
|
k8s_yaml(build_bridge_yaml())
|
2020-08-15 13:14:24 -07:00
|
|
|
|
2020-08-20 09:56:26 -07:00
|
|
|
k8s_resource("guardian", resource_deps = ["proto-gen"])
|
2020-08-15 13:14:24 -07:00
|
|
|
|
2020-08-20 09:56:26 -07:00
|
|
|
# solana agent and cli (runs alongside bridge)
|
2020-08-15 13:14:24 -07:00
|
|
|
|
|
|
|
docker_build(
|
|
|
|
ref = "solana-agent",
|
|
|
|
context = ".",
|
|
|
|
only = ["./proto", "./solana"],
|
|
|
|
dockerfile = "Dockerfile.agent",
|
2020-08-16 06:02:11 -07:00
|
|
|
|
|
|
|
# Ignore target folders from local (non-container) development.
|
|
|
|
ignore = ["./solana/target", "./solana/agent/target", "./solana/cli/target"],
|
2020-08-15 13:14:24 -07:00
|
|
|
)
|
2020-08-15 14:54:44 -07:00
|
|
|
|
2020-08-20 09:56:26 -07:00
|
|
|
# solana smart contract
|
|
|
|
|
|
|
|
docker_build(
|
|
|
|
ref = "solana-contract",
|
|
|
|
context = "solana",
|
|
|
|
dockerfile = "solana/Dockerfile",
|
|
|
|
)
|
|
|
|
|
2020-08-15 14:54:44 -07:00
|
|
|
# solana local devnet
|
|
|
|
|
|
|
|
docker_build(
|
|
|
|
ref = "solana-devnet",
|
|
|
|
context = "third_party/solana",
|
|
|
|
dockerfile = "third_party/solana/Dockerfile",
|
|
|
|
)
|
|
|
|
|
|
|
|
k8s_yaml("devnet/solana-devnet.yaml")
|
|
|
|
|
|
|
|
k8s_resource("solana-devnet")
|
2020-08-15 16:38:10 -07:00
|
|
|
|
|
|
|
# eth devnet
|
|
|
|
|
|
|
|
docker_build(
|
|
|
|
ref = "eth-node",
|
2020-08-16 03:10:03 -07:00
|
|
|
context = "./ethereum",
|
|
|
|
dockerfile = "./ethereum/Dockerfile",
|
2020-08-16 02:17:35 -07:00
|
|
|
|
2020-08-16 03:10:03 -07:00
|
|
|
# ignore local node_modules (in case they're present)
|
|
|
|
ignore = ["./ethereum/node_modules"],
|
2020-08-17 07:31:48 -07:00
|
|
|
|
|
|
|
# sync external scripts for incremental development
|
|
|
|
# (everything else needs to be restarted from scratch for determinism)
|
|
|
|
#
|
|
|
|
# This relies on --update-mode=exec to work properly with a non-root user.
|
|
|
|
# https://github.com/tilt-dev/tilt/issues/3708
|
|
|
|
live_update = [
|
|
|
|
sync("./ethereum/src", "/home/node/app/src"),
|
|
|
|
],
|
2020-08-15 16:38:10 -07:00
|
|
|
)
|
|
|
|
|
|
|
|
k8s_yaml("devnet/eth-devnet.yaml")
|
|
|
|
|
|
|
|
k8s_resource("eth-devnet")
|