|
1 |
| -# Infernet Services Registry |
| 1 | +# Infernet Recipes |
2 | 2 |
|
3 |
| -This is a collection of [recipes](#what-is-a-recipe) for running [Infernet](https://docs.ritual.net/infernet/about)-compatible services. This repo aims to: |
4 |
| - 1. Standardize service IDs across the Infernet network. |
5 |
| - 2. Document service descriptions, configurations, and data schemas. |
6 |
| - 3. Make it trivial to configure and run services on an [Infernet Node](https://docs.ritual.net/infernet/node/introduction) via [recipes](#what-is-a-recipe). |
| 3 | +This is a collection of [recipes](#what-is-a-recipe) that aims to simplify: |
| 4 | + 1. Configuring and running an [Infernet Node](https://docs.ritual.net/infernet/node/introduction). |
| 5 | + 2. Configuring and running [services](https://infernet-services.docs.ritual.net/) on an Infernet Node. |
7 | 6 |
|
8 |
| -To ensure consistent identification and configuration of official Infernet-compatible services across the network, Infernet Nodes **enforce** the use of recipes for official services. As such, you cannot run custom containers with an ID matching any of the official services under the `services/` directory; and you can ONLY run an official service using a [recipe](#what-is-a-recipe). |
| 7 | +## Node Recipes |
9 | 8 |
|
10 |
| -### Structure |
| 9 | +Node recipes reside under the `node/` directory. |
| 10 | +- Sub-directories `node/**` represent different connected chain configurations. |
| 11 | +- Sub-directories under each chain (e.g. `node/base/**`) represent Infernet Node versions. |
| 12 | +- Each directory `node/<chain>/<version>/` contains a `config.json`, the node recipe file, along with auxiliary files required for node deployment. |
11 | 13 |
|
12 |
| -- Services are represented by directories under `services/`, and are versioned using subdirectories. |
13 |
| -- Service IDs: |
14 |
| - - **Consist of** a `name` and a `version`, in the format `<name>_<version>`, corresponding to the directory `services/<name>/<version>` within this repo. |
15 |
| - - **Are reserved**, i.e. they uniquely describe a service across the [Infernet](https://docs.ritual.net/infernet/about) network. |
16 |
| -- Each `<name>/<version>/` is a directory that contains: |
17 |
| - - A `README.md` with the service description, configuration details, and input data structure. |
18 |
| - - A `recipe.json`, i.e. the recipe for running the Infernet-compatible service. |
| 14 | +## Service recipes |
19 | 15 |
|
20 |
| -### What is a Recipe? |
21 |
| - |
22 |
| -Recipes are `json` files used to [configure containers](https://docs.ritual.net/infernet/node/configuration/v1_1_0#containers-arraycontainer_spec) (i.e. _services_) on an [Infernet Node](https://docs.ritual.net/infernet/node/introduction). They are identified by a `name` and a `version`. |
23 |
| - |
24 |
| -#### Rules |
| 16 | +Service (container) recipes reside under `services/`. |
| 17 | +- Sub-directories `services/**` represent different Infernet-compatible [services](https://infernet-services.docs.ritual.net/). |
| 18 | +- Sub-directories under each service (e.g. `services/onnx-inference/**`) represent service versions. |
| 19 | +- Each directory `services/<service>/<version>/` contains a `recipe.json`, the service recipe file, along with a README with more details. |
25 | 20 |
|
26 |
| -- Recipes **must** contain: |
27 |
| - - `id` (`string`): Service ID. |
28 |
| - - `image` (`string`): [Dockerhub](https://hub.docker.com) image ID. |
29 |
| -- Recipes **may** contain: |
30 |
| - - `command` (`string`): Command to run the container with. |
31 |
| - - `env` (`object`): Environment variables to pass into the container. |
32 |
| - - `description` (`string`): A brief description of the service. |
33 |
| -- The above _may_ contain __templated__ variables that must be specified by the node operator, in the form of `${TEMPLATED_VARIABLE}` (see `recipe_vars` below). |
34 |
| - - Some templated variables are _required_, others may be optional and defaulted. |
35 |
| - |
36 |
| -#### Usage |
37 |
| - |
38 |
| -To use a recipe, you must specify: |
39 |
| -- `recipe_id` (`string`): The Service ID of the desired service, i.e. `<name>_<version>`. |
40 |
| -- `recipe_vars` (`object`, optional): The variables to substitute for any templated recipe variables. |
| 21 | +### What is a Recipe? |
41 | 22 |
|
42 |
| -See Infernet's [container configuration](https://docs.ritual.net/infernet/node/configuration/v1_1_0#container_spec-object) docs for complete configuration instructions. |
| 23 | +Recipes are `json` files that contain: |
| 24 | +- A `config` section, which is the (incomplete) configuration object with several required and/or optional fields pre-specified. |
| 25 | +- An `inputs` section, which describes the user inputs necessary to transform the `config` into a complete configuration object. See [Inputs](#inputs). |
| 26 | + |
| 27 | +#### Inputs |
| 28 | + |
| 29 | +Recipe inputs are specified by the following fields: |
| 30 | +- `id` (string): The ID of the variable. |
| 31 | +- `path` (string): The path in the `config` object where the variable belongs. See [Path Rules](#path-rules). |
| 32 | +- `type` (string): The type of the variable. |
| 33 | +- `required` (boolean): Whether user input is required. |
| 34 | +- `default` (any, _optional_): The default value of the variable, if applicable. |
| 35 | +- `description` (string, _optional_): The description of the variable. |
| 36 | + |
| 37 | +#### Path Rules |
| 38 | + |
| 39 | +Object properties within the `config` object are specified as paths joined by `.` (dots). For example, path |
| 40 | + |
| 41 | +```js |
| 42 | +chain.wallet.private_key |
| 43 | +``` |
| 44 | +refers to |
| 45 | +```js |
| 46 | +config["chain"]["wallet"]["private_key"] |
| 47 | +``` |
| 48 | + |
| 49 | +**Partial substitutions** are also possible with the `#`. For example, path |
| 50 | +```js |
| 51 | +command#NUM_WORKERS |
| 52 | +``` |
| 53 | + |
| 54 | +refers to the substring `${NUM_WORKERS}` within |
| 55 | +```js |
| 56 | +config["command"] |
| 57 | +``` |
0 commit comments