Used to check for browser translation.
用于检测浏览器翻译。
ブラウザの翻訳を検出する

Install Blocklet CLI

Tutorials
Product / Blocklet Server
ArcBlock
2023-11-30 06:35
· edited

Blocklet CLI is a command line tool that can be used to manage both blocklet server and blocklets, while Blocklet Server provides the runtime environment for blocklets, you need to run blocklet server locally when developing Blocklet.

Install Blocklet CLI#

You can install the Blocklet CLI with your preferred package manager:

npm install -g @blocklet/cli
# yarn global add @blocklet/cli
# pnpm add -g @blocklet/cli

Check if installation is successful:

blocklet -V

Powered By
____ _ _ _
/ \ _ __ ___| __ )| | ___ ___| | __
/ _ \ | '__/ __| _ \| |/ _ \ / __| |/ /
/ ___ \| | | (__| |_) | (_) | (__| <
/_/ \_\_| \___|____/|_|\___/ \___|_|\_\\

Blocklet CLI v1.16.19

1.16.19

If you are prompted with command not found: blocklet, you need to configure additional global environment variables:

# Take yarn as an example, other package management tools are similar

# Run the command to see the global bin directory of yarn.
yarn global bin

# Add this directory to your PATH environment variable
open ~/.bashrc

# Write the follow text to .bashrc
export PATH="$PATH:$(yarn global bin)"

# Save the file, reload your shell or restart your terminal.
source ~/.bashrc

Installing Nginx#

We recommend using Nginx as the routing engine for Blocklet Server for better performance.

If you cannot install Nginx, you can skip this step and use Blocklet Server's built-in routing engine.

Nginx version: >= 1.18.0

Install on a Mac (using Homebrew)

Install on Linux

Check if the installation is successful:

nginx -v
nginx version: nginx/1.21.6

Setup DID wallet#

See Setup DID wallet

Start Blocklet Server#

After installing the Blocklet CLI, you can use an empty directory to store the configuration and initialize the Blocklet Server.

  1. Run the mkdir -p ~/blocklet-server-data && cd ~/blocklet-server-data command to enter the directory. You can replace ~/blocklet-server-data with any other directory
  1. Run the blocklet server init command to initialize Blocklet Server
    After executing the init command, the system will confirm the directory where you want to store your configuration. After confirmation, the system will automatically generate your Blocklet Server configuration.
  1. Execute blocklet server start to start Blocklet Server
Example output
% blocklet server init
blocklet server v1.16.18
Are you sure to initialize a Blocklet Server instance in the current directory(/Users/bob/blocklet-server-data) Yes
✔ Blocklet Server configuration is successfully generated /Users/bob/blocklet-server-data/.blocklet-server/config.yml
ℹ blocklet server start

% blocklet server start
blocklet server v1.16.18
✔ Server schema successfully migrated: /Users/bob/blocklet-server-data/.blocklet-server/core/server.db
✔ Service schema successfully migrated: /Users/bob/blocklet-server-data/.blocklet-server/services/service.db
✔ certificate-manager schema successfully migrated: /Users/bob/blocklet-server-data/.blocklet-server/modules/certificate-manager/module.db
ℹ Server DID zNKty6TZ9jkvTQTDQphk12B1osEbsGXHXLFC
ℹ Server config from /Users/linchen/blocklet-server-data/.blocklet-server/config.yml
✔ Starting event hub... Done in 3.044s
✔ Updating wildcard certificates... Done in 1.145s
✔ Starting blocklet service... Done in 32.657s
✔ Starting server daemon... Done in 5.084s
✔ Fetching accessible IPs... Done in 12.142s
✔ Updating DID Domain... Done in 1.232s
✔ You can access your Blocklet Server with either of the following URLs

HTTP URLs:

- http://192.168.31.18/.well-known/server/admin/
- http://bbqa7ka3ty3it3tb4prpraivmdhyr7hfooiirymz6cm.did.abtnet.io/.well-known/server/admin/

Secure URLs (Recommended):

- https://192-168-31-18.ip.abtnet.io/.well-known/server/admin/


Access Blocklet Server#

After Blocklet Server starts successfully. You will see the URL of Blocklet Server in the terminal

HTTP URLs:

- http://192.168.3.28/.well-known/server/admin/
- http://xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.did.abtnet.io/.well-known/server/admin/

Secure URLs (Recommended):

- https://192-168-3-28.ip.abtnet.io/.well-known/server/admin/
Note: Please replace 192.168.3.28 with your local network IP

Stop Blocklet Server#

You can stop the blocklet server by executing the blocklet server stop command.



Sticker