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 67 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
ac63426
feat(relayminer): add `proxy.Ping(...)` capability to test connectivi…
eddyzags Aug 17, 2024
4b36c18
use dynamic slice in Ping error handling
eddyzags Aug 19, 2024
f8465c1
relayer: add godoc to configuration yaml
eddyzags Aug 31, 2024
2247aec
proxy: add comment explaining application logic
eddyzags Aug 31, 2024
d6d51e3
relayer: change Ping to PingAll in relayproxy interface
eddyzags Aug 31, 2024
90f437f
proxy: cleanup unused code
eddyzags Aug 31, 2024
1c20aa2
relayer: add godoc explaining ping http serve method
eddyzags Aug 31, 2024
6064831
relayer: remove blank line
eddyzags Aug 31, 2024
3c07ffe
localnet: add ping helpers for relayminers + logic to define supplier…
eddyzags Sep 25, 2024
6088199
use errors.Join instead of appending errors slice
eddyzags Nov 10, 2024
ffc2ef3
change c to httpClient in sychronous in relay server
eddyzags Nov 10, 2024
fbc9696
add relayer miner suppplier not reachable error
eddyzags Nov 10, 2024
49f5e05
add newpinghandlerfn function
eddyzags Nov 10, 2024
9abeb17
add comment relayminer test
eddyzags Nov 10, 2024
f399b8e
simplified newmockonetimerelayerproxywithping function
eddyzags Nov 10, 2024
a5ae8f1
revert Makefile and add local helpers
eddyzags Nov 10, 2024
5c293da
add 204 no content for ping response
eddyzags Nov 10, 2024
794e1b4
add comments to addr for ping config
eddyzags Nov 10, 2024
bc157c0
revert Makefile
eddyzags Nov 10, 2024
fad5ce2
fix typo
eddyzags Nov 10, 2024
272cf7b
add statuscode assertion while testing ping server
eddyzags Nov 10, 2024
d50655b
add localnet helpers to ping relayminer 1 2 3 + port exposition
eddyzags Nov 11, 2024
fdb19a5
add more context to synchrounous rpc ping error
eddyzags Nov 14, 2024
4862c15
change c to httpClient in relayminer tests
eddyzags Nov 14, 2024
340b828
add more context to transport override in relayminer tests
eddyzags Nov 14, 2024
120337c
add transport varialbe in relayminer tests
eddyzags Jan 12, 2025
62fc209
add 502 bad gateway as http code response for /ping
eddyzags Jan 12, 2025
a2aef02
add tcp listener to relayerminer pkg
eddyzags Jan 12, 2025
6854d12
fix code registration for ErrRelayerProxySupplierNotReachable
eddyzags Jan 13, 2025
70005e3
add endpointURL variable
eddyzags Jan 13, 2025
52016a0
improve godoc comments for pingconfig
eddyzags Jan 13, 2025
8febff7
fix serveping tests + refactor relayminer.ServePing function signature
eddyzags Jan 16, 2025
426333b
refactor: dynamically set values for relayminer suppliers list in Til…
eddyzags Jan 18, 2025
eb12baa
add pingall test suite
eddyzags Jan 19, 2025
9796134
add proxy different endpoints ping tests
eddyzags Jan 20, 2025
8b1e4e1
stabilize flaky helpers in testproxy
eddyzags Jan 20, 2025
abb22d4
add comments and refactor variable names
eddyzags Jan 21, 2025
0a468b7
fix typo in Tiltfile
eddyzags Jan 27, 2025
5c9e5f9
fix tyop
eddyzags Jan 27, 2025
f9e22f9
categorized as errors any HTTP status code higher or equal to 400
eddyzags Jan 27, 2025
d3ac840
improve error handling while serving http request for ping server
eddyzags Jan 27, 2025
30f05b9
distinguish 502 from 503 errors in ping handler for error handling
eddyzags Jan 27, 2025
48206b7
rely on testing temp dir for testing files
eddyzags Jan 27, 2025
bdf6fd4
improve relayminer configuration documentation
eddyzags Jan 27, 2025
2c0f0c1
improve error message for ping request
eddyzags Jan 28, 2025
8e4cb1a
minor fix
eddyzags Jan 28, 2025
ec24891
add comments to explain WithServiceConfigMap() function management to…
eddyzags Feb 2, 2025
257fb0a
rely on defaultService pkg level constant for ping test suite
eddyzags Feb 2, 2025
b9711d8
remove unused variable in synchrounous Ping method
eddyzags Feb 2, 2025
3879bb1
re-using supplierOperatorKeyName package level constant variable for …
eddyzags Feb 2, 2025
0bb603d
add two separate relay servers for all with multiple servers + improv…
eddyzags Feb 3, 2025
b86f096
remove unused variables
eddyzags Feb 3, 2025
5d38bb8
add TestRelayMiner_NOKPing unit test
eddyzags Feb 9, 2025
c60b902
refactor Relayminer ping test using suite
eddyzags Feb 9, 2025
fa82001
add optional to ping documentation
eddyzags Feb 9, 2025
56c4b0a
improve comments relayminer.serveping method
eddyzags Feb 15, 2025
e92e5d9
move ping makefile rules
eddyzags Feb 15, 2025
b7dc7b1
improve ping documentation description for relayminer
eddyzags Feb 15, 2025
a86a7c9
add note to explain suppliers overrides in helm for a relayminer
eddyzags Feb 15, 2025
30b327d
improve comment for testrelayer proxy withping
eddyzags Feb 15, 2025
fd80434
move comment for withservicesconfigmap listen and serve separation
eddyzags Feb 15, 2025
63647c5
improve comment for go routine launch for serveping
eddyzags Feb 15, 2025
97e8705
add redone todo
eddyzags Feb 15, 2025
a96751d
add detail for serve ping shutdown
eddyzags Feb 15, 2025
83304f5
fix linters
eddyzags Feb 16, 2025
c49624c
rely on net.Dial to test if the supplier is reachable
eddyzags Feb 16, 2025
3535314
fix import
eddyzags Feb 16, 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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,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 Expand Up @@ -470,3 +469,4 @@ include ./makefiles/gateways.mk
include ./makefiles/session.mk
include ./makefiles/claims.mk
include ./makefiles/relay.mk
include ./makefiles/ping.mk
44 changes: 39 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

