deploy
The blocklet deploy command uploads and installs a bundled blocklet from your local machine to a Blocklet Server instance. This is the primary method for getting your blocklet running on a server, whether it's on your local machine for testing or a remote server for staging or production.
Before deploying, you must first package your blocklet using the bundle command.
Usage#
blocklet deploy <directory> [options]Deployment Scenarios#
You can deploy a blocklet to either a local or a remote Blocklet Server instance.
Deploying to a Local Server#
This is the most common scenario during development. When you deploy to a local server, the CLI simplifies the process by automatically creating and using a temporary access key.
Prerequisites:
- A local Blocklet Server must be running. You can start one with
blocklet server start. - You must know the DID of the application you want to deploy to. Blocklets are typically deployed as components within a parent application.
Example:
# Deploy the blocklet from the current directory
blocklet deploy . --app-id zApp_some_app_didDeploying to a Remote Server#
When you're ready to deploy to a staging or production environment, you'll target a remote Blocklet Server. There are two ways to authenticate with the remote server.
Using Access Keys#
You can provide an accessKey and accessSecret directly as command options. You can generate these credentials from your Blocklet Server's dashboard.
Example:
blocklet deploy ./dist --endpoint https://my-server.com --access-key <your-key> --access-secret <your-secret> --app-id zApp_some_app_didUsing DID Connect (Recommended)#
For a more secure and convenient workflow, you can omit the access key and secret. The CLI will automatically initiate a DID Connect session, prompting you to scan a QR code with your DID Wallet. This generates and securely stores the access credentials on your local machine for future deployments to that same server.
Example:
blocklet deploy . --endpoint https://my-server.com --app-id zApp_some_app_didIf no valid access key is found for this endpoint, the CLI will ask for confirmation to generate one:
No access key found, do you need to open the connect page to generate access key? (Y/n)This process is illustrated below:
Options#
Option | Alias | Description |
|---|---|---|
| The path to the directory containing the bundled blocklet. This is a required argument. | |
|
| The URL of the target Blocklet Server. If omitted, deploys to the local server. |
|
| The access key ID for authenticating with a remote server. |
|
| The access key secret for authenticating with a remote server. |
| The DID of the application on the server to which this blocklet will be deployed. This is required for all deployments. | |
|
| A custom URL path for the blocklet. If not provided, a path is automatically generated from the blocklet's title or name. |
| Enables incremental deployment, which only uploads files that have changed since the last deployment, speeding up the process. |
Deployment Flow#
The deploy command follows a series of steps to ensure a successful deployment, as shown in the diagram below.
After a successful deployment, your blocklet will be running on the target server. You can check its status using the server status command for local instances. If your goal is to distribute your blocklet, the next step is to publish it using the upload command.