Skip to content

Commit

Permalink
website custom data origin (#549)
Browse files Browse the repository at this point in the history
* add LinkDataAPI env to website service

* fix env name

* fix env name

* fix payload link

* add website env to readme

* Update README.md

Co-authored-by: shana <[email protected]>

---------

Co-authored-by: shana <[email protected]>
  • Loading branch information
sukoneck and avalonche authored Oct 31, 2023
1 parent 6a332c2 commit bce5669
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 3 deletions.
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,19 @@ redis-cli DEL boost-relay/sepolia:validators-registration boost-relay/sepolia:va
* `RUN_INTEGRATION_TESTS` - when set to "1" enables integration tests, currently used for testing Memcached using comma separated list of endpoints specified by `MEMCACHED_URIS`
* `TEST_DB_DSN` - specifies connection string using Data Source Name (DSN) for Postgres (default: postgres://postgres:postgres@localhost:5432/postgres?sslmode=disable)

#### Redis tuning
#### Redis Tuning

* `REDIS_CONNECTION_POOL_SIZE`, `REDIS_MIN_IDLE_CONNECTIONS`, `REDIS_READ_TIMEOUT_SEC`, `REDIS_POOL_TIMEOUT_SEC`, `REDIS_WRITE_TIMEOUT_SEC` (see also [the code here](https://github.com/flashbots/mev-boost-relay/blob/e39cd38010de26bf9a51d1a3e77fc235ea87b12f/datastore/redis.go#L35-L41))

#### Website

* `LINK_BEACONCHAIN` - url for beaconcha.in (default: `https://beaconcha.in`)
* `LINK_DATA_API` - origin url for data api (https://domain:port)
* `LINK_ETHERSCAN` - url for etherscan (default: `https://etherscan.io`)
* `LISTEN_ADDR` - listen address for webserver (default: `localhost:9060`)
* `RELAY_URL` - full url for the relay (https://pubkey@host)
* `SHOW_CONFIG_DETAILS` - when set to "1", logs configuration details

## Updating the website

* Edit the HTML in `services/website/website.html`
Expand Down
4 changes: 4 additions & 0 deletions cmd/website.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ var (
websiteDefaultShowConfigDetails = os.Getenv("SHOW_CONFIG_DETAILS") == "1"
websiteDefaultLinkBeaconchain = common.GetEnv("LINK_BEACONCHAIN", "https://beaconcha.in")
websiteDefaultLinkEtherscan = common.GetEnv("LINK_ETHERSCAN", "https://etherscan.io")
websiteDefaultLinkDataAPI = common.GetEnv("LINK_DATA_API", "")
websiteDefaultRelayURL = common.GetEnv("RELAY_URL", "")

websiteListenAddr string
Expand All @@ -25,6 +26,7 @@ var (

websiteLinkBeaconchain string
websiteLinkEtherscan string
websiteLinkDataAPI string
websiteRelayURL string
)

Expand All @@ -43,6 +45,7 @@ func init() {
websiteCmd.Flags().BoolVar(&websiteShowConfigDetails, "show-config-details", websiteDefaultShowConfigDetails, "show config details")
websiteCmd.Flags().StringVar(&websiteLinkBeaconchain, "link-beaconchain", websiteDefaultLinkBeaconchain, "url for beaconcha.in")
websiteCmd.Flags().StringVar(&websiteLinkEtherscan, "link-etherscan", websiteDefaultLinkEtherscan, "url for etherscan")
websiteCmd.Flags().StringVar(&websiteLinkDataAPI, "link-data-api", websiteDefaultLinkDataAPI, "origin url for data api (https://domain:port)")
websiteCmd.Flags().StringVar(&websiteRelayURL, "relay-url", websiteDefaultRelayURL, "full url for the relay (https://pubkey@host)")
}

Expand Down Expand Up @@ -110,6 +113,7 @@ var websiteCmd = &cobra.Command{
ShowConfigDetails: websiteShowConfigDetails,
LinkBeaconchain: websiteLinkBeaconchain,
LinkEtherscan: websiteLinkEtherscan,
LinkDataAPI: websiteLinkDataAPI,
RelayURL: websiteRelayURL,
}

Expand Down
1 change: 1 addition & 0 deletions services/website/html.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ type StatusHTMLData struct { //nolint:musttag
ShowConfigDetails bool
LinkBeaconchain string
LinkEtherscan string
LinkDataAPI string
RelayURL string
}

Expand Down
2 changes: 2 additions & 0 deletions services/website/website.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ type WebserverOpts struct {
ShowConfigDetails bool
LinkBeaconchain string
LinkEtherscan string
LinkDataAPI string
RelayURL string
}

Expand Down Expand Up @@ -110,6 +111,7 @@ func NewWebserver(opts *WebserverOpts) (*Webserver, error) {
ShowConfigDetails: opts.ShowConfigDetails,
LinkBeaconchain: opts.LinkBeaconchain,
LinkEtherscan: opts.LinkEtherscan,
LinkDataAPI: opts.LinkDataAPI,
RelayURL: opts.RelayURL,
}

Expand Down
5 changes: 3 additions & 2 deletions services/website/website.html
Original file line number Diff line number Diff line change
Expand Up @@ -248,11 +248,12 @@ <h2>
<tbody>
{{$linkBeaconchain := .LinkBeaconchain}}
{{$linkEtherscan := .LinkEtherscan}}
{{$linkDataAPI := .LinkDataAPI}}
{{ range .Payloads }}
<tr>
<td>{{.Epoch | prettyInt}}</td>
<td>
<a href="/relay/v1/data/bidtraces/proposer_payload_delivered?slot={{.Slot}}">{{.Slot | prettyInt}}</a>
<a href="{{$linkDataAPI}}/relay/v1/data/bidtraces/proposer_payload_delivered?slot={{.Slot}}">{{.Slot | prettyInt}}</a>
</td>
<td>{{.BlockNumber | prettyInt}}</td>
<td>{{.Value | weiToEth}}</td>
Expand All @@ -279,7 +280,7 @@ <h2>
<p>{{.NumPayloadsDelivered | prettyInt}} payloads delivered</p>
<p>
<small>
<a href="/relay/v1/data/bidtraces/proposer_payload_delivered?limit=10">Data API</a> &middot; <a href="https://flashbots-boost-relay-public.s3.us-east-2.amazonaws.com/index.html">Bulk Data</a> &middot; <a href="https://flashbots.notion.site/Relay-API-Spec-5fb0819366954962bc02e81cb33840f5#417abe417dde45caaff3dc15aaae65dd">Docs</a>
<a href="{{.LinkDataAPI}}/relay/v1/data/bidtraces/proposer_payload_delivered?limit=10">Data API</a> &middot; <a href="https://flashbots-boost-relay-public.s3.us-east-2.amazonaws.com/index.html">Bulk Data</a> &middot; <a href="https://flashbots.notion.site/Relay-API-Spec-5fb0819366954962bc02e81cb33840f5#417abe417dde45caaff3dc15aaae65dd">Docs</a>
</small>
</p>
</center>
Expand Down

0 comments on commit bce5669

Please sign in to comment.