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

start


Starts the Blocklet Server daemon and all its related services. This command is the primary way to bring your Blocklet Server instance online based on its configuration.

Before starting the server, ensure you have an initialized configuration. If not, please see the server init command. To stop a running server, use server stop.

Usage#

blocklet server start [options]

Options#

Option

Description

--update-db

Forces the server's database to be updated with the settings from the configuration file (blocklet.yml). This is useful when you've manually changed the configuration and want to apply it to the running instance.

--auto-init

Initializes a new Blocklet Server instance in the current directory if one doesn't already exist, then starts it. This streamlines the setup process for new instances.

--force-intranet

Forces the server to run in intranet mode, ignoring any external IP addresses.

--mode <mode>

Starts the server in a specific mode, such as maintenance. This overrides the mode set in the configuration file.

-k, --keep-alive

Keeps the CLI process attached to the server after it starts. This is particularly useful for environments like Docker, where the container exits if the primary process finishes. When this flag is used, the CLI will continue running and will exit only when the Blocklet Server stops.

Startup Process#

The start command executes a series of steps to ensure the server and its components are launched correctly and in the right order.

No instance running

Instance running

Yes

then

No

Lock file exists

No lock file

Differences found & --update-db

Healthy

Unhealthy

Yes

No

No differences or no flag

Start Core Processes with PM2

Event Hub

Blocklet Service

Daemon

blocklet server start

Check for running instance

Check start.lock

Switch instance?

Stop old instance

Exit

Error: Server is starting

Create start.lock

Ensure dependencies: Redis, Postgres

Run migrations

Check for config vs. DB differences

Update DB from config

Perform health checks

Print access URLs

Log error & stop

--keep-alive?

Attach to logs & wait

Exit with success code

Cleanup & exit with error code


Key Concepts#

Configuration Synchronization#

Blocklet Server maintains its configuration in two places: the blocklet.yml file and an internal database. When the server starts, it compares these two sources. If it detects any differences, it will print a warning table.

$ blocklet server start

⚠️ We found that there are some differences between config file and database
┌──────────────────┬─────────────────┬──────────┐
│ Name │ Configuration │ Database │
├──────────────────┼─────────────────┼──────────┤
│ didDomain │ new.domain.com │ old.domain.com │
└──────────────────┴─────────────────┴──────────┘
ℹ️ If you want to update the database, restart node with --update-db flag

To apply the changes from blocklet.yml to the database, use the --update-db flag:

blocklet server start --update-db

Version Compatibility#

To ensure stability, the CLI checks if its version is compatible with the version specified in the server's configuration file. It follows semantic versioning rules, allowing minor and patch updates but preventing major version mismatches. If a mismatch occurs, the command will fail with an error message, prompting you to install a compatible CLI version.

This check can be skipped by setting the environment variable ABT_NODE_SKIP_VERSION_CHECK=true, but this is not recommended for production environments.

Automatic Initialization#

If you are setting up a new server, the --auto-init flag simplifies the process by combining initialization and starting into a single command. If a configuration file is not found in the current directory, it will be created automatically before the server starts.

# In a new, empty directory
mkdir my-node && cd my-node

# Initialize and start the server in one go
blocklet server start --auto-init

Troubleshooting#

If the server fails to start, the command will output an error message. For more details, check the daemon's error log file. The location of this file can be found using the server logs command. A common location is ~/.abtnode/logs/daemon.stderr.log.

After a failed start, some processes might be left running. You can perform a clean stop using:

blocklet server stop --force


After successfully starting the server, you can check its status with server status or view logs with server logs.