Skip to content

Conversation

@mnaamani
Copy link
Member

@mnaamani mnaamani commented Sep 14, 2020

Storage Node:

Route new asset URL /asset/v1/{contentID} to the IPFS HTTP Gateway running on the storage node.
Routing /asset/v0/{contentId} path to the IPFS HTTP Gateway running on the storage node.

Currently the way the /asset/v0/ api works, handles range requests very inefficiently. Colossus opens a readable file stream and must read the stream to the point where it needs to 'seek' to return the requested range of bytes. This is due to a limitation in the streams api and lack of support for seeking in that stream. This was causing the storage node to consume a large amount of memory especially.

So the alternative solution was to just proxy the http requests for accessing content to the IPFS HTTP gateway.

Pioneer, Helios and the storage cli tool was updated to use the new endpoint.

For correct functioning of the proxy middle ware the ipfs gateway needs to be configured to use paths and not subdomains which is the default config.

The recommended configuration when used with colossus can be applied with this command. (daemon should be restarted to take affect):

ipfs config --json Gateway.PublicGateways '{"localhost": null }'

@mnaamani mnaamani marked this pull request as ready for review September 14, 2020 12:21
Copy link
Contributor

@shamil-gadelshin shamil-gadelshin left a comment

Choose a reason for hiding this comment

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

We should keep our architecture consistent, so please, refactor the 'middleware + path rewriting' approach of V1 to the Open API similar to existing V0.

@mnaamani
Copy link
Member Author

We should keep our architecture consistent, so please, refactor the 'middleware + path rewriting' approach of V1 to the Open API similar to existing V0.

Updated to stick with the open api structure.
Also added handling of downloading file as attachement.

We no longer have a dependency on the utils/ranges library so it can/should be removed in the future unless we find some other need for it.

Copy link
Contributor

@shamil-gadelshin shamil-gadelshin left a comment

Choose a reason for hiding this comment

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

LGTM

@shamil-gadelshin shamil-gadelshin merged commit 84871f2 into Joystream:iznik Sep 16, 2020
@mnaamani mnaamani deleted the colossus/route-to-ipfs-gateway branch March 3, 2022 20:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants