Skip to content

Commit

Permalink
Merge pull request #172 from ritual-net/sr/infernet-cli-implementation-1
Browse files Browse the repository at this point in the history
[main-1] Infernet CLI implementation
  • Loading branch information
arshan-ritual authored Oct 30, 2024
2 parents c846c1b + c273326 commit bf2e1c2
Show file tree
Hide file tree
Showing 49 changed files with 2,663 additions and 29 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/python_libraries_ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
library: [ "infernet_client", "infernet_ml", "ritual_arweave" ]
library: [ "infernet_cli", "infernet_client", "infernet_ml", "ritual_arweave" ]
python-version: [ "3.10", "3.11" ]
fail-fast: false

Expand Down
2 changes: 1 addition & 1 deletion infernet_services/requirements-e2e-tests.lock
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ humanfriendly==10.0
hypercorn==0.17.3
hyperframe==6.0.1
idna==3.10
infernet-client==1.0.3.9
infernet-client==1.4.0
infernet-ml==2.0.0
iniconfig==2.0.0
itsdangerous==2.2.0
Expand Down
8 changes: 4 additions & 4 deletions infernet_services/requirements-e2e-tests.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ web3>=6.15.1,<7.0.0
reretry>=0.11.8,<1.0.0
retry2>=0.9.5,<1.0.0
pydantic>=2.5.3,<3.0.0
infernet-ml>=2.0.0.81,<3.0.0
infernet-ml[torch_inference]>=2.0.0.81,<3.0.0
infernet-ml[onnx_inference]>=2.0.0.81,<3.0.0
infernet-ml[ezkl]>=2.0.0.81,<3.0.0
infernet-ml>=2.0.0,<3.0.0
infernet-ml[torch_inference]>=2.0.0,<3.0.0
infernet-ml[onnx_inference]>=2.0.0,<3.0.0
infernet-ml[ezkl]>=2.0.0,<3.0.0
infernet-client>=1.0.3.9,<2.0.0
torch>=2.0.1,<3.0.0
reretry>=0.11.8,<1.0.0
Expand Down
2 changes: 1 addition & 1 deletion infernet_services/requirements-precommit.lock
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ hypercorn==0.17.3
hyperframe==6.0.1
identify==2.6.1
idna==3.10
infernet-client==1.0.3.9
infernet-client==1.4.0
infernet-ml==2.0.0
iniconfig==2.0.0
isort==5.13.2
Expand Down
2 changes: 1 addition & 1 deletion infernet_services/requirements-precommit.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ mypy>=1.9.0,<2.0.0
quart>=0.19.4,<1.0.0
pre-commit>=3.6.2,<4.0.0
pandas>=2.2.2,<3.0.0
infernet-ml>=2.0.0.78,<3.0.0
infernet-ml>=2.0.0,<3.0.0
infernet-ml[onnx_inference]>=2.0.0.78,<3.0.0
infernet-ml[torch_inference]>=2.0.0.78,<3.0.0
infernet-ml[css_inference]>=2.0.0.78,<3.0.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ RUN apt-get update
RUN apt-get install -y git curl

# install uv
RUN curl -LsSf https://astral.sh/uv/0.2.33/install.sh | sh
RUN curl -LsSf https://astral.sh/uv/0.4.28/install.sh | sh
COPY requirements.lock .

ARG index_url
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
eth-abi>=5.1.0,<6.0.0
infernet-ml>=2.0.0.81,<3.0.0
infernet-ml[css_inference]>=2.0.0.81,<3.0.0
infernet-ml>=2.0.0,<3.0.0
infernet-ml[css_inference]>=2.0.0,<3.0.0
quart>=0.19.4,<1.0.0
python-dotenv>=1.0.1,<2.0.0
pydantic>=2.5.3,<3.0.0
2 changes: 1 addition & 1 deletion infernet_services/services/ezkl_proof_service/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ RUN apt-get update
RUN apt-get install -y git curl

# install uv
RUN curl -LsSf https://astral.sh/uv/0.2.33/install.sh | sh
RUN curl -LsSf https://astral.sh/uv/0.4.28/install.sh | sh
COPY requirements.lock .

ARG index_url
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ ENV PYTHONPATH src
RUN apt-get update && apt-get install -y curl

