Usage
The following examples assume a target directory deploy/
. All files related to node configuration and deployment will be stored here.
You can set the target directory with every command using --dir
, or you can set it once as an ENV variable:
Node Configuration
To pull plug-and-play node configurations, you can use config
.
Usage
Usage: infernet-cli config [OPTIONS] {anvil|base|base-sepolia|eth|other}
Pull node configurations.
Options:
-v, --version TEXT The version of the node to configure.
-d, --dir TEXT The directory to store and retrieve configuration files.
Can also set DEPLOY_DIR environment variable.
--gpu Enable GPU support for the node.
-i, --inputs TEXT The inputs to fill in the recipe. Should be a JSON
string of key-value pairs. If not provided, the user
will be prompted for inputs via the CLI.
-y, --yes Force overwrite of existing configurations.
--skip Skip optional inputs.
Example:
The output will look something like this:
No version specified. Using latest: v1.3.0
Using configurations:
Chain = 'anvil'
Version = '1.3.0'
GPU support = disabled
Output dir = 'deploy'
Stored base configurations to '/root/deploy'.
To configure services:
- Use `infernet-cli add-service`
- Or edit config.json directly
Notice that for demonstration purposes, we are using the --skip
flag to default optional inputs.
Inputs
Depending on your chain selection, some configuration will need user input in real time. For example, when configuring a node for Base Mainnet
, user will be prompted for their wallet's private_key
and an optional payment_address
.
The output will look something like the following. First, you will be prompted for a required input, the private_key
:
No version specified. Using latest: v1.3.0
Using configurations:
Chain = 'base'
Version = '1.3.0'
GPU support = disabled
Output dir = 'deploy'
"private_key" (string): Private key for the wallet (Required):
Enter value:
You should enter your private key followed by the return
key. Next, you'll be prompted for an optional payment_address
:
Assuming you don't need to accept payments just yet, you can simply skip it by hitting return
. You should then see output similar to the following:
Stored base configurations to '/root/deploy'.
To configure services:
- Use `infernet-cli add-service`
- Or edit config.json directly
Alternatively, the same inputs can be provided non-interactively as a JSON string, using the --inputs
option:
GPU
To deploy a GPU-enabled Infernet Node, just use the --gpu
flag. This assumes your machine is GPU-enabled.
The output will look something like this:
Using configurations:
Chain = 'base'
Version = '1.3.0'
GPU support = enabled
Output dir = 'deploy'
Stored base configurations to '/root/deploy'.
To configure services:
- Use `infernet-cli add-service`
- Or edit config.json directly
Service Configuration
To add service containers to the node, you can use add-service
.
You can configure a service either manually by providing a complete container specification, or using recipes.
Usage
Usage: infernet-cli add-service [OPTIONS] [RECIPE_ID]
Add a service to the node configuration.
Options:
-d, --dir TEXT The directory to store and retrieve configuration files.
Can also set DEPLOY_DIR environment variable.
-i, --inputs TEXT The inputs to fill in the recipe. Should be a JSON string
of key-value pairs. If not provided, the user will be
prompted for inputs via the CLI.
--skip Skip optional inputs.
Recipes
You can configure one or more official Ritual services using our pre-configured service recipes.
Similar to config inputs, you will be prompted for configuration parameters:
and
"NUM_WORKERS" (integer): The number of workers to use with the server. (RETURN to skip):
Enter value:
Notice that HF_TOKEN
is required, but NUM_WORKERS
can be skipped. You should expect to see the following output:
Alternatively, the same inputs can be provided non-interactively as a JSON string, using the --inputs
option:
Manually
You can also add custom service configurations via command-line:
You will be prompted to paste an entire service configuration:
To configure an identical service as above, you can paste the following:
{
"id": "hf-client-inference",
"image": "ritualnetwork/torch_inference_service:1.0.0",
"env": {"HF_TOKEN": "a0xxxxxxxxxxxxx"},
"command": "--bind=0.0.0.0:3000 --workers=2"
}
followed by EOF (Ctrl+D
on Linux / MacOS). You should see output similar to this:
Remove
You can remove a service configuration with remove-service
.
Usage
You can remove services by ID:
or remove all services:
Node Deployment
After configuring a node and adding some services, you can manage its lifecycle as follows:
Deploy
To create or start the node, use start
.
Usage
Example:
If successful, you should see:
Health
To check the health of the node and containers, use health
.
Usage
Example:
If successful, you should see:
Stop
To stop the node, use stop
.
Usage
Example:
If successful, you should see:
Reset
To reset the node, use reset
.
Usage
Example:
If successful, you should see:
By default, service containers are not reset when the node is stopped or destroyed. This is intended behavior to ensure pre-processing-heavy services are not repeatedly initialized. To force reset all service containers, use the --services
flag. This is a destructive operation:
If successful, you should see:
Resetting Infernet Node...
Containers stopped successfully.
Destroying service containers...
Containers started successfully.
Destroy
To destroy the node, use destroy
.
Usage
Usage: infernet-cli destroy [OPTIONS]
Destroy the Infernet Node.
Options:
-d, --dir TEXT The directory to store and retrieve configuration files. Can
also set DEPLOY_DIR environment variable.
--services Force removal of service containers. Destructive operation.
-y, --yes No manual y/n confirmation required.
Example:
If successful, you should see:
By default, service containers are not destroyed when the node is stopped or destroyed. This is intended behavior to ensure pre-processing-heavy services are not repeatedly initialized. To force destroy all service containers, use the --services
flag. This is a destructive operation:
If successful, you should see: