blocklet server


The blocklet server command is the primary tool for managing the lifecycle and configuration of your Blocklet Server instance. It allows you to initialize, start, stop, and monitor the server and all the blocklets running on it. These commands are essential for server administrators and developers who are self-hosting Blocklet Server.

For managing individual blocklets (e.g., creating, developing, deploying), see the blocklet command reference.

Usage#

Basic Usage

blocklet server <command> [options]

Global Options#

These options can be used with any blocklet server subcommand.

-c, --config [node-config]
string
Specifies the path to the Blocklet Server configuration file.
-y, --yes
boolean
default:false
Automatically answers 'yes' to any prompts, useful for scripting.


Commands#

init#

Initializes a new Blocklet Server configuration in the current directory. This command creates the necessary files and folders, including the main config.yml file.

Usage#

blocklet server init [options]

Options#

-f, --force
boolean
default:false
Initialize a Blocklet Server instance without asking any questions, accepting all default values.
-i, --interactive
boolean
default:false
Run in interactive mode to customize the configuration. This is ignored if `--force` is used.
--mode <mode>
string
default:production
Sets the initial server mode. Allowed values are `production` and `debug`.
--https
boolean
default:true
Enable default HTTPS support for the dashboard and blocklets.
--no-https
boolean
Disable default HTTPS support.
--sk <custom-sk>
string
Provide a custom secret key for the Blocklet Server.
--web-wallet-url <url>
string
Specify a custom web wallet URL.
--http-port <httpPort>
number
default:80
Set the HTTP port for the service gateway.
--https-port <httpsPort>
number
default:443
Set the HTTPS port for the service gateway.
--owner-nft-holder <ownerNftHolderDid>
string
The DID of the account that holds the ownership NFT.
--owner-nft-issuer <ownerNftIssuerDid>
string
The DID of the account that issued the ownership NFT.
--trusted-passport-issuer <passportIssuerDid>
string
The DID of a passport issuer that is trusted by this node.
--disable-passport-issuance
boolean
default:false
Disable the issuance of passports by this node.

start#

Starts the Blocklet Server as a background daemon process based on the configuration in the current directory.

Usage#

blocklet server start [options]

Options#

-u, --update-db
boolean
Update the Blocklet Server database with the latest settings from the config file.
--update-blocklet-env
boolean
default:false
Update the environments for all installed blocklets.
-k, --keep-alive
boolean
default:false
Keep the command running without exiting after the server starts successfully.
-a, --auto-init
boolean
default:false
If a configuration directory does not exist, initialize it automatically before starting.
-m, --force-mode <forceMode>
string
Force the server to start in a specified mode (e.g., `production`, `debug`, `maintenance`).
--force-intranet
boolean
default:false
Force the server to run in intranet mode, ignoring any external IP addresses.

stop#

Stops the running Blocklet Server and all associated blocklet processes gracefully.

Usage#

blocklet server stop [options]

Options#

-f, --force
boolean
default:false
Forcefully stop all Blocklet Server related processes immediately.

status#

Checks and displays the current status of the Blocklet Server, including its mode, data directory, and the status of all installed blocklets.

Usage#

blocklet server status [options]

Options#

--force-intranet
boolean
default:false
Force status check to use intranet mode, ignoring any external IP addresses.

logs#

Shows the file paths for Blocklet Server and individual blocklet log files for easy access and debugging.

Usage#

blocklet server logs

upgrade#

Upgrades the Blocklet Server CLI to the latest available version from the npm registry.

Usage#

blocklet server upgrade

info#

Gathers and displays environment information useful for debugging and reporting issues. This includes OS, binaries (Node, npm), server configuration, and network details.

Usage#

blocklet server info [options]

Options#

-C, --clipboard
boolean
default:false
Automatically copy the environment information to the clipboard.

cleanup#

Performs various server-level cleanup tasks.

Usage#

blocklet server cleanup [options]

Options#

--target <target>
string
required

Specifies the cleanup target. Available options are: cache, maintenance-status, blacklist, blacklist-expired.

migrate#

Migrates the Blocklet Server database from one system to another. Currently supports migration from SQLite to PostgreSQL.

Usage#

blocklet server migrate [options]

Options#

--dialect <dialect>
string
required

The database dialect to migrate to. Available options are sqlite and postgres.

nginx#

Configures Nginx as a reverse proxy for Blocklet Server. This is useful for production environments where Nginx can handle tasks like SSL termination and load balancing.

Usage#

blocklet server nginx [options]

Options#

--setup
boolean
Set up the Nginx environment for Blocklet Server. This typically requires sudo privileges.