Skip to content

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:

export DEPLOY_DIR=deploy

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:

infernet-cli config anvil --skip

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.

infernet-cli config base

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:

"payment_address" (string): Payment address for the wallet (RETURN to skip):
    Enter value:

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:

infernet-cli config base -v "1.3.0" --inputs '{"private_key": "0xxxxxxxxxx"}'
# Same as above

GPU

To deploy a GPU-enabled Infernet Node, just use the --gpu flag. This assumes your machine is GPU-enabled.

infernet-cli config base --gpu --inputs '{"private_key": "0xxxxxxxxxx"}'

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.

infernet-cli add-service hf-client-inference:1.0.0

Similar to config inputs, you will be prompted for configuration parameters:

"HF_TOKEN" (string): The Hugging Face API token. (Required):
    Enter value:

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:

Successfully added service 'hf-client-inference:1.0.0' to config.json.

Alternatively, the same inputs can be provided non-interactively as a JSON string, using the --inputs option:

infernet-cli add-service hf-client-inference:1.0.0 --inputs '{"HF_TOKEN": "a0xxxxxxxxxxxxx"}'

Manually

You can also add custom service configurations via command-line:

infernet-cli add-service

You will be prompted to paste an entire service configuration:

Enter service configuration JSON, followed by EOF:

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:

Successfully added service 'hf-client-inference' to config.json.

Remove

You can remove a service configuration with remove-service.

Usage
Usage: infernet-cli remove-service [OPTIONS] [SERVICE_ID]

  Remove a service from the node configuration.

Options:
  -d, --dir TEXT  The directory to store and retrieve configuration files. Can
                also set DEPLOY_DIR environment variable.

You can remove services by ID:

infernet-cli remove-service hf-client-inference:1.0.0

or remove all services:

infernet-cli remove-service

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
Usage: infernet-cli start [OPTIONS]

  Start the Infernet Node.

Options:
  -d, --dir TEXT  The directory to store and retrieve configuration files. Can
                also set DEPLOY_DIR environment variable.

Example:

infernet-cli start

If successful, you should see:

# Starting Infernet Node...
# Containers started successfully.

Health

To check the health of the node and containers, use health.

Usage
Usage: infernet-cli health [OPTIONS]

  Check health of the Infernet Node.

Options:
  -d, --dir TEXT  The directory to store and retrieve configuration files. Can
                also set DEPLOY_DIR environment variable.

Example:

infernet-cli health

If successful, you should see:

All containers are up and running.

Stop

To stop the node, use stop.

Usage
Usage: infernet-cli stop [OPTIONS]

  Stop the Infernet Node.

Options:
  -d, --dir TEXT  The directory to store and retrieve configuration files. Can
                also set DEPLOY_DIR environment variable.

Example:

infernet-cli stop

If successful, you should see:

Stopping Infernet Node...
Containers stopped successfully.

Reset

To reset the node, use reset.

Usage
Usage: infernet-cli reset [OPTIONS]

  Reset 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.

Example:

infernet-cli reset

If successful, you should see:

Resetting Infernet Node...
Containers stopped successfully.
Containers started successfully.

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:

infernet-cli reset --services

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:

infernet-cli destroy -y

If successful, you should see:

Destroying Infernet Node...
Containers stopped successfully.
Containers destroyed successfully.

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:

infernet-cli destroy --services -y

If successful, you should see:

Destroying Infernet Node...
Containers stopped successfully.
Containers destroyed successfully.
Destroying service containers...