Copy link
Member

Choose a reason for hiding this comment

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

@eddyzags This LGTM but #PUC in the code with your explanation related to Ping safeguard.

You already have it written down anyhow :)

Copy link
Author

Choose a reason for hiding this comment

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

Added a note here: f710d48

Original file line number Diff line number Diff line change
Expand Up @@ -264,21 +264,54 @@ 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",
],
]

#############
# NOTE: To provide a proper configuration for the relayminer, we dynamically
# define the supplier configuration overrides for the relayminer helm chart
# so that every service enabled in the localnet configuration (ollama, rest)
# file are also declared in the relayminer.config.suppliers list.
#############

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 +332,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` healh check 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.

:::
:::
4 changes: 3 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ require (
github.com/cosmos/ibc-go/v8 v8.2.0
github.com/go-kit/kit v0.13.0
github.com/gogo/status v1.1.0
github.com/golang/mock v1.6.0 // indirect
github.com/golang/mock v1.6.0
github.com/golang/protobuf v1.5.4
github.com/gorilla/mux v1.8.1
github.com/gorilla/websocket v1.5.3
Expand Down Expand Up @@ -82,6 +82,7 @@ require (

require (
cosmossdk.io/x/tx v0.13.8
github.com/foxcpp/go-mockdns v1.1.0
github.com/jhump/protoreflect v1.16.0
github.com/mitchellh/mapstructure v1.5.0
go.uber.org/mock v0.5.0
Expand Down Expand Up @@ -226,6 +227,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 @@ -500,6 +500,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 @@ -893,6 +895,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 @@ -1243,6 +1247,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 @@ -1284,6 +1291,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 @@ -1345,6 +1355,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.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE=
golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
Expand Down Expand Up @@ -1388,6 +1403,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 @@ -1487,13 +1506,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 @@ -1506,6 +1534,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 @@ -1577,6 +1609,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
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
21 changes: 21 additions & 0 deletions makefiles/ping.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
########################
### 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"
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

Copy link
Member

Choose a reason for hiding this comment

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

Let's make this change.

Copy link
Author

Choose a reason for hiding this comment

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

Based on this comment, I assume that @red-0ne will make the change.


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