From 864c6ca88b403a74ee6e908bcd14587a867f4eba Mon Sep 17 00:00:00 2001 From: Phoebe Lartisant Date: Fri, 4 Oct 2024 13:52:45 +0200 Subject: [PATCH 1/9] Update CLI docs --- docs/deweb/upload/cli.mdx | 35 ++++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/docs/deweb/upload/cli.mdx b/docs/deweb/upload/cli.mdx index 05bb68a37..013bcea22 100644 --- a/docs/deweb/upload/cli.mdx +++ b/docs/deweb/upload/cli.mdx @@ -101,23 +101,36 @@ deweb-cli delete -w myWallet -n http://node-url.com ## Configuration -The CLI can be configured using a YAML file. By default, it looks for `deweb_cli_config.yaml` in the current directory. You can specify a different configuration file using the `--config` flag. +The CLI can be configured using a JSON file. By default, it looks for `deweb_cli_config.json` in the current directory. You can specify a different configuration file using the `--config | -c` flag. -### Sample Configuration (`deweb_cli_config.yaml`) +### Sample Configuration (`deweb_cli_config.json`) -```yaml -wallet_config: - wallet_nickname: "alice" +:::note +Using this config file allows you to stream line uploading process & reduce argument use in commands. We highly recommend that you take full advantage of this. +::: -node_url: "https://buildnet.massa.net/api/v2" -sc_config: - minimal_fees: 0 - max_gas: 0 - max_coins: 0 - expiry: 0 +```json +{ + "wallet_path": "./wallet_alice.yaml", + "wallet_password": "42alice0" + "node_url": "https://buildnet.massa.net/api/v2", + "chunk_size": "64000" + "secret_key": "S[...]1" +} ``` + +:::info +`wallet_path` should be the path to your Massa Station Wallet yaml file. You can find this file by following this [tutorial](../../massaStation/massa-wallet/account-backup). + + +Using the `secret_key` allows you to automatically sign transaction with any Massa ecosystem wallet. + +Changing the `chunk_size` allows you to determine the size of uploaded chunks, the bigger they are, the less transaction you need to pay fees for. +::: + + ## Logging The CLI logs its output to `./deweb-cli.log`. Logging is initialized automatically when the application starts. From ae4cfe3785a05ae07a9265717f508df9757e97ef Mon Sep 17 00:00:00 2001 From: thomas-senechal Date: Mon, 28 Oct 2024 16:43:24 +0100 Subject: [PATCH 2/9] Fix misnamed category and improve providers display in sidebar --- sidebars.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/sidebars.js b/sidebars.js index 319030783..ba139539d 100644 --- a/sidebars.js +++ b/sidebars.js @@ -513,7 +513,7 @@ const sidebars = { }, { type: "category", - label: "Acccessing the DeWeb locally", + label: "Accessing the DeWeb locally", collapsed: false, items: [ "deweb/local-server-config/setup-local-server", @@ -521,10 +521,8 @@ const sidebars = { ], }, { - type: "category", - label: "Becoming a provider", - collapsed: false, - items: ["deweb/provider/setup-public-instance"], + type: "doc", + id: "deweb/provider/setup-public-instance", }, { type: "category", From 1a16e712a649d4efff53f10bed90ffe6b0f75861 Mon Sep 17 00:00:00 2001 From: thomas-senechal Date: Mon, 28 Oct 2024 16:59:41 +0100 Subject: [PATCH 3/9] Add CLI Configuration documentation --- docs/deweb/cli/config.mdx | 59 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 docs/deweb/cli/config.mdx diff --git a/docs/deweb/cli/config.mdx b/docs/deweb/cli/config.mdx new file mode 100644 index 000000000..728b80f7c --- /dev/null +++ b/docs/deweb/cli/config.mdx @@ -0,0 +1,59 @@ +--- +title: CLI Configuration +--- + +# CLI Configuration + +The DeWeb CLI supports configuration via a JSON file, allowing users to manage essential settings like wallet credentials +and node details for seamless website deployment on the Massa blockchain. + +## Config File Structure + +Here’s a sample `deweb_cli_config.json` setup: + +```json +{ + "wallet_password": "your-wallet-password", + "wallet_path": "your-wallet.yaml", + "node_url": "https://mainnet.massa.net/api/v2", + "chunk_size": 64000 +} +``` + +Here’s a breakdown of each field: + +- **`wallet_password`**: The password for your Massa wallet file, used when `wallet_path` is specified. +- **`wallet_path`**: The file path to your Massa wallet in YAML format. Only YAML wallet files are supported. +- **`node_url`**: The URL of the Massa node where your website will be uploaded. +- **`chunk_size`**: Defines the size in bytes of each chunk for file upload. + The default is typically `64000`, but it can be adjusted based on your needs and network conditions. +- **`secret_key`**: The secret key for your Massa account. Use this as an alternative to `wallet_password` and `wallet_path`. + +:::info Note +If `wallet_path` + `wallet_password` **and** `secret_key` are used in the config file, `secret_key` will take precedence. + +If the `SECRET_KEY` environment variable is set, it will take precedence over the `secret_key` and `wallet` fields in the config file. +::: + +## Setting Configurations Directly on the Command Line + +If you prefer, you can bypass the config file and specify values directly on the command line. For example: + +```bash +npx @massalabs/deweb-cli upload --node_url --wallet --password +``` + +You can also set the **secret key** as an environment variable: + +```bash +export SECRET_KEY= +``` + +## Additional Resources + +For instructions on obtaining a YAML wallet file or secret key, +refer to the [Massa Wallet Documentation](https://docs.massa.net/docs/massaStation/massa-wallet/account-backup). + +:::info +If you encounter issues, please visit our [GitHub Issues page](https://github.com/massalabs/DeWeb/issues) for troubleshooting or to report problems. +::: From a6c3756a6ebf8157bac67d32f59445b92a47a62f Mon Sep 17 00:00:00 2001 From: thomas-senechal Date: Mon, 28 Oct 2024 16:59:54 +0100 Subject: [PATCH 4/9] Add CLI upload tutorial --- docs/deweb/cli/upload.mdx | 83 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 docs/deweb/cli/upload.mdx diff --git a/docs/deweb/cli/upload.mdx b/docs/deweb/cli/upload.mdx new file mode 100644 index 000000000..f46eb30a2 --- /dev/null +++ b/docs/deweb/cli/upload.mdx @@ -0,0 +1,83 @@ +--- +title: Uploading a Website +--- + +# Uploading a Website + +Follow these steps to upload a website to the Massa blockchain using the DeWeb CLI. +You can configure settings using either a config file or command-line options. + +## Prerequisites + +Before you start, make sure you have the following: + +1. **Massa Wallet**: A wallet file in YAML format or a secret key. + Refer to [Massa wallet documentation](/docs/massaStation/massa-wallet/account-backup) for guidance on obtaining these. +2. **Node URL**: The URL for the Massa node you plan to use. +3. **Website Files**: Build your website files in a directory on your local machine. + +## Step 1: Configure Access + +You have two ways to configure access for `deweb-cli`: by using a configuration file or by providing options directly on the command line. + +### Option A: Using a Config File + +For persistent settings, create a config file as described in the [CLI Configuration](./config) page. This file can store values for `node_url`, `wallet_path`, `wallet_password`, `chunk_size`, or `secret_key`. + +### Option B: Using Command-Line Options + +Alternatively, specify configurations directly in the command line for a one-time setup. + +- Use the following command to upload a website with command-line options: + + ```bash + npx @massalabs/deweb-cli upload --node_url --wallet --password + ``` + +- **Using a Secret Key**: If you prefer to use a secret key instead of a wallet file, set it as an environment variable: + + ```bash + export SECRET_KEY= + ``` + + `deweb-cli` will detect the `SECRET_KEY` variable automatically. + +## Step 2: Run the Upload Command + +With your configuration in place, run the `upload` command to deploy your website: + +```bash +npx @massalabs/deweb-cli upload /path/to/website-build-directory +``` + +:::note +If you need to edit an existing website, +you can simply use the `--address` flag to specify the smart contract address of the website you want to edit. +::: + +This command will begin the upload process. + +## Step 3: Confirm the Upload + +While the command is running, you will see estimated costs and be prompted to confirm the upload. Select `yes` to proceed. + +## Step 4: Follow the Progress + +The CLI will display the progress of the upload, including the number of chunks uploaded. + +Once your website has been successfully uploaded, you will see a success message with the address where your website is hosted: + +```bash +Website deployed at AS12v...2UgLS +``` + +This message confirms that your website has been successfully deployed on the Massa blockchain. +The output address (`AS12v...2UgLS` in this example) represents the address where your website is hosted. + +## Step 5: Access Your Website + +To be able to access your website, you need to associate it with a Massa domain. Follow the instructions in [Assigning a MNS to your website](../upload/mns) to link your deployed website address to a custom Massa domain. + +:::info +If you encounter any issues or have suggestions, please let us know through our [issue tracker](https://github.com/massalabs/DeWeb/issues). +::: From 7b8976933b97c3dca42fc11312a61b6fd86bd742 Mon Sep 17 00:00:00 2001 From: thomas-senechal Date: Mon, 28 Oct 2024 17:00:03 +0100 Subject: [PATCH 5/9] Add DeWeb CLI overview --- docs/deweb/cli/overview.mdx | 47 +++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 docs/deweb/cli/overview.mdx diff --git a/docs/deweb/cli/overview.mdx b/docs/deweb/cli/overview.mdx new file mode 100644 index 000000000..675e298a3 --- /dev/null +++ b/docs/deweb/cli/overview.mdx @@ -0,0 +1,47 @@ +--- +title: DeWeb CLI Overview +--- + +# DeWeb CLI Overview + +DeWeb CLI is a command-line tool designed for developers to manage website deployments on the Massa blockchain. +It provides commands for uploading, managing, and debugging website files directly on the blockchain, simplifying the deployment process. + +## Requirements + +Before running the CLI, ensure you have: + +- **Node.js** (version 18.0 or higher) and **npm** installed. You can check your versions with: + ```bash + node -v + npm -v + ``` + +- **A Massa Wallet**: Either as a YAML wallet file or its secret key. + Refer to the [Massa Wallet Documentation](/docs/massaStation/massa-wallet/account-backup) for instructions on creating or obtaining these. + +## Capabilities + +DeWeb CLI offers a range of capabilities for working with website stored on the Massa blockchain: + +- **Upload**: Uploads and edits your website to the blockchain. +- **Delete**: Removes your website and its associated files from the blockchain. +- **List Files**: Lists all files associated with a specific website, useful for verifying deployed content. +- **View File Content**: Allows you to view the content of a specific file, + providing a way to debug or inspect individual files directly on the blockchain. + +To explore these commands further, you can use the `--help` option: + +```bash +npx @massalabs/deweb-cli --help +``` + +## Quick Start + +Run DeWeb CLI with `npx` for instant access: + +```bash +npx @massalabs/deweb-cli --help +``` + +This command will display available options and commands, allowing you to dive into using the DeWeb CLI right away. From ed8cbd920f59da413497cba7acf9999d85ef7982 Mon Sep 17 00:00:00 2001 From: thomas-senechal Date: Mon, 28 Oct 2024 17:00:39 +0100 Subject: [PATCH 6/9] Add replace DeWeb upload/cli with upload/overview to redirect to the new CLI tutorial --- docs/deweb/upload/cli.mdx | 139 --------------------------------- docs/deweb/upload/overview.mdx | 13 +++ 2 files changed, 13 insertions(+), 139 deletions(-) delete mode 100644 docs/deweb/upload/cli.mdx create mode 100644 docs/deweb/upload/overview.mdx diff --git a/docs/deweb/upload/cli.mdx b/docs/deweb/upload/cli.mdx deleted file mode 100644 index 013bcea22..000000000 --- a/docs/deweb/upload/cli.mdx +++ /dev/null @@ -1,139 +0,0 @@ ---- -title: Upload with the CLI ---- - -# DeWeb CLI - -The DeWeb CLI is a command-line tool designed for deploying, editing, and deleting decentralized websites on the DeWeb platform. - - - -## Downloading the CLI tool - -You can download the DeWeb CLI tool from the [DeWeb Releases Page](https://github.com/massalabs/DeWeb/releases). - -:::info -On macOS or Linux run `chmod +x deweb-cli_{targetOS}` command before `./deweb-cli_{targetOS}` to allow execution. - -On Windows, use `deweb-cli_{targetOS}.exe` instead of `./deweb-cli_{targetOS}` -::: - -## Usage - -You can use the `deweb-cli` command to interact with the DeWeb. Below is the basic usage syntax: - -```bash -deweb-cli [global options] command [command options] [arguments...] -``` - -### Global Options - -- `--wallet_nickname, -w`: Specify the wallet nickname to use. -- `--node_url, -n`: Specify the node URL. -- `--config, -c`: Load configuration from a specified file path (default: `./deweb_cli_config.yaml`). - -## Commands - -### upload - -Uploads a new website to the DeWeb. - -```bash -deweb-cli upload [global options] -``` - -#### Arguments - -- ``: Path to the zip file containing the website to be uploaded. - -#### Example - -```bash -deweb-cli upload -w myWallet -n https://mainnet.massa.net/api/v2 ./website.zip -``` - -The zip file should contain an `index.html` at its root. For example, if you build an app and the output is in a directory (usually `build` or `dist`), you can zip it using the following command from the output directory: - -```bash -zip {name}.zip -r ./* -``` - -This should result in a zip file with all the files from the output directory, with the `index.html` at its root. - -> Note: Server Side Rendering (SSR) is not supported at this time. Ensure your website is fully client-side rendered. - -### edit - -Edits an existing website on the DeWeb. - -```bash -deweb-cli edit [global options] -``` - -#### Arguments - -- ``: Smart contract address of the website to be edited. -- ``: Path to the zip file containing the updated website. - -#### Example - -```bash -deweb-cli edit -w myWallet -n http://node-url.com ./updated_website.zip -``` - -### delete - -Deletes an existing website from the DeWeb. - -```bash -deweb-cli delete [global options] -``` - -#### Arguments - -- ``: Smart contract address of the website to be deleted. - -#### Example - -```bash -deweb-cli delete -w myWallet -n http://node-url.com -``` - -## Configuration - -The CLI can be configured using a JSON file. By default, it looks for `deweb_cli_config.json` in the current directory. You can specify a different configuration file using the `--config | -c` flag. - -### Sample Configuration (`deweb_cli_config.json`) - -:::note -Using this config file allows you to stream line uploading process & reduce argument use in commands. We highly recommend that you take full advantage of this. -::: - - -```json -{ - "wallet_path": "./wallet_alice.yaml", - "wallet_password": "42alice0" - "node_url": "https://buildnet.massa.net/api/v2", - "chunk_size": "64000" - "secret_key": "S[...]1" -} -``` - - -:::info -`wallet_path` should be the path to your Massa Station Wallet yaml file. You can find this file by following this [tutorial](../../massaStation/massa-wallet/account-backup). - - -Using the `secret_key` allows you to automatically sign transaction with any Massa ecosystem wallet. - -Changing the `chunk_size` allows you to determine the size of uploaded chunks, the bigger they are, the less transaction you need to pay fees for. -::: - - -## Logging - -The CLI logs its output to `./deweb-cli.log`. Logging is initialized automatically when the application starts. -:::note Disclaimer -The CLI section of the documentation is a work in progress. A complete documentation is coming soon. We appreciate your patience and feedback. -::: diff --git a/docs/deweb/upload/overview.mdx b/docs/deweb/upload/overview.mdx new file mode 100644 index 000000000..5726cc648 --- /dev/null +++ b/docs/deweb/upload/overview.mdx @@ -0,0 +1,13 @@ +--- +title: Overview +--- + +# Overview + +To deploy a website on the Massa blockchain, you can use the DeWeb CLI by following the [Uploading a Website](../cli/upload) guide. +This guide provides an overview of the process and the steps to upload your website. + +We are working on additional user-friendly tools to make website deployment accessible to all users, regardless of technical experience. +These upcoming solutions will simplify the upload process, providing an intuitive interface for deploying websites on the Massa blockchain. + +Stay tuned for more updates! From cfed8aa6d4d5edcea6d616c720585c89cf4e1f6c Mon Sep 17 00:00:00 2001 From: thomas-senechal Date: Mon, 28 Oct 2024 17:00:54 +0100 Subject: [PATCH 7/9] Update DeWeb sidebar --- sidebars.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/sidebars.js b/sidebars.js index ba139539d..3920baa14 100644 --- a/sidebars.js +++ b/sidebars.js @@ -528,8 +528,18 @@ const sidebars = { type: "category", label: "Uploading to the DeWeb", collapsed: false, - items: ["deweb/upload/cli", "deweb/upload/mns"], + items: ["deweb/upload/overview", "deweb/upload/mns"], }, + { + type: "category", + label: "DeWeb CLI (Command Line Interface)", + collapsed: false, + items: [ + "deweb/cli/overview", + "deweb/cli/upload", + "deweb/cli/config", + ], + } // { // type: "doc", // id: "deweb/faq", From 44b7e7355211d66c70c14b24c94da34321e30378 Mon Sep 17 00:00:00 2001 From: thomas-senechal Date: Mon, 28 Oct 2024 17:06:55 +0100 Subject: [PATCH 8/9] Fix broken links --- docs/deweb/getting-started/overview.mdx | 2 +- docs/deweb/home.mdx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/deweb/getting-started/overview.mdx b/docs/deweb/getting-started/overview.mdx index 86105e1ce..0439a43e7 100644 --- a/docs/deweb/getting-started/overview.mdx +++ b/docs/deweb/getting-started/overview.mdx @@ -48,4 +48,4 @@ Uploading a website to the DeWeb lets you: - Protect business from DNS hacks - Build a truly decentralized dApp -For detailed instructions, see [upload a website to DeWeb](../upload/cli) \ No newline at end of file +For detailed instructions, see [upload a website to DeWeb](../cli/upload) \ No newline at end of file diff --git a/docs/deweb/home.mdx b/docs/deweb/home.mdx index ce3b1a1d5..31f4ea1b3 100644 --- a/docs/deweb/home.mdx +++ b/docs/deweb/home.mdx @@ -78,7 +78,7 @@ We are working on a provider registry system so you can have quick access to dif ### Developers: Upload Your Website On the DeWeb -Developers can upload their websites to the Massa blockchain using the [DeWeb upload CLI](./upload/cli.mdx). +Developers can upload their websites to the Massa blockchain using the [DeWeb upload CLI](./cli/overview.mdx). :::info Work in Progress From dd7455afc6ea2fe6921c84ea9072b3352888e96b Mon Sep 17 00:00:00 2001 From: Phoebe Lartisant Date: Tue, 29 Oct 2024 10:48:09 +0100 Subject: [PATCH 9/9] update homepage providers --- docs/deweb/home.mdx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/deweb/home.mdx b/docs/deweb/home.mdx index 31f4ea1b3..a3635e879 100644 --- a/docs/deweb/home.mdx +++ b/docs/deweb/home.mdx @@ -92,9 +92,9 @@ If you encounter any issues or have suggestions, please let us know through our | **Network** | **Provider** | **Provider URL** | Local URL | |-------------|-------------------------|------------------------------------------------------|-----------| -| **Buildnet**| vesting.massa.network | [vesting.massa.network](http://vesting.massa.network)|vesting.localhost:8080 -| **Buildnet**| mns.massa.network | [mns.massa.network](http://mns.massa.network) | mns.localhost:8080 -| **Buildnet**| pur.massahub.network | [pur.massahub.network](http://pur.massahub.network) | pur.localhost:8080 +| **Buildnet**| massa | [vesting.massa.network](http://vesting.massa.network)|vesting.localhost:8080 +| **Buildnet**| massa | [mns.massa.network](http://mns.massa.network) | mns.localhost:8080 +| **Buildnet**| massahub | [pur.massahub.network](http://pur.massahub.network) | pur.localhost:8080 ## Resources