banner
0xjokereven

0xjokereven

All is for consistent
twitter
github
pixiv
jike
medium

Installation and Usage of Fluence CLI

Fluence CLI is a one-stop command-line interface for creating, deploying, paying for, running, monitoring, and removing Fluence Cloudless resources.

INFO
Fluence CLI supports Linux and macOS, and currently provides experimental support for Windows. Learn more here.

Installing Fluence CLI
Before installing Fluence CLI, you need to install Node.js. The fastest way is to use the installation script. Copy and paste the following command into the command line and press enter:

sh
Copy code
curl -qsL https://raw.githubusercontent.com/fluencelabs/cli/main/install.sh | bash
This process may take some time and depending on your settings, you may be prompted to use sudo to create symbolic links. After installation, make sure to use fluence update stable to update to the latest version, and then check the version number, which should be similar to the following output:

sh
Copy code
$ fluence --version
@fluencelabs/cli/0.15.10 darwin-arm64 node-v18.19.1
You can also update the CLI to a specific network version, such as dar or kras, using fluence update dar or fluence update kras respectively. In general, updating to stable is the preferred and relatively safe choice. For more documentation, please refer to the Fluence CLI repository.

Dependencies
The installation script handles the installation process, including installing Node.js and npm. In addition, the CLI will lazily install a set of Fluence libraries and SDKs, as well as Rust, when necessary.

You can use Fluence CLI to list and manage dependencies. Let's see what is installed:

sh
Copy code
$ fluence dep v
If this is your first time using Fluence CLI, the output may be different:

sh
Copy code
Fluence CLI version: 0.15.5
nox version: fluencelabs/nox:0.20.1
rust toolchain: nightly-2023-08-27-x86_64
aqua dependencies that you can install or update using 'fluence dep i @':
"@fluencelabs/aqua-lib": 0.9.1
"@fluencelabs/spell": 0.6.9
marine and mrepl dependencies that can be overridden in fluence.yaml using marineVersion and mreplVersion properties:
marine: 0.19.2
mrepl: 0.26.2
internal dependencies:
"@fluencelabs/air-beautify-wasm": 0.3.6
"@fluencelabs/aqua-api": 0.14.2
"@fluencelabs/aqua-to-js": 0.3.5
"@fluencelabs/deal-ts-clients": 0.6.1
"@fluencelabs/fluence-network-environment": 1.1.2
"@fluencelabs/js-client": 0.8.3
"@fluencelabs/npm-aqua-compiler": 0.0.3
internal aqua dependencies:
"@fluencelabs/installation-spell": 0.6.9
js-client dependencies:
"@fluencelabs/avm": 0.59.0
"@fluencelabs/marine-worker": 0.5.1
"@fluencelabs/threads": ^2.0.0
"@fluencelabs/interfaces": 0.11.0
"@fluencelabs/js-client-isomorphic": 0.5.0
Fluence CLI only installs the necessary content and lazily adds missing dependencies as needed. This includes dependencies required for developing compute functions, such as Rust and various Marine dependencies. However, you can install all dependencies at once, including Rust:

sh
Copy code
$ fluence dep i
Additionally, you can use fluence dep reset and fluence dep uninstall to reset dependencies to the default values of the CLI version or uninstall a specific version.

::: info Your Rust setup requires the wasm32-wasi compilation target to generate Wasm modules. You can check your system using rustup target list --installed|grep wasm32. If the wasm32-wasi target is missing, use rustup target install wasm32-wasi to install it. :::

Dependency installation and management are located in the ~/.fluence directory. Let's take a look:

$ tree -L 3 ~/.fluence
/Users/bebo/.fluence
├── cargo
│ ├── marine
│ │ ├── 0.17.0
│ │ ├── 0.19.0
│ │ └── 0.19.2
│ └── mrepl
│ ├── 0.24.0
│ ├── 0.26.0
│ └── 0.26.2
├── cli
│ ├── LICENSE
│ ├── README.md
│ ├── bin
│ │ ├── dev.js
│ │ ├── fluence
│ │ ├── fluence.cmd
│ │ ├── node
│ │ └── run.js
│ ├── dist
│ │ ├── baseCommand.d.ts
│ │ ├── baseCommand.js
│ │ └── versions.json
│ ├── node_modules
│ │ ├── @achingbrain
│ │ └── zod
│ ├── package.json
│ └── yarn.lock
├── config.yaml
├── npm
│ └── @fluencelabs
│ ├── aqua-lib
│ ├── registry
│ └── spell
├── schemas
│ └── config.json
├── secrets
│ └── auto-generated.txt
└── tmp
├── cargo
└── npm
└── @fluencelabs
615 directories, 25 files
Your output may be different, but you should notice that different versions of specific packages can be globally installed, i.e., in the ~/.fluence directory, and pinned to specific CLI projects. This will be explained in more detail later.

Please note that if you want to use the Fluence local network, Docker needs to be installed.

Target Audience
Fluence CLI supports the needs of developers, capacity providers, and delegators. Some features are shared, while others are specific to each target and are covered under the fluence provider and fluence delegator topics respectively.

CLI Quick Guide
As mentioned earlier, the Fluence Cloudless development and production ecosystem consists of different networks, ranging from the main production network to local networks. These networks sometimes represent different forks and require different dependency versions to work properly. Fluence CLI allows you to switch development environments and maintain the appropriate dependencies based on your target.

CLI Version Management
To update the CLI version to the correct environment, use the fluence update command:

$ fluence update [CHANNEL] [-a] [--force] [-i | -v ]
If you want to update the version to the latest dar (testnet) version, run:

$ fluence update kras
For more examples, see fluence update --help.

Fluence CLI Templates
The CLI provides several templates that allow you to quickly create projects based on your needs:

minimal
Basic template without pre-filled compute services
quickstart
Template with pre-installed compute services
ts
Template for compute services with a TypeScript frontend
js
Template for compute services with a JavaScript frontend

Fluence CLI Key Management
To enable Fluence CLI to securely interact and communicate with nodes in Fluence's off-chain peer-to-peer compute network, encrypted keys are needed for encryption and authentication. By default, the CLI creates and manages these keys, which are stored in the ~/.fluence/secrets directory and are applicable to all projects unless you create keys specific to a particular project. Project keys are stored by default in the project's .fluence/secrets directory or any other specified location.

$ fluence key new
? Enter secret key name to generate at /keys-demo/.fluence/secrets: my-project-keys
? Do you want to set my-project-keys as default secret key at /keys-demo/fluence.yaml: Yes
Secret key with name my-project-keys successfully generated and saved to /keys-demo/.fluence/secrets
For all related information about keys, see fluence key --help.

INFO
The keys created and managed by Fluence CLI are used for node identification and content encryption in Fluence's off-chain peer-to-peer compute network. Fluence CLI is not responsible for managing your cryptocurrency (wallet) keys.

Creating a Project
You can use the fluence init command to create a Fluence project, which provides options to name and configure your template:

$ fluence init [PATH] [--no-input] [-t ] [--env ] [--noxes ]
``

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.