Skip to content

Commit

Permalink
feat!: generate manifests, rename nox to peer (#1077)
Browse files Browse the repository at this point in the history
* feat: generate manifests

* Apply automatic changes

* fix test, rename nox to peer

* allow selecting by both peers and offers in all commands

* Apply automatic changes

* add manifest apply

* use fork instead of patch (patch doesn't work with oclif pack)

* fix peerId

* remove ccp configs

* fix?

* fix

* give a better name to converter

* rename nox to peer

* Apply automatic changes

* improve description. require at least one item in supply if resources is specified, add validation on deploy

* Apply automatic changes

* feat!: remove nox and js-client (#1078)

* feat: remove nox

* Apply automatic changes

* remove js-client

* restore description for local group of commands

---------

Co-authored-by: shamsartem <[email protected]>

---------

Co-authored-by: shamsartem <[email protected]>
  • Loading branch information
shamsartem and shamsartem authored Dec 20, 2024
1 parent a489763 commit dcd44c1
Show file tree
Hide file tree
Showing 40 changed files with 1,285 additions and 2,442 deletions.
8 changes: 0 additions & 8 deletions .github/renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,6 @@
"extends": ["github>fluencelabs/renovate", "github>fluencelabs/renovate:npm"],
"enabledManagers": ["npm", "regex"],
"regexManagers": [
{
"fileMatch": ["^packages/cli/package/src/versions\\.json$"],
"matchStrings": [
"\"nox\": \"(?<lookupName>[^:]+):(?<currentValue>.*)\",\n"
],
"datasourceTemplate": "docker",
"depNameTemplate": "nox"
},
{
"fileMatch": ["^packages/cli/package/src/versions\\.json$"],
"matchStrings": [
Expand Down
22 changes: 0 additions & 22 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ on:
description: "Fluence environment to run tests against"
type: string
default: "local"
nox-image:
description: "nox image tag"
type: string
default: "null"
chain-rpc-image:
description: "chain-rpc image tag"
type: string
Expand Down Expand Up @@ -88,23 +84,6 @@ jobs:
kv/docker-registry/basicauth/ci password | DOCKER_PASSWORD ;
kv/npm-registry/basicauth/ci token | NODE_AUTH_TOKEN;
- name: Set nox image
run: |
# set nox image
case ${{ inputs.nox-image }} in
# if nox image is not passed from e2e read from versions.json
'null')
nox="$(jq .nox packages/cli/package/src/versions.json -r)"
;;
# else set nox image to snapshot passed from e2e
*)
nox=${{ inputs.nox-image }}
;;
esac
echo "nox image used for tests is $nox"
echo "NOX_IMAGE=${nox}" >> $GITHUB_ENV
- name: Set deal images
run: |
# set deal images
Expand Down Expand Up @@ -173,7 +152,6 @@ jobs:
with:
versions: |
{
"nox": "${{ env.NOX_IMAGE }}",
"chain-rpc": "${{ env.CHAIN_RPC_IMAGE }}",
"chain-deploy-script": "${{ env.CHAIN_DEPLOY_SCRIPT_IMAGE }}",
"subgraph-deploy-script": "${{ env.SUBGRAPH_DEPLOY_SCRIPT_IMAGE }}"
Expand Down
152 changes: 81 additions & 71 deletions packages/cli/package/docs/commands/README.md

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions packages/cli/package/docs/configs/env.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Defines project user's preferences
| `chainId` | number | No | Chain ID to use |
| `deployment` | [object](#deployment) | No | Deployed contract address overrides |
| `fluenceEnv` | string | No | Fluence environment to connect to Possible values are: `testnet`, `mainnet`, `stage`, `local`. |
| `ipfsGateway` | string | No | IPFS gateway URL to use |
| `relays` | string[] | No | List of custom relay multiaddresses to use when connecting to Fluence network |
| `rpcUrl` | string | No | RPC URL to use |
| `subgraphUrl` | string | No | Subgraph URL to use |
Expand Down
39 changes: 34 additions & 5 deletions packages/cli/package/docs/configs/provider.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,13 @@ Defines a compute peer

#### Properties

| Property | Type | Required | Description |
|----------------|----------------|----------|-------------------------------------------------------------------------------------------------|
| `computeUnits` | integer | **Yes** | How many compute units should nox have. Default: 32 (each compute unit requires 2GB of RAM) |
| `ccp` | [object](#ccp) | No | Configuration to pass to the Capacity Commitment Prover |
| `nox` | [object](#nox) | No | Configuration to pass to the nox compute peer. Config.toml files are generated from this config |
| Property | Type | Required | Description |
|------------------|----------------------|----------|-------------------------------------------------------------------------------------------------|
| `computeUnits` | integer | **Yes** | How many compute units should nox have. Default: 32 (each compute unit requires 2GB of RAM) |
| `ccp` | [object](#ccp) | No | Configuration to pass to the Capacity Commitment Prover |
| `kubeconfigPath` | string | No | Path to the kubeconfig file |
| `nox` | [object](#nox) | No | Configuration to pass to the nox compute peer. Config.toml files are generated from this config |
| `resources` | [object](#resources) | No | Resources configuration |

#### ccp

Expand Down Expand Up @@ -366,6 +368,33 @@ iptables-mapped port range from Host to VM
| `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 |

#### resources

Resources configuration

##### Properties

| Property | Type | Required | Description |
|----------|---------------|----------|------------------|
| `ip` | [object](#ip) | **Yes** | IP configuration |

##### ip

IP configuration

###### Properties

| Property | Type | Required | Description |
|----------|---------------------|----------|-------------|
| `supply` | [object](#supply)[] | **Yes** | IP supply |

###### supply

Either specify only a `start` property (if you want a single IP) or `start` and `end` properties (if you want a range) or `cidr` property (if you want a CIDR notation)

| Property | Type | Required | Description |
|----------|------|----------|-------------|

## nox

Configuration to pass to the nox compute peer. Config.toml files are generated from this config
Expand Down
1 change: 0 additions & 1 deletion packages/cli/package/example.env
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@


# CLI Dependency override examples
# FCLI_V_NOX="fluencelabs/nox:0.4.0"
# FCLI_V_CHAIN="docker.fluence.dev/aurora:0.2.11"

# environment variables to be used by Fluence CLI maintainers to develop Fluence CLI:
Expand Down
11 changes: 5 additions & 6 deletions packages/cli/package/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,10 @@
},
"dependencies": {
"@fluencelabs/deal-ts-clients": "0.22.1",
"@fluencelabs/fluence-network-environment": "1.2.3",
"@fluencelabs/js-client": "0.9.0",
"@iarna/toml": "2.2.5",
"@kubernetes/client-node": "github:fluencelabs/kubernetes-client-javascript#e72ee00a52fec4eb4a8327632895d888ee504f4d",
"@libp2p/crypto": "4.0.1",
"@libp2p/peer-id-factory": "4.0.5",
"@mswjs/interceptors": "0.29.1",
"@multiformats/multiaddr": "12.2.1",
"@oclif/color": "1.0.13",
"@oclif/core": "4.0.29",
"@oclif/plugin-autocomplete": "3.2.6",
Expand Down Expand Up @@ -146,8 +145,8 @@
"default": {
"description": "Manage and display default CLI configurations"
},
"key": {
"description": "Manage secret keys, that define peer-ids of both nox and js-client (including the one inside this CLI itself)"
"local": {
"description": "Manage local fluence environment using docker-compose"
},
"provider": {
"description": "Set of commands to be used by providers or you can use them to manage your local environment"
Expand Down
37 changes: 0 additions & 37 deletions packages/cli/package/src/commands/default/peers.ts

This file was deleted.

8 changes: 4 additions & 4 deletions packages/cli/package/src/commands/local/up.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { BaseCommand } from "../../baseCommand.js";
import { LOCAL_NET_DEFAULT_WALLET_KEY } from "../../common.js";
import { createCommitments } from "../../lib/chain/commitment.js";
import { depositCollateral } from "../../lib/chain/depositCollateral.js";
import { distributeToNox } from "../../lib/chain/distributeToNox.js";
import { distributeToPeer } from "../../lib/chain/distributeToNox.js";
import { createOffers } from "../../lib/chain/offer/offer.js";
import { registerProvider } from "../../lib/chain/providerInfo.js";
import { setChainFlags } from "../../lib/chainFlags.js";
Expand All @@ -35,7 +35,7 @@ import {
OFFER_FLAG_NAME,
ALL_FLAG_VALUE,
DOCKER_COMPOSE_FULL_FILE_NAME,
NOXES_FLAG,
PEERS_FLAG,
PRIV_KEY_FLAG,
PROVIDER_CONFIG_FULL_FILE_NAME,
type FluenceEnv,
Expand All @@ -52,7 +52,7 @@ export default class Up extends BaseCommand<typeof Up> {
static override description = `Run ${DOCKER_COMPOSE_FULL_FILE_NAME} using docker compose and set up provider using all the offers from the 'offers' section in ${PROVIDER_CONFIG_FULL_FILE_NAME} config using default wallet key ${LOCAL_NET_DEFAULT_WALLET_KEY}`;
static override examples = ["<%= config.bin %> <%= command.id %>"];
static override flags = {
...NOXES_FLAG,
...PEERS_FLAG,
timeout: Flags.integer({
description:
"Timeout in seconds for attempting to register local network on local peers",
Expand Down Expand Up @@ -146,7 +146,7 @@ export default class Up extends BaseCommand<typeof Up> {
}

const allOffers = { [OFFER_FLAG_NAME]: ALL_FLAG_VALUE };
await distributeToNox({ ...flags, ...allOffers, amount: "10" });
await distributeToPeer({ ...flags, ...allOffers, amount: "10" });
await registerProvider();
await createOffers({ force: true, ...allOffers });
await createCommitments({ ...flags, ...allOffers });
Expand Down
5 changes: 2 additions & 3 deletions packages/cli/package/src/commands/provider/cc-create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

import { BaseCommand } from "../../baseCommand.js";
import { createCommitments } from "../../lib/chain/commitment.js";
import { NOX_NAMES_FLAG, CHAIN_FLAGS, OFFER_FLAG } from "../../lib/const.js";
import { CHAIN_FLAGS, PEER_AND_OFFER_NAMES_FLAGS } from "../../lib/const.js";
import { aliasesText } from "../../lib/helpers/aliasesText.js";
import { initCli } from "../../lib/lifeCycle.js";

Expand All @@ -28,8 +28,7 @@ export default class CreateCommitment extends BaseCommand<
static override description = `Create Capacity commitment${aliasesText.apply(this)}`;
static override flags = {
...CHAIN_FLAGS,
...NOX_NAMES_FLAG,
...OFFER_FLAG,
...PEER_AND_OFFER_NAMES_FLAGS,
};

async run(): Promise<void> {
Expand Down
Loading

0 comments on commit dcd44c1

Please sign in to comment.