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

Show repository migration progress in go-ipfs 0.12+ #1940

Closed
lidel opened this issue Dec 15, 2021 · 4 comments · Fixed by #1982
Closed

Show repository migration progress in go-ipfs 0.12+ #1940

lidel opened this issue Dec 15, 2021 · 4 comments · Fixed by #1982
Assignees
Labels
exp/intermediate Prior experience is likely helpful kind/maintenance Work required to avoid breaking changes or harm to project's status quo need/triage Needs initial labeling and prioritization P1 High: Likely tackled by core team if no one steps up

Comments

@lidel
Copy link
Member

lidel commented Dec 15, 2021

Ref. brave/brave-browser#20106, ipfs/kubo#8344

@lidel lidel added need/triage Needs initial labeling and prioritization P1 High: Likely tackled by core team if no one steps up labels Dec 15, 2021
@lidel lidel pinned this issue Dec 15, 2021
@lidel
Copy link
Member Author

lidel commented Feb 11, 2022

How to test or simulate migration

One can create ~/.ipfs (IPFS_PATH with a repo that needs to be migrated) by:

  1. downloading go-ipfs v0.11
  2. executing IPFS_PATH=/migration-test ipfs init and IPFS_PATH=/migration-test ipfs add --cid-version 1 on some files
  3. downloading go-ipfs 0.12-rc1
  4. executing IPFS_PATH=/migration-test ipfs daemon --migrate=true with 0.12 binary

Wireframe

My initial idea is to have something very simple and generic:
(just an inspiration, implementer should feel free to course-correct as they go)

repo-migrations-2022-02-11_18-30

Key points

  • detects when go-ipfs runs a migration and inform user why it takes long to start IPFS Desktop

    • one sentence should be enough, most users do not care and will just dismiss and let it run in the background
  • shows stdout+stderr from ipfs daemon as a way to eyeball migration progress

    • 👉 we were lucky until now, could skip this for most migrations, but we have to have some progress indicator for 0.12 where migration may take anywhere from a few seconds/minutes to hours (if someone has a slow HDD and hosts hundreds of gigabytes of CIDv1 data such as wikipedia snapshots). showing the daemon output feels like the best we can do given existing APIs.
      • ℹ️ ipfsd-ctl pipes both stdout and stderr to debug logger – i wonder if we could read it somehow? In terminal I can do DEBUG="ipfsd-ctl:daemon:*" npm start and see the daemon output. I know that ipfs log tail also exists but it does not seem to be wired up to show migration log.
    • 💡 this could be useful outside migrations – we could show this window also when go-ipfs fails to start. Original error from ipfs daemon may allow more savvy users to self-service and fix basic problems.
  • easy to dismiss

    • one button that closes the info window
    • closing the window does not interrupt migration/startup process, it should continue in the background

@lidel
Copy link
Member Author

lidel commented Feb 11, 2022

@hacdias will you have time to poke at this sometime in next two weeks?
Not a fire, but we won't be able to ship ipfs-desktop 0.12 without this, and I am just planning ahead :)

@lidel lidel added kind/maintenance Work required to avoid breaking changes or harm to project's status quo exp/intermediate Prior experience is likely helpful need/maintainer-input labels Feb 11, 2022
@lidel lidel unpinned this issue Feb 16, 2022
@hacdias
Copy link
Member

hacdias commented Feb 17, 2022

@lidel yes, I can work on this. I can read the stdout and stderr in this way:

// define ipfsd

const interval = setInterval(() => {
    const sub = ipfsd.subprocess
    if (!sub) {
      return
    }

    sub.stdout.on('data', data => console.log(data.toString()))
    sub.stderr.on('data', data => console.log(data.toString()))
   	clearInterval(interval)
}, 100)

ipfsd.start()

However, .subprocess is undocumented and probably should't be directly used. Besides, the interval to try to get the subprocess variable between it is created and the daemon is actually created is a bit fiddly, but it works! I will try using this for now to implement the logging. Perhaps we should consider adding some API for this on IPFSD CTL later.

@lidel
Copy link
Member Author

lidel commented Feb 18, 2022

Thanks!

  • FYSA 0.12 got released, so you can test with official release now :)
  • subprocess is part of the public Controller interface, so I think it is safe to use for now
  • when we have a PR demonstrating our use case, we can ping Hugo to advise on improving the ipfsd-ctl API

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
exp/intermediate Prior experience is likely helpful kind/maintenance Work required to avoid breaking changes or harm to project's status quo need/triage Needs initial labeling and prioritization P1 High: Likely tackled by core team if no one steps up
Projects
No open projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants