Initialize Server


The blocklet server init command initializes a new Blocklet Server instance by creating a dedicated configuration directory, .blocklet-server, in the current working directory. This directory contains the config.yml file and other necessary assets to run the server. The process can be executed interactively through a guided setup or non-interactively using command-line flags.

Usage#

To initialize a new server configuration, navigate to the desired directory and execute the following command:

Basic Initialization Command

blocklet server init

Executing this command without any flags will launch an interactive setup wizard to guide you through the configuration process.

Interactive Configuration#

When running in interactive mode, the CLI will prompt you for the necessary configuration details. The table below outlines each question, its description, and the default value provided.

Prompt

Description

Default Value

Naming the server?

A human-readable name for your Blocklet Server instance.

A randomly generated name (e.g., purple-shape-7133)

Description of the server?

A brief description outlining the server's purpose.

My Blocklet Server

Which port do you want your server to listen on?

The internal port for the Blocklet Server daemon process.

3030

Choose routing engine

The routing provider to manage incoming traffic (e.g., Nginx).

Automatically detects existing providers like nginx.

Where do you want to mount your admin dashboard?

The URL path for accessing the server's administrative interface.

/admin

Which web wallet do you want to use?

The URL of the web wallet to be integrated with the server.

Varies by environment.

Do you want to enable https support...

Enables or disables SSL/TLS for the dashboard and blocklets.

true

What's ip wildcard domain?

The domain for accessing blocklets via the server's IP address.

ip.abtnet.io

Where to download the wildcard certificate?

The URL for fetching wildcard certificates for HTTPS support.

https://releases.arcblock.io/certs/

Max Upload File Size allowed by the server (MB)?

The maximum file size permitted for uploads.

16 MB

Which http port do you want your service gateway to listen on?

The public-facing HTTP port for the routing engine.

80

Which https port do you want your service gateway to listen on?

The public-facing HTTPS port for the routing engine.

443

What is the max memory limit of Blocklet Server (GB)?

The maximum RAM allocated to the Blocklet Server daemon.

4 GB

What is the max memory limit of each Blocklet (GB)?

The maximum RAM allocated to each individual blocklet.

1 GB

Command Options#

The initialization process can be customized or automated using the following command-line options.

Option

Description

-y, --yes

Initializes the server non-interactively, accepting all default values. This is useful for automated scripts.

--force

An alias for -y and --yes.

--mode <mode>

Sets the server's operational mode. Valid options are production (default) and debug.

--no-https

Disables HTTPS support for the server. HTTPS is enabled by default.

--http-port <port>

Specifies the public-facing HTTP port for the service gateway, overriding the interactive prompt.

--https-port <port>

Specifies the public-facing HTTPS port for the service gateway, overriding the interactive prompt.

--sk <secret_key>

Provides a custom secret key to generate the server's wallet instead of creating a new random one.

--interactive

Forces the command to run in interactive mode, even if other non-interactive flags are present.

Non-Interactive Example#

To initialize a server without any prompts, use the -y flag. This command is ideal for scripting and automation.

Non-Interactive Initialization

blocklet server init -y --mode production --http-port 8080

Generated Files#

Upon successful initialization, the following files and directories are created in the current working directory:

  • .blocklet-server/: The primary configuration directory for the Blocklet Server instance.
  • .blocklet-server/config.yml: The main configuration file in YAML format. It stores all the settings provided during setup, such as the server name, ports, routing information, and wallet details.
  • .blocklet-server/.sock: A file containing the encryption key used to secure the server wallet's secret key within config.yml. This file is critical for wallet recovery and must be backed up securely.

Next Steps#

With the server configuration in place, the next step is to start the server. Proceed to the next section to learn how to start the Blocklet Server daemon.