MystenLabs / walrus-sites

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

[Feature]: Make the publish command update the site #177

Open kkomelin opened 2 months ago

kkomelin commented 2 months ago

Description

The question here is do we really need a separate update command?

The only difference between publish and update is that update needs the published site object ID. Can we automate it so that the update command is not needed at all?

For example, we could store the site object ID in .walrus-site.yaml after publishing the site the first time and read it on publishing the site the second time. Actually, Walrus config already has system_object field which could be used for that purpose.

This change could simplify things and consequently improve DX.

Component

site-builder

Code of Conduct

giac-mysten commented 2 months ago

Hey @kkomelin , thanks for the feature request!

Actually, Walrus config already has system_object field which could be used for that purpose.

the system_object in the walrus config is Walrus's system object, which is required to look up committee information, so we could not use that. In general, the Walrus config is required to configure the Walrus CLI, and therefore is separate from Walrus Sites.

For example, we could store the site object ID in .walrus-site.yaml after publishing the site the first time and read it on publishing the site the second time

this could work. I like the separation between publish and update, but we can add something along these lines at some point. Just FYI, at the moment we are working on higher priority issues unfortunately, so it may take a while.

One minor problem I see is that we are introducing a Walrus-Sites-specific "magic" file, which is not produced by the framework that built the site, and therefore may be wrongly interpreted by other tooling (for example, if you publish both to walrus sites and to a conventional server, the .walrus-site.yaml will be included in the latter).

kkomelin commented 2 months ago

@giac-mysten Thank you for clarifying stuff.

I try to make the user experience similar to what they see on other static hosting providers. With Firebase, Vercel, etc., you can deploy a site with one commend - no difference between publishing or updating.

As for .walrus-site.yaml, it can be Git-ignored if necessary. We can also come up with a better name, better folder or another place to store the site object ID. I provided it just for example.

Sure, no rush. We can come back to this topic whenever you guys have time.

kkomelin commented 2 months ago

For now, I've developed a custom script which publishes the app on the first run, sores the site object ID in .env.local and updates the app on subsequent runs https://github.com/kkomelin/sui-dapp-starter/blob/main/packages/frontend/scripts/walrus-site-deploy.cjs