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

How to bundle webui with companion and desktop? #843

Closed
lidel opened this issue Oct 1, 2018 · 6 comments
Closed

How to bundle webui with companion and desktop? #843

lidel opened this issue Oct 1, 2018 · 6 comments
Labels
kind/discussion Topical discussion; usually not changes to codebase P1 High: Likely tackled by core team if no one steps up

Comments

@lidel
Copy link
Member

lidel commented Oct 1, 2018

We want to ship Web UI with both Companion and Desktop.
Goal: speed and ensuring it works in offline environments.

Some options I see:

  • (A) build it from source every time
    • Slows down the build of Companion/Desktop
    • Prone to errors (different builds of the same webui revision, harder to debug)
  • (B) Use prebuilt artifact and download it during the build of Companion/Desktop.
    • (B1) from npm (requires publishing to npm)
    • (B2) from IPFS (may be easier, could be automated to the point of being transparent, eg. setup Jenkins so it builds every revision and adds it to IPFS)
  • (C) Do not bundle any data, open it from IPFS address (like go-ipfs)
    • The problem is offline mode. It could be solved if we get go-ipfs to ship with specific CIDs being preloaded, which could remove the need of bundling it with Companion and Desktop at a cost of increasing size of go-ipfs.

Related Work

@lidel lidel added question kind/discussion Topical discussion; usually not changes to codebase P1 High: Likely tackled by core team if no one steps up labels Oct 1, 2018
@hacdias
Copy link
Member

hacdias commented Oct 1, 2018

@lidel I'd go preferably for B. Either B1 or B2 would work well, although B1 would be simpler to bundle. For B2, we'd need a way to know the latest revision and download it on build time.

@lidel
Copy link
Member Author

lidel commented Oct 1, 2018

B1 is a little bit easier for consumers, but every update would require a new npm release.
B2 may be easier, because it does not require release and... is already done 💃

@olizilla mentioned today that Jenkins already builds it to update http://webui.ipfs.io
So I checked Jenkins and its all there. We can just copy CID from logs at:

Scroll down to:

New website: https://ipfs.io/ipfs/Qmar7PEjn6YMw1VyYztdfGBELHCFqVz8yK2n5ycrXftP82

To keep things simple, for now we could just curl it in our build scripts to download compressed ~7MB archive (uncompressed is ~24MB):

curl -s "https://ipfs.io/api/v0/get?arg=/ipfs/Qmar7PEjn6YMw1VyYztdfGBELHCFqVz8yK2n5ycrXftP82&archive=true&compress=true" > webui.tar.gz

@hacdias
Copy link
Member

hacdias commented Oct 1, 2018

@lidel don't forget that, for Desktop, we need a cross-platform script (that does work on Windows when building so using curl and tar -xvf aren't options).

I can do a Node script to fetch data from:

https://ci.ipfs.team/job/IPFS%20Shipyard/job/ipfs-webui/job/master/lastSuccessfulBuild/consoleText

Then, find the correct line and download it. Not as easy as it would be with a shell script, but doable

@hacdias
Copy link
Member

hacdias commented Oct 1, 2018

And I wonder how much stable is the public API right now. I just tried to download it multiple times and it always failed: the speed started decreasing to 0 after downloading 1/2 MB.

And how's it possible to be 24 MB? Isn't that oversized? Source maps!

@lidel
Copy link
Member Author

lidel commented Oct 4, 2018

I went with B2 for now and created some orchestration for fetching prebuilt webui from IPFS + fallback to HTTP:

@hacdias
Copy link
Member

hacdias commented Oct 3, 2019

I think this is an ended discussion for now :)

@hacdias hacdias closed this as completed Oct 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/discussion Topical discussion; usually not changes to codebase P1 High: Likely tackled by core team if no one steps up
Projects
None yet
Development

No branches or pull requests

2 participants