# install uv
RUN curl -LsSf https://astral.sh/uv/0.2.33/install.sh | sh
RUN curl -LsSf https://astral.sh/uv/0.4.28/install.sh | sh
COPY requirements.lock .

ARG index_url
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ RUN apt-get update
RUN apt-get install -y git curl

# install uv
RUN curl -LsSf https://astral.sh/uv/0.2.33/install.sh | sh
RUN curl -LsSf https://astral.sh/uv/0.4.28/install.sh | sh
COPY requirements.lock .

ARG index_url
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
click>=8.1.7,<9.0.0
eth-abi>=5.1.0,<6.0.0
infernet-ml>=2.0.0.81,<3.0.0
infernet-ml[hf_inference]>=2.0.0.81,<3.0.0
infernet-ml>=2.0.0,<3.0.0
infernet-ml[hf_inference]>=2.0.0,<3.0.0
quart>=0.19.4,<1.0.0
pydantic>=2.5.3,<3.0.0
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ RUN apt-get update
RUN apt-get install -y git curl

# install uv
RUN curl -LsSf https://astral.sh/uv/0.2.33/install.sh | sh
RUN curl -LsSf https://astral.sh/uv/0.4.28/install.sh | sh
COPY requirements.lock .

ARG index_url
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
click>=8.1.7,<9.0.0
eth-abi>=5.1.0,<6.0.0
quart>=0.19.4,<1.0.0
infernet-ml>=2.0.0.81,<3.0.0
infernet-ml[onnx_inference]>=2.0.0.81,<3.0.0
infernet-ml[onnx_inference_gpu]>=2.0.0.81,<3.0.0; platform_system != "Darwin"
infernet-ml>=2.0.0,<3.0.0
infernet-ml[onnx_inference]>=2.0.0,<3.0.0
infernet-ml[onnx_inference_gpu]>=2.0.0,<3.0.0; platform_system != "Darwin"
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ RUN apt-get update
RUN apt-get install -y git curl

# install uv
RUN curl -LsSf https://astral.sh/uv/0.2.33/install.sh | sh
RUN curl -LsSf https://astral.sh/uv/0.4.28/install.sh | sh
COPY requirements.lock .

ARG index_url
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
eth-abi>=5.1.0,<6.0.0
infernet-ml>=2.0.0.81,<3.0.0
infernet-ml[tgi_inference]>=2.0.0.81,<3.0.0
infernet-ml>=2.0.0,<3.0.0
infernet-ml[tgi_inference]>=2.0.0,<3.0.0
quart>=0.19.4,<1.0.0
pydantic>=2.5.3,<3.0.0
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ RUN apt-get update
RUN apt-get install -y git curl

# install uv
RUN curl -LsSf https://astral.sh/uv/0.2.33/install.sh | sh
RUN curl -LsSf https://astral.sh/uv/0.4.28/install.sh | sh
COPY requirements.lock .

ARG index_url
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
infernet-ml>=2.0.0.81,<3.0.0
infernet-ml[torch_inference]>=2.0.0.81,<3.0.0
infernet-ml>=2.0.0,<3.0.0
infernet-ml[torch_inference]>=2.0.0,<3.0.0
quart>=0.19.4,<1.0.0
2 changes: 1 addition & 1 deletion infernet_services/test_services/echo/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ RUN apt-get update
RUN apt-get install -y git curl

# install uv
RUN curl -LsSf https://astral.sh/uv/0.2.33/install.sh | sh
RUN curl -LsSf https://astral.sh/uv/0.4.28/install.sh | sh
COPY requirements.lock .

