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

[RelayMiner]: add proxy.Ping(...) capability to test connectivity between relay servers and backend URLs #1037

Open
wants to merge 55 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
a31e8d5
feat(relayminer): add `proxy.Ping(...)` capability to test connectivi…
eddyzags Aug 17, 2024
ecbcb3e
use dynamic slice in Ping error handling
eddyzags Aug 19, 2024
54b79d1
relayer: add godoc to configuration yaml
eddyzags Aug 31, 2024
7bd3223
proxy: add comment explaining application logic
eddyzags Aug 31, 2024
0234978
relayer: change Ping to PingAll in relayproxy interface
eddyzags Aug 31, 2024
affc937
proxy: cleanup unused code
eddyzags Aug 31, 2024
9ddc62a
relayer: add godoc explaining ping http serve method
eddyzags Aug 31, 2024
8395970
relayer: remove blank line
eddyzags Aug 31, 2024
2df6479
localnet: add ping helpers for relayminers + logic to define supplier…
eddyzags Sep 25, 2024
d3710d8
use errors.Join instead of appending errors slice
eddyzags Nov 10, 2024
8830010
change c to httpClient in sychronous in relay server
eddyzags Nov 10, 2024
86976f1
add relayer miner suppplier not reachable error
eddyzags Nov 10, 2024
493884e
add newpinghandlerfn function
eddyzags Nov 10, 2024
1bf241e
add comment relayminer test
eddyzags Nov 10, 2024
c235232
simplified newmockonetimerelayerproxywithping function
eddyzags Nov 10, 2024
587cf44
revert Makefile and add local helpers
eddyzags Nov 10, 2024
44a6545
add 204 no content for ping response
eddyzags Nov 10, 2024
8fdd7e9
add comments to addr for ping config
eddyzags Nov 10, 2024
f9d636e
revert Makefile
eddyzags Nov 10, 2024
d94ead2
fix typo
eddyzags Nov 10, 2024
5153493
add statuscode assertion while testing ping server
eddyzags Nov 10, 2024
861bf35
add localnet helpers to ping relayminer 1 2 3 + port exposition
eddyzags Nov 11, 2024
4802e86
add more context to synchrounous rpc ping error
eddyzags Nov 14, 2024
fda1da3
change c to httpClient in relayminer tests
eddyzags Nov 14, 2024
499ee4e
add more context to transport override in relayminer tests
eddyzags Nov 14, 2024
26dad58
add transport varialbe in relayminer tests
eddyzags Jan 12, 2025
3d5128d
add 502 bad gateway as http code response for /ping
eddyzags Jan 12, 2025
9709983
add tcp listener to relayerminer pkg
eddyzags Jan 12, 2025
e3ed522
fix code registration for ErrRelayerProxySupplierNotReachable
eddyzags Jan 13, 2025
8130cf3
add endpointURL variable
eddyzags Jan 13, 2025
c164306
improve godoc comments for pingconfig
eddyzags Jan 13, 2025
239f2f1
fix serveping tests + refactor relayminer.ServePing function signature
eddyzags Jan 16, 2025
385b7e9
refactor: dynamically set values for relayminer suppliers list in Til…
eddyzags Jan 18, 2025
ad0f0a7
add pingall test suite
eddyzags Jan 19, 2025
fe6342a
add proxy different endpoints ping tests
eddyzags Jan 20, 2025
d7abf60
stabilize flaky helpers in testproxy
eddyzags Jan 20, 2025
e35986e
add comments and refactor variable names
eddyzags Jan 21, 2025
dd6b7e8
fix typo in Tiltfile
eddyzags Jan 27, 2025
ad39a0c
fix tyop
eddyzags Jan 27, 2025
7f21be9
categorized as errors any HTTP status code higher or equal to 400
eddyzags Jan 27, 2025
446d2f2
improve error handling while serving http request for ping server
eddyzags Jan 27, 2025
d2ade64
distinguish 502 from 503 errors in ping handler for error handling
eddyzags Jan 27, 2025
53ca20e
rely on testing temp dir for testing files
eddyzags Jan 27, 2025
39d1458
improve relayminer configuration documentation
eddyzags Jan 27, 2025
07361b9
improve error message for ping request
eddyzags Jan 28, 2025
0c11e02
minor fix
eddyzags Jan 28, 2025
8988335
add comments to explain WithServiceConfigMap() function management to…
eddyzags Feb 2, 2025
2947c2b
rely on defaultService pkg level constant for ping test suite
eddyzags Feb 2, 2025
baa9b61
remove unused variable in synchrounous Ping method
eddyzags Feb 2, 2025
3800411
re-using supplierOperatorKeyName package level constant variable for …
eddyzags Feb 2, 2025
acdd9d1
add two separate relay servers for all with multiple servers + improv…
eddyzags Feb 3, 2025
2f2d9cc
remove unused variables
eddyzags Feb 3, 2025
f4027a5
add TestRelayMiner_NOKPing unit test
eddyzags Feb 9, 2025
6b27a83
refactor Relayminer ping test using suite
eddyzags Feb 9, 2025
cc573c7
add optional to ping documentation
eddyzags Feb 9, 2025
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
24 changes: 23 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,29 @@ proto_clean_pulsar: ## TODO_TECHDEBT(@bryanchriswhite): Add a proper explanation
.PHONY: proto_regen
proto_regen: proto_clean proto_ignite_gen proto_fix_self_import ## Regenerate protobuf artifacts

