upgrade
The blocklet server upgrade command updates your Blocklet Server to the latest available version. This ensures you have the newest features, performance improvements, and security patches. The command handles the entire process automatically, from checking for updates to restarting the server after the installation is complete.
This command is part of the server command group for managing your Blocklet Server instance. For a full list of related commands, see the server commands reference.
Usage#
To run the upgrade, execute the following command in your terminal:
blocklet server upgradeUpgrade Workflow#
The upgrade process follows a series of automated steps to ensure a safe and successful update. The workflow is illustrated below:
Key Steps Explained#
- Permission Check: Before making any changes, the command verifies if it has sufficient permissions to write to the Blocklet CLI's installation directory. If not, it will fail with an error message, often suggesting the use of
sudo. - Version Check: The command contacts the npm registry to find the latest published version of
@blocklet/cliand compares it with the currently installed version using semantic versioning. - Graceful Shutdown: If a Blocklet Server instance is currently running, the upgrade process will automatically stop it to prevent file conflicts or data corruption during the update.
- Installation: The command uses your system's default JavaScript package manager (like
npmoryarn) to download and install the latest version of the CLI. - Automatic Restart: If the server was running before the upgrade, the command will automatically restart it from its original data directory once the installation is complete. This ensures your services come back online without manual intervention.
Example#
Here is an example of the output you would see during a typical upgrade process:
$ blocklet server upgrade
ℹ Using blocklet server from /home/user/.nvm/versions/node/v18.17.1/bin/blocklet
ℹ Checking permissions...
ℹ Current version is 3.1.0, found latest version 3.2.0
ℹ Begin upgrade
ℹ Stopping Blocklet Server ...
ℹ Installing Blocklet Server by npm install -g @blocklet/cli@latest ...
added 1 package, and audited 571 packages in 6s
86 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
ℹ Restarting Blocklet Server ...
✔ Blocklet Server started
✔ Blocklet Server upgrade success, current version is 3.2.0If your Blocklet Server is already up-to-date, the command will inform you and exit:
$ blocklet server upgrade
ℹ The current version 3.2.0 is the latest version, no need to upgradeAfter a successful upgrade, it's a good practice to verify that your server and blocklets are running correctly. You can use the blocklet server status command to check their current state.