Skip to content

Commit

Permalink
Update DeWeb CLI docs (#355)
Browse files Browse the repository at this point in the history
* Update CLI docs

* Fix misnamed category and improve providers display in sidebar

* Add CLI Configuration documentation

* Add CLI upload tutorial

* Add DeWeb CLI overview

* Add replace DeWeb upload/cli with upload/overview to redirect to the new CLI tutorial

* Update DeWeb sidebar

* Fix broken links

* update homepage providers

---------

Co-authored-by: thomas-senechal <[email protected]>
  • Loading branch information
pivilartisant and thomas-senechal authored Oct 30, 2024
1 parent e085c14 commit 488f3d3
Show file tree
Hide file tree
Showing 8 changed files with 221 additions and 137 deletions.
59 changes: 59 additions & 0 deletions docs/deweb/cli/config.mdx
Original file line number Diff line number Diff line change
@@ -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 <website_path> --node_url <your_node_url> --wallet <path_to_wallet> --password <your_password>
```

You can also set the **secret key** as an environment variable:

```bash
export SECRET_KEY=<your_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.
:::
47 changes: 47 additions & 0 deletions docs/deweb/cli/overview.mdx
Original file line number Diff line number Diff line change
@@ -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.
83 changes: 83 additions & 0 deletions docs/deweb/cli/upload.mdx
Original file line number Diff line number Diff line change
@@ -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 <website_path> --node_url <your_node_url> --wallet <path_to_wallet> --password <your_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=<your_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).
:::
2 changes: 1 addition & 1 deletion docs/deweb/getting-started/overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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)
For detailed instructions, see [upload a website to DeWeb](../cli/upload)
8 changes: 4 additions & 4 deletions docs/deweb/home.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
126 changes: 0 additions & 126 deletions docs/deweb/upload/cli.mdx

This file was deleted.

13 changes: 13 additions & 0 deletions docs/deweb/upload/overview.mdx
Original file line number Diff line number Diff line change
@@ -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!
Loading

0 comments on commit 488f3d3

Please sign in to comment.