Skip to content

Commit

Permalink
128 remove old go cli (#173)
Browse files Browse the repository at this point in the history
* Delete GO CLI main

* Remove unused configuration files for CLI

* Remove useless SC wasm

* Remove website management functions from website pkg

* Refactor Taskfile to streamline build and run tasks for server and remove CLI references

* Remove unused dependencies from go.mod and go.sum

* Fix build workflow

* Update READMEs

* Update CLI README for improved formatting and clarity
  • Loading branch information
thomas-senechal authored Nov 26, 2024
1 parent e5c04fd commit 4e866ac
Show file tree
Hide file tree
Showing 17 changed files with 91 additions and 1,072 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:
- name: Build Server
shell: bash
run: task build:server
run: task build
env:
OS: ${{ matrix.target }}
ARCH: ${{ matrix.arch }}
Expand Down
153 changes: 2 additions & 151 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,154 +6,5 @@ DeWeb is your gateway to the decentralized web, enabling seamless access to webs

DeWeb revolutionizes web accessibility by providing tools to upload, edit, and view websites directly on the blockchain. The project includes two binaries:

- `deweb-cli`: A command-line tool for deploying and managing on-chain websites.
- `deweb-server`: A server application that allows users to access websites stored on-chain through a web browser.

## Getting Started

### Prerequisites

Ensure you have `task` installed. Follow the instructions [here](https://taskfile.dev/installation/).

### Installation

1. Navigate to server folder:

```bash
cd server
```

2. Install required tools:

```bash
task install
```

3. Generate:

```bash
task generate
```

4. Build both binaries:

```bash
task build
```

Alternatively, you can build them separately:

```bash
task build:cli
task build:server
```

5. The binaries will be stored in the `./build` directory.

# DeWeb CLI

DeWeb CLI is a command-line tool designed for deploying, editing, and deleting decentralized websites on the DeWeb platform.

## Usage

Once installed, you can use the `deweb-cli` command to interact with 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 platform.

```bash
deweb-cli upload [global options] <website_zip_file_path>
```

#### Arguments

- `<website_zip_file_path>`: 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 platform.

```bash
deweb-cli edit [global options] <website_sc_address> <website_zip_file_path>
```

#### Arguments

- `<website_sc_address>`: Smart contract address of the website to be edited.
- `<website_zip_file_path>`: Path to the zip file containing the updated website.

#### Example

```bash
deweb-cli edit -w myWallet -n http://node-url.com <website_sc_address> ./updated_website.zip
```

### delete

Deletes an existing website from the DeWeb platform.

```bash
deweb-cli delete [global options] <website_sc_address>
```

#### Arguments

- `<website_sc_address>`: Smart contract address of the website to be deleted.

#### Example

```bash
deweb-cli delete -w myWallet -n http://node-url.com <website_sc_address>
```

## 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.

### Sample Configuration (`deweb_cli_config.yaml`)

```yaml
wallet_config:
wallet_nickname: "alice"

node_url: "https://buildnet.massa.net/api/v2"

sc_config:
minimal_fees: 0
max_gas: 0
max_coins: 0
expiry: 0
```
## Logging
The CLI logs its output to `./deweb-cli.log`. Logging is initialized automatically when the application starts.
- [`deweb-cli`](./cli/README.md): A command-line tool for deploying and managing on-chain websites.
- [`deweb-server`](./server/README.md): A server application that allows users to access websites stored on-chain through a web browser.
44 changes: 44 additions & 0 deletions cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,47 @@
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.

For more information about the DeWeb CLI, how to use it, and how to upload a website to the Massa blockchain, see the [DeWeb CLI documentation](https://docs.massa.net/docs/deweb/cli/overview).

## Getting Started

### Prerequisites

To use and work on the DeWeb CLI, you need to have the following tools installed:

- **Node.js** (version 18.0 or higher) and **npm** installed. You can check your versions with:

```bash
node -v
npm -v
```

If you don't have Node.js installed, you can download it from the [official website](https://nodejs.org/).

- A **Massa account**. If you don't have one, you can create one using the Massa Wallet available as a plugin of [Massa Station](https://station.massa.net/). You can follow the instructions in the [Massa Wallet documentation](https://docs.massa.net/docs/massaStation/massa-wallet/getting-started) to install the wallet and create an account.

### Installation

1. Install dependencies:

```bash
npm install
```

2. Build the CLI:

```bash
npm run build
```

3. The CLI will be stored in the `./bin` directory and can be run using:
```bash
npm run start
```

### Run in development mode

To run the CLI in development mode, you can use:

```bash
npm run dev
```
35 changes: 35 additions & 0 deletions server/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# DeWeb Server

DeWeb Server allows users to access websites stored on-chain through a web browser. It is also used by providers to allow any user from any platform to access the websites they have uploaded on-chain.

## Getting Started

### Prerequisites

Ensure you have `task` installed. Follow the instructions [here](https://taskfile.dev/installation/).

### Installation

1. Install required tools:

```bash
task install
```

2. Generate:

```bash
task generate
```

3. Build the server binary:

```bash
task build
```

4. The binary will be stored in the `./build` directory.

## Usage

You can find the usage instructions for DeWeb Server in the [DeWeb Server documentation](https://docs.massa.net/docs/deweb/local-server-config/server-config).
32 changes: 8 additions & 24 deletions server/Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,16 @@ tasks:
- cmd: cmd /C 'for %f in (pages\*.zip) do move %f int\api\resources\'
platforms: [windows]

run:
cmds:
- cmd: ./build/deweb-server

build:
cmds:
- task: build:server
- task: build:cli
- task: build:internal
vars:
APP_NAME: server
BIN_DIR: build

build:internal:
build:
Expand All @@ -42,28 +48,6 @@ tasks:
PRODUCTION: '{{.PRODUCTION | default "false"}}'
VERSION: "{{.VERSION | default nil}}"

build:server:
cmds:
- task: build:internal
vars:
APP_NAME: server
BIN_DIR: build

build:cli:
cmds:
- task: build:internal
vars:
APP_NAME: cli
BIN_DIR: build

run:cli:
cmds:
- cmd: ./build/deweb-cli

run:server:
cmds:
- cmd: ./build/deweb-server

clean:
cmds:
- cmd: rm -rf build
Expand Down
Loading

0 comments on commit 4e866ac

Please sign in to comment.