ipfs / kubo

An IPFS implementation in Go
https://docs.ipfs.tech/how-to/command-line-quick-start/
Other
16.2k stars 3.03k forks source link

Provide migration hint when running CLI (not-daemon) commands #5097

Open schomatis opened 6 years ago

schomatis commented 6 years ago

If I'm running a standalone command without the daemon and my repo needs a migration I don't get any hints about what to do (or how to do it), only when running the daemon I get an easy solution.

ipfs repo verify
# Error: ipfs repo needs migration

ipfs daemon
# Initializing daemon...
# Successfully raised file descriptor limit to 2048.
# Found outdated fs-repo, migrations need to be run.
# Run migrations now? [y/N] 
magik6k commented 5 years ago

I'm working on refactoring the go-ipfs initialization logic

With https://github.com/ipfs/go-ipfs/commit/cebc970ce4ceb829156484173ed2e972f3ba59cf user will see something like (the message can be improved):

Found outdated fs-repo, migrations need to be run.
Not running migrations of fs-repo now.
Please get fs-repo-migrations from https://dist.ipfs.io
melroy89 commented 3 years ago

Please, this is a big issue in my project. I want to run a daemon in the background, therefor IPFS should NOT ask for migrations/prompt during such a critical start-up process.

Daemon should not be blocked by user-input, that would be crazy! Maybe give a warning to stdout/stderr and continue!

melroy89 commented 3 years ago

Idea: add --ignore-migration would already help, I guess.

aschmahmann commented 3 years ago

@danger89 what you're looking for is https://github.com/ipfs/go-ipfs/issues/7471.

Having --ignore-migration cannot make any sense. A given version of go-ipfs is only able to work with a particular repo version, if it notices the repo version is different it automatically downloads and runs fs-repo-migrations to adjust the repo version to a compatible one.

If you'd like to run the migration without running ipfs daemon then you can run the migration manually as described in https://github.com/ipfs/go-ipfs/issues/7471#issuecomment-643558591.

Edit:

Daemon should not be blocked by user-input

If this is your concern you can just run ipfs daemon --migrate and then it won't be blocked by user input

melroy89 commented 3 years ago

Thanks for your really quick reply.

I noticed, so ipfs daemon --migrate is the only way to go. I see.

Although this was causing some issues somehow trying to download migration files. I was using std::system() and it was blocking on the download (basically forever). I don't know why. You can try it ourself in C/C++ std::system("ipfs daemon --init --migrate"); from cstdlib library or using the C style: fork() with/or execv() command. Migration only worked outside this call, like a normal terminal window under Linux.

aschmahmann commented 3 years ago

I noticed, so ipfs daemon --migrate is the only way to go. I see.

You can also download and run fs-repo-migrations manually when you upgrade the IPFS binary.

Migration only worked outside this call, like a normal terminal window under Linux.

My guess here is that this is something related to the permissions of your C binary. I'd recommend posting on discuss.ipfs.io as since this is more of a support than bug report issue people will be more likely to find the outcomes of the discussion there then on this issue when it gets closed (feel free to tag me on the forum).

This issue is really just a documentation issue then when running go-ipfs without a running daemon we should give the user more info about what to do than just Error: ipfs repo needs migration.