########################
### Localnet Helpers ###
########################

.PHONY: localnet_relayminer1_ping
localnet_relayminer1_ping:
@echo "Pinging relayminer 1..."
@curl -X GET localhost:7001 || (echo "Failed to ping relayminer1. Make sure your localnet environment or the relayminer 1 pod is up and running"; exit 1)
@echo "OK"

.PHONY: localnet_relayminer2_ping
localnet_relayminer2_ping:
@echo "Pinging relayminer 2..."
@curl -X GET localhost:7002 || (echo "Failed to ping relayminer2. Make sure your localnet environment or the relayminer 2 pod is up and running"; exit 1)
@echo "OK"

.PHONY: localnet_relayminer3_ping
localnet_relayminer3_ping:
@echo "Pinging relayminer 3..."
@curl -X GET localhost:7003 || (echo "Failed to ping relayminer3. Make sure your localnet environment or the relayminer 3 pod is up and running"; exit 1)
@echo "OK"


#######################
### Docker Helpers ###
#######################
Expand Down Expand Up @@ -404,7 +427,6 @@ act_reviewdog: check_act check_gh ## Run the reviewdog workflow locally like so:
@echo "Detected architecture: $(CONTAINER_ARCH)"
act -v -s GITHUB_TOKEN=$(GITHUB_TOKEN) -W .github/workflows/reviewdog.yml --container-architecture $(CONTAINER_ARCH)


###########################
### Release Helpers ###
###########################
Expand Down
37 changes: 32 additions & 5 deletions Tiltfile
Copy link
Contributor

@bryanchriswhite bryanchriswhite Jan 24, 2025

Choose a reason for hiding this comment

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

Was this change intentionally persisted, and if so, how is it related to this feature?

I think this change should be reverted. My assumption is that this is the result of an older commit which was never reconciled completely with main:

  1. The yaml files referenced don't exist.
  2. The flags seem to be specifying the same/similar config as what's been removed from the relayminer configs that do exist. 🤔

Copy link
Author

Choose a reason for hiding this comment

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

Sorry, I wasn't clear in my previous comments.

Was this change intentionally persisted, and if so, how is it related to this feature?

