Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[LocalNet] Run Relayer and AppGateServer #179

Merged
merged 6 commits into from
Nov 16, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,7 @@ RUN mv /poktroll/bin/poktrolld /usr/bin/poktrolld

EXPOSE 8545
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT: Adding a comment on what each exposed port is used for will go a long way!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Olshansk these will be changed soon, I'll prepare a doc for us to discuss the configs/ports and dependencies for different actors.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it. In that case, please see the suggested comment I left below.

okdas marked this conversation as resolved.
Show resolved Hide resolved
EXPOSE 8546
EXPOSE 8547
EXPOSE 8548

ENTRYPOINT ["ignite"]
45 changes: 30 additions & 15 deletions Tiltfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ load("ext://restart_process", "docker_build_with_restart")
load("ext://helm_resource", "helm_resource", "helm_repo")

# A list of directories where changes trigger a hot-reload of the sequencer
hot_reload_dirs = ["app", "cmd", "tools", "x"]
hot_reload_dirs = ["app", "cmd", "tools", "x", "pkg"]

# Create a localnet config file from defaults, and if a default configuration doesn't exist, populate it with default values
localnet_config_path = "localnet_config.yaml"
localnet_config_defaults = {
"relayers": {"count": 1},
"relayminers": {"count": 1},
"gateways": {"count": 1},
"appgateservers": {"count": 1},
# By default, we use the `helm_repo` function below to point to the remote repository
# but can update it to the locally cloned repo for testing & development
"helm_chart_local_repo": {"enabled": False, "path": "../helm-charts"},
Expand All @@ -25,16 +26,12 @@ if (localnet_config_file != localnet_config) or (

# Configure helm chart reference. If using a local repo, set the path to the local repo; otherwise, use our own helm repo.
helm_repo("pokt-network", "https://pokt-network.github.io/helm-charts/")
sequencer_chart = "pokt-network/poktroll-sequencer"
poktroll_chart = "pokt-network/poktroll"
chart_prefix = "pokt-network/"
if localnet_config["helm_chart_local_repo"]["enabled"]:
helm_chart_local_repo = localnet_config["helm_chart_local_repo"]["path"]
hot_reload_dirs.append(helm_chart_local_repo)
print("Using local helm chart repo " + helm_chart_local_repo)

sequencer_chart = helm_chart_local_repo + "/charts/poktroll-sequencer"
poktroll_chart = helm_chart_local_repo + "/charts/poktroll"

chart_prefix = helm_chart_local_repo + "/charts/"

# Import files into Kubernetes ConfigMap
def read_files_from_directory(directory):
Expand Down Expand Up @@ -114,20 +111,32 @@ k8s_yaml(
["localnet/kubernetes/celestia-rollkit.yaml", "localnet/kubernetes/anvil.yaml"]
)

# Run pocket-specific nodes (sequencer, relayers, etc...)
# Run pocket-specific nodes (sequencer, relayminers, etc...)
helm_resource(
"sequencer",
sequencer_chart,
chart_prefix + "poktroll-sequencer",
flags=["--values=./localnet/kubernetes/values-common.yaml"],
image_deps=["poktrolld"],
image_keys=[("image.repository", "image.tag")],
)
helm_resource(
"relayers",
poktroll_chart,
"relayminers",
chart_prefix + "relayminer",
flags=[
"--values=./localnet/kubernetes/values-common.yaml",
"--set=replicaCount=" + str(localnet_config["relayers"]["count"]),
"--values=./localnet/kubernetes/values-relayminer.yaml",
"--set=replicaCount=" + str(localnet_config["relayminers"]["count"]),
],
image_deps=["poktrolld"],
image_keys=[("image.repository", "image.tag")],
)
helm_resource(
"appgateservers",
chart_prefix + "appgate-server",
flags=[
"--values=./localnet/kubernetes/values-common.yaml",
"--values=./localnet/kubernetes/values-appgateserver.yaml",
"--set=replicaCount=" + str(localnet_config["appgateservers"]["count"]),
],
image_deps=["poktrolld"],
image_keys=[("image.repository", "image.tag")],
Expand All @@ -146,9 +155,15 @@ k8s_resource(
port_forwards=["36657", "40004"],
)
k8s_resource(
"relayers",
"relayminers",
labels=["blockchains"],
resource_deps=["sequencer"],
port_forwards=["8548", "40005"],
)
k8s_resource(
"appgateservers",
labels=["blockchains"],
resource_deps=["sequencer"],
port_forwards=["8545", "8546", "40005"],
port_forwards=["42069", "40006"],
)
k8s_resource("anvil", labels=["blockchains"], port_forwards=["8547"])
2 changes: 2 additions & 0 deletions localnet/kubernetes/values-appgateserver.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pocket:
node: sequencer-poktroll-sequencer
2 changes: 2 additions & 0 deletions localnet/kubernetes/values-relayminer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pocket:
node: sequencer-poktroll-sequencer