Skip to content

Commit

Permalink
feat(vm): add vmConfig to computePeer.nox (#1009)
Browse files Browse the repository at this point in the history
* feat(vm): add vmConfig to computePeer.nox

* Apply automatic changes

* fix(config): vmConfig => vm

* Apply automatic changes

---------

Co-authored-by: folex <[email protected]>
  • Loading branch information
folex and folex authored Aug 29, 2024
1 parent e1cc1d8 commit 9aa8c2d
Show file tree
Hide file tree
Showing 2 changed files with 149 additions and 0 deletions.
74 changes: 74 additions & 0 deletions cli/docs/configs/provider.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ Configuration to pass to the nox compute peer. Config.toml files are generated f
| `systemCpuCount` | integer | No | Number of CPU cores to allocate for the Nox itself. Default: 1 |
| `systemServices` | [object](#systemservices) | No | System services to run by default. aquaIpfs and decider are enabled by default |
| `tcpPort` | integer | No | Both host and container TCP port to use. Default: for each nox a unique port is assigned starting from 7771 |
| `vm` | [object](#vm) | No | VM Configuration |
| `websocketPort` | integer | No | Both host and container WebSocket port to use. Default: for each nox a unique port is assigned starting from 9991 |

##### ccp
Expand Down Expand Up @@ -326,6 +327,42 @@ Decider service configuration
| `walletKey` | string | No | Wallet key (deprecated) |
| `workerIpfsMultiaddr` | string | No | Multiaddress of worker IPFS node |

##### vm

VM Configuration

###### Properties

| Property | Type | Required | Description |
|--------------|--------------------|----------|--------------------------------------------|
| `network` | [object](#network) | **Yes** | VM Network Configuration |
| `allowGpu` | boolean | No | Whether to add info about GPUs to VM's XML |
| `libvirtUri` | string | No | QEMU Socket |

###### network

VM Network Configuration

**Properties**

| Property | Type | Required | Description |
|--------------|----------------------|----------|------------------------------------------------------------------|
| `publicIp` | string | **Yes** | Public IP address to assign the VM. Must be publicly accessible. |
| `bridgeName` | string | No | Name of the network bridge device |
| `portRange` | [object](#portrange) | No | iptables-mapped port range from Host to VM |
| `vmIp` | string | No | Internal IP address to assign the VM |

**portRange**

iptables-mapped port range from Host to VM

**Properties**

| Property | Type | Required | Description |
|----------|---------|----------|---------------------------------------------------------|
| `end` | integer | No | End of the iptables-mapped port range from Host to VM |
| `start` | integer | No | Start of the iptables-mapped port range from Host to VM |

## nox

Configuration to pass to the nox compute peer. Config.toml files are generated from this config
Expand All @@ -349,6 +386,7 @@ Configuration to pass to the nox compute peer. Config.toml files are generated f
| `systemCpuCount` | integer | No | Number of CPU cores to allocate for the Nox itself. Default: 1 |
| `systemServices` | [object](#systemservices) | No | System services to run by default. aquaIpfs and decider are enabled by default |
| `tcpPort` | integer | No | Both host and container TCP port to use. Default: for each nox a unique port is assigned starting from 7771 |
| `vm` | [object](#vm) | No | VM Configuration |
| `websocketPort` | integer | No | Both host and container WebSocket port to use. Default: for each nox a unique port is assigned starting from 9991 |

### ccp
Expand Down Expand Up @@ -478,6 +516,42 @@ Decider service configuration
| `walletKey` | string | No | Wallet key (deprecated) |
| `workerIpfsMultiaddr` | string | No | Multiaddress of worker IPFS node |

### vm

VM Configuration

#### Properties

| Property | Type | Required | Description |
|--------------|--------------------|----------|--------------------------------------------|
| `network` | [object](#network) | **Yes** | VM Network Configuration |
| `allowGpu` | boolean | No | Whether to add info about GPUs to VM's XML |
| `libvirtUri` | string | No | QEMU Socket |

#### network

VM Network Configuration

##### Properties

| Property | Type | Required | Description |
|--------------|----------------------|----------|------------------------------------------------------------------|
| `publicIp` | string | **Yes** | Public IP address to assign the VM. Must be publicly accessible. |
| `bridgeName` | string | No | Name of the network bridge device |
| `portRange` | [object](#portrange) | No | iptables-mapped port range from Host to VM |
| `vmIp` | string | No | Internal IP address to assign the VM |

##### portRange

iptables-mapped port range from Host to VM

###### Properties

| Property | Type | Required | Description |
|----------|---------|----------|---------------------------------------------------------|
| `end` | integer | No | End of the iptables-mapped port range from Host to VM |
| `start` | integer | No | Start of the iptables-mapped port range from Host to VM |

## offers

A map with offer names as keys and offers as values
Expand Down
75 changes: 75 additions & 0 deletions cli/src/lib/configs/project/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,19 @@ type NoxConfigYAMLV1 = Omit<NoxConfigYAMLV0, "chainConfig"> & {
tokioDetailedMetricsEnabled?: boolean;
};
bootstrapNodes?: Array<string>;
vm?: {
libvirtUri?: string;
allowGpu?: boolean;
network: {
bridgeName?: string;
publicIp: string;
vmIp?: string;
portRange?: {
start?: number;
end?: number;
};
};
};
};

const DEFAULT_TIMER_RESOLUTION = "1 minute";
Expand Down Expand Up @@ -724,6 +737,68 @@ const noxConfigYAMLSchemaV1 = {
type: "string",
description: `Raw TOML config string to parse and merge with the rest of the config. Has the highest priority`,
},
vm: {
type: "object",
description: "VM Configuration",
additionalProperties: false,
nullable: true,
required: ["network"],
properties: {
libvirtUri: {
nullable: true,
type: "string",
description: `QEMU Socket`,
},
allowGpu: {
nullable: true,
type: "boolean",
description: `Whether to add info about GPUs to VM's XML`,
},
network: {
type: "object",
description: "VM Network Configuration",
additionalProperties: false,
nullable: false,
required: ["publicIp"],
properties: {
bridgeName: {
nullable: true,
type: "string",
description: `Name of the network bridge device`,
},
publicIp: {
nullable: false,
type: "string",
description: `Public IP address to assign the VM. Must be publicly accessible.`,
},
vmIp: {
nullable: true,
type: "string",
description: `Internal IP address to assign the VM`,
},
portRange: {
type: "object",
description: "iptables-mapped port range from Host to VM",
additionalProperties: false,
nullable: true,
required: [],
properties: {
start: {
nullable: true,
type: "integer",
description: `Start of the iptables-mapped port range from Host to VM`,
},
end: {
nullable: true,
type: "integer",
description: `End of the iptables-mapped port range from Host to VM`,
},
},
},
},
},
},
},
},
required: [],
nullable: true,
Expand Down

0 comments on commit 9aa8c2d

Please sign in to comment.