Yes, this change was intentionally made to ensure the Ping safeguard at startup succeeds for the Relayminer with the localnet default configuration, and/or any custom localnet configuration in that regard (link to localnet default configuration in the main branch). In the default localnet configuration, the Ollama Kubernetes deployment is not applied (ollama.enabled=false). However, the relayminer configuration still referenced Ollama suppliers in its configuration files, even though the container wasn’t deployed (link to relayminer-1 configuration for localnet). With the newly introduced mechanism of the Ping safeguard at startup, this will cause the relayminer to fail continuously because the Ollama container isn't deployed.

To solve this issue, I found a way to dynamically define the relayminer's configuration based on the localnet configuration by modifying the poktrolld/Tiltfile. Hence, those modifications.

For poktrolld users that are deploying a Relayminer without relying on the localnet, they will have to make sure that their config.suppliers[*].service_config.backend_url are up and running and reachable before deploying a Relayminer.

The yaml files referenced don't exist.

I disagree, they exists:

The flags seem to be specifying the same/similar config as what's been removed from the relayminer configs that do exist.

I cannot find that. Can you link me to the precise line in my fork that makes you think that please? 🙏🏾

Copy link
Contributor

Choose a reason for hiding this comment

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

@eddyzags thanks for the detailed response here! 🙌

  1. The yaml files referenced don't exist.

I was referring to .yaml files referenced in this commit, but I also see that they're not referenced any more. I just didn't understand the rationale behind moving the config into the Tiltfile.

(@okdas @red-0ne thoughts?)

The flags seem to be specifying the same/similar config as what's been removed from the relayminer configs that do exist.

I was just pointing out that the config fields which you've removed from the relayminer configs correspond to the flags you've added in the Tiltfile. The point being, to question why should we prefer to provide the config via flags over the yaml file, which you answered.

Copy link
Author

Choose a reason for hiding this comment

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

Got it, Bryan; I am glad it was clear. Waiting for @okdas and @red-0ne feedback. I am open to suggestions

