ceramicnetwork / js-ceramic

Typescript implementation of the Ceramic protocol
http://ceramic.network
Other
414 stars 127 forks source link

chore: (breaking changes) use rust "ipfs" by default #3250

Closed dav1do closed 1 month ago

dav1do commented 2 months ago

Description

This changes the daemon to use IPFS_FLAVOR=rust by default. It will start a binary if a CERAMIC_ONE_PATH variable is set. The docker image installs the binary and sets the path by default.

Details

This also removes the CERAMIC_RECON_MODE environment variable and only uses IPFS_FLAVOR and changes the default from go to rust. Now, running with CERAMIC_ONE_PATH=/Users/david/3box/rust-ceramic/target/debug/ceramic-one node ceramic.js daemon will use a binary rust ceramic and node ceramic.js daemon --ipfs-api http://localhost:5101 will use a remote rust ceramic endpoint. You can change the network and store directory as well: CERAMIC_ONE_NETWORK=testnet-clay CERAMIC_ONE_STORE_DIR=~/.ceramic-one CERAMIC_ONE_PATH=/Users/david/3box/rust-ceramic/target/debug/ceramic-one node ceramic.js daemon.

The defaults match the previous behavior to use a random directory for the store, an in-memory network, and random ports for the server. If you change the network, you must specify the store. This was to keep tests passing but ideally they're updated to pipe desired behavior in and have more repeatable defaults.

To use kubo, you must specify IPFS_FLAVOR=go node ceramic.js daemon

The docker image installs a rust binary and sets default env variable values so they work and you can simply start the container with docker run --platform=linux/x86_64 js-ceramic:dev. --platform is not strictly necessary, however if you're running on an ARM cpu (e.g. apple silicon) you will get a warning and it will switch and run using emulation as we don't provide an image with the ARM version of rust ceramic currently.

We changed the default RPC port ceramic one uses to 5101 so this also makes that the default when not included. See the ticket in linear.

Cruft

Nothing was previously passed down to the rust ceramic IPFS info when it wasn't running in remote mode and we relied on starting with all the defaults in tests. In order to avoid changing everything here, I kept that behavior but the network is not passed through from the CLI arg at the moment. I intend to fix that in the next PR when I detect the version of a remote node rather than requiring flags.

How Has This Been Tested?

Describe the tests that you ran to verify your changes. Provide instructions for reproduction.

PR checklist

Before submitting this PR, please make sure:

References:

Please list relevant documentation (e.g. tech specs, articles, related work etc.) relevant to this change, and note if the documentation has been updated.