MystenLabs / walrus-sites

Walrus Sites: Decentralized Websites using Sui and Walrus.
https://docs.walrus.site/walrus-sites/intro.html
Apache License 2.0
10 stars 7 forks source link

Integration with Suibase #94

Closed kkomelin closed 2 weeks ago

kkomelin commented 2 weeks ago

Problem/Motivation

Currently we need to use the native Sui cli to add the testnet rpc and activate it this way to be able to use Walrus:

sui client new-env --alias testnet --rpc https://fullnode.testnet.sui.io:443
sui client switch --env testnet

With Suibase, we have a parallel "universe" of environments which co-exist with the native Sui cli. We actually already have a console tool which works and behaves like the Sui cli with testnet already activated, which is called tsui.

Currently we have to maintain two environment configurations (native and Suibase) which can lead to some issues like version mismatch, etc.

Proposed resolution

It would be great for Walrus to give its users control on which binary/script should be called. If tsui exists in the system, Walrus could use it and if not, stick with the native cli.

What do you guys think? I can try to work on this issue if you think it makes sense.

mlegner commented 2 weeks ago

Thanks for the issue, @kkomelin. Currently, Walrus doesn't actually use the Sui CLI directly in any way; instead, it natively integrates the Sui Rust SDK. We only use the Sui CLI as a simple way to set up a wallet that is compatible with the SDK.

So the question is, what kind of configuration files tsui uses and if they are compatible with the Sui Rust SDK. If they are, there shouldn't be a reason not to use tsui; potentially you just have to explicitly specify the path to your wallet config in your Walrus client_config.yaml.

Do you have some further info about the configuration of tsui?

kkomelin commented 2 weeks ago

Thank you @mlegner. It's good to know.

Here is what Suibase does for tsui https://suibase.io/how-to/scripts.html But to answer your question precisely, I'd like to invite @mario4tier to the discussion. @mario4tier if you could give more details here, please.

mario4tier commented 2 weeks ago

( @mlegner , @kkomelin )

Suibase creates distinct "workdir" that provides the same as what Mysten Labs has in ~/.sui/sui_config.

For testnet, this will always be in ~/suibase/workdirs/testnet/config image

One possible hiccup would be which "rpc URL" the Rust SDK uses. Does walrus track the active_env in client.yaml? image

In this config, a local proxy is enabled for robust/load-balanced RPC services.

(Side Note: For most users, 'testnet/config' is a symbolic link to 'testnet/config-default', just in case you wonder about the differences in the path)

mlegner commented 2 weeks ago

@mario4tier OK, in this case Walrus already works with Suibase. In your client_config.yaml, you just need to add a line wallet_config: /home/someuser/suibase/.... Or, in the CLI, specify the wallet config as walrus --wallet ~/suibase/workdirs/testnet/config/client.yaml <cmd>.

Note that currently the ~ or $HOME only work as a CLI option but not in the config file; this will be added soon to make this a bit more ergonomic.

walrus help also prints the default locations we search for the wallet. We can think about looking in the default Suibase location as well.

kkomelin commented 2 weeks ago

Thank you @mlegner! I've tested it with the the latest Walrus site-builder. It worked like a charm. I used the following approach to deploy my app to be precise:

site-builder --config ./walrus.yaml --wallet ~/suibase/workdirs/testnet/config/client.yaml  publish ./dist

@mario4tier Do you think we need a note about how to work with Walrus Sites somewhere in the Suibase documentation?

kkomelin commented 2 weeks ago

I think we're good here for now. What do you think guys? Do we have anything outstanding here or we can close the issue? @mlegner @mario4tier

mario4tier commented 2 weeks ago

I am good. We can get it working with the existing command line and this is good enough to me.

kkomelin commented 2 weeks ago

Good. Thank you guys @mario4tier @mlegner. I'm closing the issue for now.