Original file line number Diff line number Diff line change
Expand Up @@ -264,21 +264,47 @@ helm_resource(
actor_number = 0
for x in range(localnet_config["relayminers"]["count"]):
actor_number = actor_number + 1
helm_resource(
"relayminer" + str(actor_number),
chart_prefix + "relayminer",
flags=[

flags=[
"--values=./localnet/kubernetes/values-common.yaml",
"--values=./localnet/kubernetes/values-relayminer-common.yaml",
"--values=./localnet/kubernetes/values-relayminer-" + str(actor_number) + ".yaml",
"--set=metrics.serviceMonitor.enabled=" + str(localnet_config["observability"]["enabled"]),
"--set=development.delve.enabled=" + str(localnet_config["relayminers"]["delve"]["enabled"]),
"--set=logLevel=" + str(localnet_config["relayminers"]["logs"]["level"]),
"--set=image.repository=poktrolld",
],
]

supplier_number = 0

flags.append("--set=config.suppliers["+str(supplier_number)+"].service_id=anvil")
flags.append("--set=config.suppliers["+str(supplier_number)+"].listen_url=http://0.0.0.0:8545")
flags.append("--set=config.suppliers["+str(supplier_number)+"].service_config.backend_url=http://anvil:8547/")
flags.append("--set=config.suppliers["+str(supplier_number)+"].service_config.publicly_exposed_endpoints[0]=relayminer"+str(actor_number))
supplier_number = supplier_number + 1

if localnet_config["rest"]["enabled"]:
flags.append("--set=config.suppliers["+str(supplier_number)+"].service_id=rest")
flags.append("--set=config.suppliers["+str(supplier_number)+"].listen_url=http://0.0.0.0:8545")
flags.append("--set=config.suppliers["+str(supplier_number)+"].service_config.backend_url=http://rest:10000/")
flags.append("--set=config.suppliers["+str(supplier_number)+"].service_config.publicly_exposed_endpoints[0]=relayminer"+str(actor_number))
supplier_number = supplier_number + 1

if localnet_config["ollama"]["enabled"]:
flags.append("--set=config.suppliers["+str(supplier_number)+"].service_id=ollama")
flags.append("--set=config.suppliers["+str(supplier_number)+"].listen_url=http://0.0.0.0:8545")
flags.append("--set=config.suppliers["+str(supplier_number)+"].service_config.backend_url=http://ollama:11434/")
flags.append("--set=config.suppliers["+str(supplier_number)+"].service_config.publicly_exposed_endpoints[0]=relayminer"+str(actor_number))
supplier_number = supplier_number + 1

helm_resource(
"relayminer" + str(actor_number),
chart_prefix + "relayminer",
flags=flags,
image_deps=["poktrolld"],
image_keys=[("image.repository", "image.tag")],
)

k8s_resource(
"relayminer" + str(actor_number),
labels=["suppliers"],
Expand All @@ -299,6 +325,7 @@ for x in range(localnet_config["relayminers"]["count"]):
# Use with pprof like this: `go tool pprof -http=:3333 http://localhost:6070/debug/pprof/goroutine`
str(6069 + actor_number)
+ ":6060", # Relayminer pprof port. relayminer1 - exposes 6070, relayminer2 exposes 6071, etc.
str(7000 + actor_number) + ":8081", # Relayminer ping port. relayminer1 - exposes 7001, relayminer2 exposes 7002, etc.
],
)

Expand Down
20 changes: 19 additions & 1 deletion docusaurus/docs/operate/configs/relayminer_config.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ You can find a fully featured example configuration at [relayminer_config_full_e
- [`smt_store_path`](#smt_store_path)
- [`metrics`](#metrics)
- [`pprof`](#pprof)
- [`ping`](#ping)
- [Pocket node connectivity](#pocket-node-connectivity)
- [`query_node_rpc_url`](#query_node_rpc_url)
- [`query_node_grpc_url`](#query_node_grpc_url)
Expand Down Expand Up @@ -173,6 +174,23 @@ pprof:

You can learn how to use that endpoint on the [Performance Troubleshooting](../../develop/developer_guide/performance_troubleshooting.md) page.

### `ping`

_`Optional`_

Configures a `ping` server to test the connectivity of all backend URLs. If
all the backend URLs are reachable, the endpoint returns a 204 HTTP
Code. If one or more backend URLs aren't reachable, the service
returns an appropriate HTTP error.

Example configuration:

```yaml
ping:
enabled: true
addr: localhost:8081
```

## Pocket node connectivity

```yaml
Expand Down Expand Up @@ -528,4 +546,4 @@ can disrupt the operator’s participation in the Pocket Network. To maintain a
smooth operation, avoid being slashed, and earn your rewards, operators must plan
and manage their account balance as part of their operational procedures.

:::
:::
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ require (

require (
cosmossdk.io/x/tx v0.13.4
github.com/foxcpp/go-mockdns v1.1.0
github.com/jhump/protoreflect v1.16.0
github.com/mitchellh/mapstructure v1.5.0
)
Expand Down Expand Up @@ -223,6 +224,7 @@ require (
github.com/manifoldco/promptui v0.9.0 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/miekg/dns v1.1.57 // indirect
github.com/minio/highwayhash v1.0.2 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
Expand Down
35 changes: 35 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,8 @@ github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2
github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw=
github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g=
github.com/foxcpp/go-mockdns v1.1.0 h1:jI0rD8M0wuYAxL7r/ynTrCQQq0BVqfB99Vgk7DlmewI=
github.com/foxcpp/go-mockdns v1.1.0/go.mod h1:IhLeSFGed3mJIAXPH2aiRQB+kqz7oqu8ld2qVbOu7Wk=
github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4=
github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2rbfLwlschooIH4+wKKDR4Pdxhh+TRoA20=
github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8=
Expand Down Expand Up @@ -889,6 +891,8 @@ github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzp
github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
github.com/miekg/dns v1.1.57 h1:Jzi7ApEIzwEPLHWRcafCN9LZSBbqQpxjt/wpgvg7wcM=
github.com/miekg/dns v1.1.57/go.mod h1:uqRjCRUuEAA6qsOiJvDd+CFo/vW+y5WR6SNmHE55hZk=
github.com/minio/highwayhash v1.0.2 h1:Aak5U0nElisjDCfPSG79Tgzkn2gl66NxOMspRrKnA/g=
github.com/minio/highwayhash v1.0.2/go.mod h1:BQskDq+xkJ12lmlUUi7U0M5Swg3EWR+dLTk+kldvVxY=
github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc=
Expand Down Expand Up @@ -1235,6 +1239,9 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc=
golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4=
golang.org/x/crypto v0.15.0/go.mod h1:4ChreQoLWfG3xLDer1WdlH5NdlQ3+mwnQq1YTKY+72g=
golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U=
golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
Expand Down Expand Up @@ -1276,6 +1283,9 @@ golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/mod v0.19.0 h1:fEdghXQSo20giMthA7cd28ZC+jts4amQ3YMXiP5oMQ8=
golang.org/x/mod v0.19.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
Expand Down Expand Up @@ -1337,6 +1347,11 @@ golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug
golang.org/x/net v0.0.0-20220909164309-bea034e7d591/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk=
golang.org/x/net v0.0.0-20221014081412-f15817d10f9b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk=
golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco=
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk=
golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE=
golang.org/x/net v0.18.0/go.mod h1:/czyP5RqHAH4odGYxBJ1qz0+CE5WZ+2j1YgoEo8F2jQ=
golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys=
golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
Expand Down Expand Up @@ -1380,6 +1395,10 @@ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJ
golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220929204114-8fcdb60fdcc0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
golang.org/x/sync v0.4.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ=
golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
Expand Down Expand Up @@ -1479,13 +1498,22 @@ golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20221010170243-090e33056c14/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA=
golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=
golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU=
golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U=
golang.org/x/term v0.14.0/go.mod h1:TySc+nGkYR6qt8km8wUhuFRTVSMIX3XPR58y2lC8vww=
golang.org/x/term v0.27.0 h1:WP60Sv1nlK1T6SupCHbXzSaN0b9wUmsPoRS9b61A23Q=
golang.org/x/term v0.27.0/go.mod h1:iMsnZpn0cago0GOrHO2+Y7u7JPn5AylBrcoWkElMTSM=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
Expand All @@ -1498,6 +1526,10 @@ golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo=
golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
Expand Down Expand Up @@ -1569,6 +1601,9 @@ golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58=
golang.org/x/tools v0.15.0/go.mod h1:hpksKq4dtpQWS1uQ61JkdqWM3LscIS6Slf+VVkm+wQk=
golang.org/x/tools v0.23.0 h1:SGsXPZ+2l4JsgaCKkx+FQ9YZ5XEtA1GZYuoDjenLjvg=
golang.org/x/tools v0.23.0/go.mod h1:pnu6ufv6vQkll6szChhK3C3L/ruaIv5eBeztNG8wtsI=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
Expand Down
20 changes: 1 addition & 19 deletions localnet/kubernetes/values-relayminer-1.yaml
bryanchriswhite marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,4 @@ config:
signing_key_name: supplier1

default_signing_key_names: [supplier1]
suppliers:
- service_id: anvil
listen_url: http://0.0.0.0:8545
service_config:
backend_url: http://anvil:8547/
publicly_exposed_endpoints:
- relayminer1
- service_id: ollama
listen_url: http://0.0.0.0:8545
service_config:
backend_url: http://ollama:11434/
publicly_exposed_endpoints:
- relayminer1
- service_id: rest
listen_url: http://0.0.0.0:8545
service_config:
backend_url: http://rest:10000/
publicly_exposed_endpoints:
- relayminer1
suppliers: [] # suppliers list is dynamically defined in poktroll/Tiltfile.
eddyzags marked this conversation as resolved.
Show resolved Hide resolved
14 changes: 1 addition & 13 deletions localnet/kubernetes/values-relayminer-2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,4 @@ config:
signing_key_name: supplier2

default_signing_key_names: [supplier2]
suppliers:
- service_id: anvil
listen_url: http://0.0.0.0:8545
service_config:
backend_url: http://anvil:8547/
publicly_exposed_endpoints:
- relayminer2
- service_id: ollama
listen_url: http://0.0.0.0:8545
service_config:
backend_url: http://ollama:11434/
publicly_exposed_endpoints:
- relayminer2
suppliers: [] # suppliers list is dynamically defined in poktroll/Tiltfile.
14 changes: 1 addition & 13 deletions localnet/kubernetes/values-relayminer-3.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,4 @@ config:
signing_key_name: supplier3

default_signing_key_names: [supplier3]
suppliers:
- service_id: anvil
listen_url: http://0.0.0.0:8545
service_config:
backend_url: http://anvil:8547/
publicly_exposed_endpoints:
- relayminer3
- service_id: ollama
listen_url: http://0.0.0.0:8545
service_config:
backend_url: http://ollama:11434/
publicly_exposed_endpoints:
- relayminer3
suppliers: [] # suppliers list is dynamically defined in poktroll/Tiltfile.
3 changes: 3 additions & 0 deletions localnet/kubernetes/values-relayminer-common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@ config:
pprof:
enabled: true
addr: localhost:6060
ping:
enabled: true
addr: localhost:8081
3 changes: 3 additions & 0 deletions localnet/poktrolld/config/relayminer_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,6 @@ suppliers:
pprof:
enabled: false
addr: localhost:6060
ping:
enabled: false
addr: localhost:8082
6 changes: 6 additions & 0 deletions localnet/poktrolld/config/relayminer_config_full_example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ pprof:
enabled: false
addr: localhost:6060

# Ping server configuration to test the connectivity of every
# suppliers.[].service_config.backend_url
ping:
enabled: false
addr: localhost:8081

pocket_node:
# Pocket node URL exposing the CometBFT JSON-RPC API.
# Used by the Cosmos client SDK, event subscriptions, etc.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,6 @@ suppliers:
pprof:
enabled: false
addr: localhost:6070
ping:
enabled: false
addr: localhost:8081
6 changes: 6 additions & 0 deletions pkg/relayer/cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,12 @@ func runRelayer(cmd *cobra.Command, _ []string) error {
}
}

if relayMinerConfig.Ping.Enabled {
if err := relayMiner.ServePing(ctx, "tcp", relayMinerConfig.Ping.Addr); err != nil {
return fmt.Errorf("failed to start ping endpoint: %w", err)
}
}

// Start the relay miner
logger.Info().Msg("Starting relay miner...")
if err := relayMiner.Start(ctx); err != nil && !errors.Is(err, http.ErrServerClosed) {
Expand Down
5 changes: 5 additions & 0 deletions pkg/relayer/config/relayminer_configs_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ func ParseRelayMinerConfigs(configContent []byte) (*RelayMinerConfig, error) {
Addr: yamlRelayMinerConfig.Pprof.Addr,
}

relayMinerConfig.Ping = &RelayMinerPingConfig{
Enabled: yamlRelayMinerConfig.Ping.Enabled,
Addr: yamlRelayMinerConfig.Ping.Addr,
}
Comment on lines +45 to +48
Copy link
Contributor

Choose a reason for hiding this comment

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

This would then reduce:

Suggested change
relayMinerConfig.Ping = &RelayMinerPingConfig{
Enabled: yamlRelayMinerConfig.Ping.Enabled,
Addr: yamlRelayMinerConfig.Ping.Addr,
}
relayMinerConfig.Ping = &yamlRelayMinerConfig.Ping


// Hydrate the pocket node urls
if err := relayMinerConfig.HydratePocketNodeUrls(&yamlRelayMinerConfig.PocketNode); err != nil {
return nil, err
Expand Down
Loading