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

Add yarn ipfs command to deploy on IPFS #1030

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

portdeveloper
Copy link
Contributor

@portdeveloper portdeveloper commented Jan 9, 2025

This PR:

-> Adds yarn ipfs command to the package.json
-> Modifies next.config.js to populate out folder when yarn ipfs is run
-> Adds a deploy-ipfs.js file under packages/nextjs/scripts

The user has to have an ipfs daemon running for the initial uploading.

Here is an example I deployed using this script + eth.limo
https://pallas-athena.eth.limo/
it should be garbage collected after some time but it has been up almost for a week now.

}
} catch (error) {
console.log(error);
console.error("❌ IPFS is not installed or daemon is not running.");
Copy link
Member

Choose a reason for hiding this comment

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

Is it possible to avoid daemon? For example using https://web3.storage/docs/w3up-client/ or https://docs.storacha.network/w3up-client/ ? Asking without trying, but probably it simplifies DX

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, that is a valid concern, but I wanted to keep everything manual just for the sake of showing that it can be done this way.

@carletex
Copy link
Member

Thanks @portdeveloper !!

Could you update this using the nifty ink server? I know it doesn't work (because of how that server is configured), but we are working on a proper BG IPFS network of nodes, so when the time is right (probably in a week or so) it'd be a matter of replacing the nifty ink URL.

cc @rin-st (because of #1030 (comment))

Copy link
Collaborator

@Pabl0cks Pabl0cks left a comment

Choose a reason for hiding this comment

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

Nice job @portdeveloper !!

Just tried the previous version before 1547922 on Windows environment, and ran into a couple of issues, I had to do this in order to run yarn ipfs:

  • Renamed deploy-ipfs.js to .mjs because i was getting a Cannot use import statement outside a module error. Then updated package.json accordingly
  • Created the out folder manually as it wasn't being generated automatically during the build process.

After that it deployed to ipfs nicely with my IPFS Desktop app running 🙏

@portdeveloper
Copy link
Contributor Author

Thanks for testing @Pabl0cks !

Changing the script name to mjs really makes sense here, I have added the commit.

But I wonder why the out folder is not created automatically.

yarn ipfs command has yarn build in it so it should be triggering a build. I will be testing this in another computer to make sure.

@damianmarti
Copy link
Member

@portdeveloper working great!!

I have the same issue with the out folder:

Uploading to Nifty Ink IPFS...
📦 Adding directory to IPFS via Nifty Ink...
Error adding directory to IPFS: [Error: ENOENT: no such file or directory, stat '/ssd/workspace/buidlguidl/scaffold-eth-2/packages/nextjs/out'] {
errno: -2,
code: 'ENOENT',
syscall: 'stat',
path: '/ssd/workspace/buidlguidl/scaffold-eth-2/packages/nextjs/out'
}

I had to create it manually. When and where should it be created?

@portdeveloper
Copy link
Contributor Author

@damianmarti Thanks for the feedback I am looking into it right now!

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.

5 participants