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

IPFS: use ipfs binary instead of library #1653

Merged
merged 1 commit into from
Dec 22, 2022
Merged

Conversation

ktock
Copy link
Member

@ktock ktock commented Dec 14, 2022

Fixes: #1578

This commit reduces dependencies for ipfs library by using ipfs binary.
nerdctl ipfs registry up and nerdctl ipfs registry down now uses systemd for managing nerdctl ipfs registry serve because it now depends on ipfs command available on the host rootfs.

  • TODO
    • agreement on design
    • update examples will be done after we release the next version
    • remove github.com/ipfs/go-cid v0.3.2 (CID parser) dependency (following up PR?)
      • ~~We need to reimplement the parser to remove that dependency. ~~

@AkihiroSuda
Copy link
Member

Thanks, you can retain go-cid and call it a day

@AkihiroSuda AkihiroSuda added this to the v1.2.0 (tentative) milestone Dec 16, 2022
c, err := cid.Decode(lines[len(lines)-2])
assert.NilError(t, err)
return "ipfs://" + c.String()
return "ipfs://" + lines[len(lines)-2]
}

func requiresIPFS(t *testing.T) {
Copy link
Member

Choose a reason for hiding this comment

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

docs/ipfs.md Outdated
@@ -159,14 +167,19 @@ When you specify `--ipfs` option to `nerdctl build`, it automatically starts the
By default, nerdctl exposes the registry at `localhost:5050`.
You can change the address and can manually restart the registry using `nerdctl ipfs registry up` and `nerdctl ipfs registry down`.

To make these commands work correctly, you need to install `nerdctl ipfs registry serve` command as a systemd service named `nerdctl-ipfs-registry-serve`.
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we can have a sample systemd service file that can be used directly by users?

@AkihiroSuda AkihiroSuda added the area/ipfs IPFS label Dec 18, 2022
@ktock ktock force-pushed the kubo-bin branch 2 times, most recently from efc03a3 to cd9f43c Compare December 19, 2022 15:05
@ktock ktock marked this pull request as ready for review December 19, 2022 23:32
Description=nerdctl ipfs registry for integration test

[Service]
EnvironmentFile=/run/nerdctl-ipfs-registry-serve/args
Copy link
Member

Choose a reason for hiding this comment

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

s/args/env/ maybe

@AkihiroSuda
Copy link
Member

AkihiroSuda commented Dec 20, 2022

serve

server, service, or just drop it (Existing command, so no need to change)

Instead of using this command, you can also directly launch the registry using "nerdctl ipfs registry serve".

Use "nerdctl ipfs registry down" to stop the registry service launced by "nerdctl ipfs registry up".
`,
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we can just drop the up/down command and let the user install the systemd unit by themselves


```console
> nerdctl build --ipfs -t hello .
Copy link
Member

Choose a reason for hiding this comment

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

The document may note that this flag (and up/down) is being removed in nerdctl v1.2.0.

@@ -70,7 +70,7 @@ If Dockerfile is not present and -f is not specified, it will look for Container
buildCommand.RegisterFlagCompletionFunc("platform", shellCompletePlatforms)
// #endregion

buildCommand.Flags().Bool("ipfs", false, "Allow pulling base images from IPFS")
// buildCommand.Flags().Bool("ipfs", false, "Allow pulling base images from IPFS")
Copy link
Member

Choose a reason for hiding this comment

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

Remove

@ktock ktock force-pushed the kubo-bin branch 2 times, most recently from ce532c0 to 52d3859 Compare December 21, 2022 00:54
@AkihiroSuda
Copy link
Member

Still draft?

@ktock ktock marked this pull request as ready for review December 21, 2022 02:29
@ktock
Copy link
Member Author

ktock commented Dec 21, 2022

Thank you for the review.

@@ -604,6 +604,12 @@ func RequireExecutable(t testing.TB, name string) {
}
}

func RequireIPFS(t *testing.T) {
Copy link
Member

Choose a reason for hiding this comment

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

nit: maybe this function can be replaced by just using RequireExecutable("ipfs") above.

@ktock
Copy link
Member Author

ktock commented Dec 22, 2022

It looks like the ipfs registry sometimes breaks. I'll fix it.

WARN[0215] ipfs command failed                           error="exit status 1" stderr="Error: lock /home/rootless/.ipfs/repo.lock: someone else has the lock\n"
WARN[0216] ipfs command failed                           error="exit status 1" stderr="Error: lock /home/rootless/.ipfs/repo.lock: someone else has the lock\n"
WARN[0217] ipfs command failed                           error="exit status 1" stderr="Error: lock /home/rootless/.ipfs/repo.lock: someone else has the lock\n"
WARN[0218] ipfs command failed                           error="exit status 1" stderr="Error: lock /home/rootless/.ipfs/repo.lock: someone else has the lock\n"
WARN[0219] ipfs command failed                           error="exit status 1" stderr="Error: lock /home/rootless/.ipfs/repo.lock: someone else has the lock\n"

Signed-off-by: Kohei Tokunaga <ktokunaga.mail@gmail.com>
@ktock ktock marked this pull request as ready for review December 22, 2022 07:54
Copy link
Member

@AkihiroSuda AkihiroSuda left a comment

Choose a reason for hiding this comment

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

Thanks

@AkihiroSuda AkihiroSuda merged commit 2735dfc into containerd:main Dec 22, 2022
@ktock ktock deleted the kubo-bin branch December 26, 2022 11:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

IPFS: remove Go dependency and exec Kubo binary instead
3 participants