ARG index_url
Expand Down
2 changes: 1 addition & 1 deletion infernet_services/test_services/echo/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Flask>=3.0.0,<4.0.0
gunicorn>=21.2.0,<22.0.0
web3>=6.17.1,<7.0.0
infernet-ml>=2.0.0.81,<3.0.0
infernet-ml>=2.0.0,<3.0.0
7 changes: 7 additions & 0 deletions libraries/infernet_cli/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
**/deploy/**
**/backup/**

# docs reference
docs/reference/

mkdocs.yml
1 change: 1 addition & 0 deletions libraries/infernet_cli/.python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.11.8
11 changes: 11 additions & 0 deletions libraries/infernet_cli/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Changelog

All notable changes to this project will be documented in this file.

- ##### The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- ##### This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.0.0] - XXXX-XX-XX

### Added
- Initial release of Infernet CLI.
4 changes: 4 additions & 0 deletions libraries/infernet_cli/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
update-lockfile:
uv venv -p 3.11 && source .venv/bin/activate && \
uv pip install -r pyproject.toml && \
uv pip freeze | grep -v infernet_cli > requirements.lock && rm -rf .venv
3 changes: 3 additions & 0 deletions libraries/infernet_cli/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Infernet CLI

See [infernet-cli.docs.ritual.net](infernet-cli.docs.ritual.net) or refer to `infernet_cli/docs`.
Binary file added libraries/infernet_cli/docs/assets/favicon.webp
Binary file not shown.
14 changes: 14 additions & 0 deletions libraries/infernet_cli/docs/assets/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added libraries/infernet_cli/docs/assets/meta.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions libraries/infernet_cli/docs/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
site_name: Infernet CLI
site_description: Infernet CLI Documentation

nav:
- Usage: usage.md
83 changes: 83 additions & 0 deletions libraries/infernet_cli/docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@

# Infernet CLI

Infernet CLI is a tool that simplifies configuration and deployment of an [Infernet Node](https://github.com/ritual-net/infernet-node). Specifically, it enables:

1. Pulling plug-and-play [node configurations](https://github.com/ritual-net/infernet-recipes/tree/main/node) for different chains, with the ability to further configure and customize them.
2. Adding plug-and-play [service configurations](https://github.com/ritual-net/infernet-recipes/tree/main/services) to your node.
3. Creating, managing, and destroying a node.

## Prerequisites

- [Python >= 3.9](https://www.python.org/downloads/)
- [Docker Desktop](https://docs.docker.com/get-started/get-docker/) or ([Docker Engine](https://docs.docker.com/engine/install/) + [Docker Compose](https://docs.docker.com/compose/install/)).

## Installation
You can either install `infernet-cli` via [`uv`](https://astral.sh/blog/uv) (recommended) or via `pip`.

=== "uv"

``` bash
uv pip install infernet-cli
```

=== "pip"

``` bash
pip install infernet-cli
```

## Quickstart

Here's how you can **configure** a node connected to a local Anvil chain:

```bash
export DEPLOY_DIR=deploy/

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
```

You can add an ML service, e.g. `onnx-inference`, as follows:

```bash
infernet-cli add-service onnx-inference --skip
```

The output will look something like this:

```
Version not provided. Using latest version '2.0.0'.
Successfully added service 'onnx-inference-2.0.0' to config.json.
```

You can then **deploy** the node:

```bash
infernet-cli start
```

and check that it's **healthy**:

```bash
infernet-cli health
```

## More Options

To see all the available commands and options, head over to the [Usage](usage.md) documentation.
25 changes: 25 additions & 0 deletions libraries/infernet_cli/docs/overrides/main.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{% extends "base.html" %}

{% block extrahead %}
{% set title = config.site_name %}
{% if page and page.meta and page.meta.title %}
{% set title = title ~ " - " ~ page.meta.title %}
{% elif page and page.title and not page.is_homepage %}
{% set title = title ~ " - " ~ page.title | striptags %}
{% endif %}
<meta property="og:type" content="website"/>
<meta property="og:title" content="{{ title }}"/>
<meta property="og:description" content="{{ config.site_description }}"/>
<meta property="og:url" content="https://infernet-cli.docs.ritual.net"/>
<meta property="og:image" content="https://infernet-cli.docs.ritual.net/assets/meta.png"/>

<meta property="twitter:card" content="summary_large_image"/>
<meta property="twitter:url" content="https://infernet-cli.docs.ritual.net"/>
<meta property="twitter:title" content="Infernet CLI"/>
<meta property="twitter:description" content="Configuration and deploy of Infernet Nodes"/>
<meta property="twitter:image" content="https://infernet-cli.docs.ritual.net/assets/meta.png"/>

<meta property="og:image:type" content="image/png"/>
<meta property="og:image:width" content="2400"/>
<meta property="og:image:height" content="1350"/>
{% endblock %}
Loading

0 comments on commit bf2e1c2

Please sign in to comment.