Skip to content
This repository was archived by the owner on Jun 20, 2024. It is now read-only.

Conversation

@hacdias
Copy link
Collaborator

@hacdias hacdias commented Feb 3, 2023

This is an initial version of the Bifrost Gateway, which I would like to merge as soon as possible so we can work on improving it. It has the main features we require so far.

External

go run . \
	--saturn-orchestrator "https://orchestrator.strn.pl/nodes/nearby" \
	--saturn-logger "https://twb3qukm2i654i3tnvx36char40aymqq.lambda-url.us-west-2.on.aws" \
	--kubo-rpc "https://node0.delegate.ipfs.io" \
	--kubo-rpc "https://node1.delegate.ipfs.io" \
	--kubo-rpc "https://node2.delegate.ipfs.io" \
	--kubo-rpc "https://node3.delegate.ipfs.io" \
	--gateway-port 8080 \
	--metrics-port 8040

@lidel lidel mentioned this pull request Feb 4, 2023
2 tasks
@hacdias hacdias self-assigned this Feb 6, 2023
@hacdias hacdias requested a review from lidel February 6, 2023 14:57
@hacdias hacdias changed the title wip: initial version feat: basic partially functional versionb Feb 7, 2023
@hacdias hacdias changed the title feat: basic partially functional versionb feat: basic partially functional version Feb 7, 2023
@hacdias hacdias force-pushed the initial-iteration branch 2 times, most recently from 8945536 to a701342 Compare February 7, 2023 14:16
- block store provided by saturn
- subdomain gateway support
- dnslink gateway support
- dnslink resolution
- ipns resolution delegated to /api/v0/routing/get
- /api/v0 redirected to randomly selected kubo node
@hacdias
Copy link
Collaborator Author

hacdias commented Feb 7, 2023

@lidel @aschmahmann we have a reasonable working version here with the minimum features we need. I think we should get this reviewed and merged and then iterate on it.

@hacdias hacdias marked this pull request as ready for review February 7, 2023 15:11
Copy link
Collaborator

@lidel lidel left a comment

Choose a reason for hiding this comment

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

Thank you @hacdias, this includes functional parity (paths, subdomains, dnslinks, same metrics as kubo), and should be a good starting point.

Merging to unblock other workstreams:

  • improving saturn client (namely, smart retries that use different PoP, which it is lacking atm: #16)
  • improving RPC delegation #13
  • docker image #11
  • more metrics #12
  • basic caching to avoid trashing blocks #15
  • etc

Comment on lines +114 to +116
func (api *bifrostGateway) GetIPNSRecord(ctx context.Context, c cid.Cid) ([]byte, error) {
return api.routing.GetValue(ctx, "/ipns/"+c.String())
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

@hacdias mind opening a PR that immediately errors if CID codec is other than libp2p-key?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

#17

// Naively choose one of the Kubo RPC clients.
endpoint := ps.kuboRPC[rand.Intn(len(ps.kuboRPC))]

u, err := url.Parse(fmt.Sprintf("%s/api/v0/routing/get?arg=%s", endpoint, key))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Comment on lines +167 to +169
// Naively choose one of the Kubo RPC clients.
endpoint := endpoints[rand.Intn(len(endpoints))]
http.Redirect(w, r, endpoint+r.URL.Path+"?"+r.URL.RawQuery, http.StatusFound)
Copy link
Collaborator

Choose a reason for hiding this comment

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

ℹ️ this will be refined in #13

@lidel lidel force-pushed the initial-iteration branch from b2ec980 to 200ed66 Compare February 8, 2023 03:46
@lidel lidel changed the title feat: basic partially functional version feat: initial functional version Feb 8, 2023
@lidel lidel merged commit edc8e70 into main Feb 8, 2023
@lidel lidel deleted the initial-iteration branch February 8, 2023 04:02
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants