Initialize Server
The blocklet server init
command is the essential first step for setting up a new Blocklet Server instance. It creates the necessary configuration directory (.blocklet-server
) and files, including config.yml
and an encryption key file (.k
).
Usage#
To begin, navigate to your desired directory and run the command:
blocklet server init
This command can be run in two modes: interactive (default) or non-interactive (using flags).
Interactive Mode#
This is the recommended method for first-time setup. The command launches an interactive wizard that guides you through the configuration process. You will be prompted for key information such as:
- Server name and description.
- The primary port for the server daemon.
- The routing engine to use (e.g., Nginx).
- The URL for your preferred web wallet.
- Whether to enable HTTPS.
- Memory limits for the server and individual blocklets.
Non-Interactive Mode#
For automated deployments and scripting, you can provide all configuration options as flags. The --force
(or -f
) flag is useful for accepting all default values without prompting for confirmation.
Here is an example of a non-interactive setup:
blocklet server init \
--force \
--mode production \
--no-https \
--http-port 8080 \
--https-port 8443 \
--sk 'your-custom-secret-key' \
--web-wallet-url 'https://your-wallet.com'
Command Options#
The init
command supports various options to customize the initial setup. These are sourced from the command's definition file.
Option | Description | Default |
---|---|---|
| Initialize without asking any questions. |
|
| Run in interactive mode. This is ignored if |
|
| Set the initial server mode. Can be |
|
| Enable or disable default HTTPS support. | Enabled by default |
| Provide a custom secret key for the server's wallet. | A new key is generated. |
| Specify the URL for the web wallet. |
|
| Set the HTTP port for the service gateway. |
|
| Set the HTTPS port for the service gateway. |
|
| The DID that holds the ownership NFT. |
|
| The DID that issued the ownership NFT. |
|
| A trusted passport issuer DID for the node. |
|
| Disable the node's ability to issue passports. |
|
Generated Configuration File#
After a successful initialization, a config.yml
file is created. This file contains all the server's configuration and can be manually edited later. Below is a sample structure of the generated file, based on the logic in the init.js
script:
node:
name: My ABT Node
description: A new Blocklet Server instance
mode: production
version: 1.16.29 # The CLI version at the time of init
sk: encrypted-secret-key...
pk: public-key...
did: z...
port: 3030 # The daemon port
secret: session-secret...
owner: { pk: '', did: '' }
ownerNft:
holder: ''
issuer: ''
routing:
provider: nginx
adminPath: /admin
headers: { 'X-Powered-By': '"Blocklet Server/1.16.29"' }
maxUploadFileSize: 100
https: true
httpPort: 80
httpsPort: 443
wildcardCertHost: 'https://cert.arcblock.io'
ipWildcardDomain: .ip.abtnet.io
enableDefaultServer: false
enableIpServer: false
runtimeConfig:
daemonMaxMemoryLimit: 2048 # in MB
blockletMaxMemoryLimit: 1024 # in MB
didRegistry: 'https://did-registry.arcblock.io'
didDomain: did.abtnet.io
slpDomain: slp.abtnet.io
enablePassportIssuance: true
trustedPassports: []
webWalletUrl: 'https://web.abtwalle.io'
database:
engine: sqlite
blocklet:
port: 3030
initialize:
blocklets: []
With the server initialized, you are now ready to launch it.
Next, learn how to start the server daemon process.