Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into 00949-production-read…
Browse files Browse the repository at this point in the history
…iness-dynamically-construct-the-genesis-networkjson-and-add-it-to-the-values-file-to-be-used-during-network-deploy
  • Loading branch information
instamenta committed Dec 20, 2024
2 parents 847cd45 + 861c579 commit bcdef8b
Show file tree
Hide file tree
Showing 25 changed files with 598 additions and 206 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ An opinionated CLI tool to deploy and manage standalone test networks.

### Hardware Requirements

To run a three-node network, you will need to set up Docker Desktop with at least 8GB of memory and 4 CPUs.
To run a three-node network, you will need to set up Docker Desktop with at least 8GB of memory and 4 CPUs.

![alt text](/docs/content/User/DockerDesktop.png)

Expand Down
7 changes: 0 additions & 7 deletions docs/content/User/Env.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,3 @@ User can configure the following environment variables to customize the behavior
| `RELAY_PODS_READY_MAX_ATTEMPTS` | The maximum number of attempts to check if relay pods are ready. | `100` |
| `RELAY_PODS_READY_DELAY` | The interval between attempts to check if relay pods are ready, in the unit of milliseconds. | `120` |
| `NETWORK_DESTROY_WAIT_TIMEOUT` | The period of time to wait for network to be destroyed, in the unit of milliseconds. | `60000` |







3 changes: 2 additions & 1 deletion docs/content/User/FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ You can run `solo account init` anytime after `solo node start`

### Where can I find the default account keys ?

It is the well known default genesis key [Link](https://github.com/hashgraph/hedera-services/blob/develop/hedera-node/data/onboard/GenesisPrivKey.txt)
It is the well known default genesis key [Link](https://github.com/hashgraph/hedera-services/blob/develop/hedera-node/data/onboard/GenesisPrivKey.txt)

### How do I get the key for an account?

Use the following command to get account balance and private key of the account `0.0.1007`:

```bash
# get account info of 0.0.1007 and also show the private key
solo account get --account-id 0.0.1007 -n solo-e2e --private-key
Expand Down
1 change: 1 addition & 0 deletions docs/content/User/GetStarted.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ For Hedera extended users:
* [Using Environment Variables](Env.md)

FAQ:

* [Frequently Asked Questions](FAQ.md)

For curious mind:
Expand Down
33 changes: 16 additions & 17 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@
"license": "Apache2.0",
"dependencies": {
"@eslint/eslintrc": "^3.2.0",
"@hashgraph/sdk": "^2.55.1",
"@hashgraph/sdk": "^2.56.0",
"@kubernetes/client-node": "^0.22.3",
"@listr2/prompt-adapter-enquirer": "^2.0.12",
"@peculiar/x509": "^1.12.3",
"adm-zip": "^0.5.16",
"chalk": "^5.3.0",
"chalk": "^5.4.0",
"class-transformer": "^0.5.1",
"class-validator": "^0.14.1",
"dot-object": "^2.1.5",
Expand Down Expand Up @@ -115,7 +115,7 @@
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-promise": "^7.2.1",
"eslint-plugin-tsdoc": "^0.4.0",
"globals": "^15.13.0",
"globals": "^15.14.0",
"jest-mock": "^29.7.0",
"madge": "^8.0.0",
"mocha": "^11.0.1",
Expand Down
8 changes: 8 additions & 0 deletions src/commands/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ export abstract class BaseCommand extends ShellRunner {
return valuesArg;
}

getConfigManager(): ConfigManager {
return this.configManager;
}

/**
* Dynamically builds a class with properties from the provided list of flags
* and extra properties, will keep track of which properties are used. Call
Expand Down Expand Up @@ -185,6 +189,10 @@ export abstract class BaseCommand extends ShellRunner {
return this.localConfig;
}

getRemoteConfigManager() {
return this.remoteConfigManager;
}

abstract close(): Promise<void>;

commandActionBuilder(actionTasks: any, options: any, errorString: string, lease: Lease | null) {
Expand Down
41 changes: 41 additions & 0 deletions src/commands/context/configs.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/**
* Copyright (C) 2024 Hedera Hashgraph, LLC
*
* Licensed under the Apache License, Version 2.0 (the ""License"");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an ""AS IS"" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

import {type NodeAlias} from '../../types/aliases.js';

export const CONNECT_CONFIGS_NAME = 'connectConfig';

export const connectConfigBuilder = async function (argv, ctx, task) {
const config = this.getConfig(CONNECT_CONFIGS_NAME, argv.flags, [
'currentDeploymentName',
]) as ContextConnectConfigClass;

// set config in the context for later tasks to use
ctx.config = config;

return ctx.config;
};

export interface ContextConnectConfigClass {
app: string;
cacheDir: string;
devMode: boolean;
namespace: string;
nodeAlias: NodeAlias;
context: string;
clusterName: string;
}
9 changes: 8 additions & 1 deletion src/commands/context/flags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,12 @@ import {Flags as flags} from '../flags.js';
export const USE_FLAGS = {
requiredFlags: [],
requiredFlagsWithDisabledPrompt: [],
optionalFlags: [flags.devMode, flags.quiet, flags.clusterName, flags.context, flags.force, flags.namespace],
optionalFlags: [
flags.devMode,
flags.quiet,
flags.clusterName,
flags.context,
flags.namespace,
flags.userEmailAddress,
],
};
15 changes: 12 additions & 3 deletions src/commands/context/handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,32 @@ import {type ContextCommandTasks} from './tasks.js';
import * as helpers from '../../core/helpers.js';
import * as constants from '../../core/constants.js';
import * as ContextFlags from './flags.js';
import {RemoteConfigTasks} from '../../core/config/remote/remote_config_tasks.js';
import type {RemoteConfigManager} from '../../core/config/remote/remote_config_manager.js';
import {connectConfigBuilder} from './configs.js';

export class ContextCommandHandlers implements CommandHandlers {
readonly parent: BaseCommand;
readonly tasks: ContextCommandTasks;
public readonly remoteConfigManager: RemoteConfigManager;
private getConfig: any;

constructor(parent: BaseCommand, tasks: ContextCommandTasks) {
constructor(parent: BaseCommand, tasks: ContextCommandTasks, remoteConfigManager: RemoteConfigManager) {
this.parent = parent;
this.tasks = tasks;
this.remoteConfigManager = remoteConfigManager;
this.getConfig = parent.getConfig.bind(parent);
}

async connect(argv: any) {
argv = helpers.addFlagsToArgv(argv, ContextFlags.USE_FLAGS);

const action = this.parent.commandActionBuilder(
[
this.tasks.initialize(argv),
this.parent.getLocalConfig().promptLocalConfigTask(),
this.tasks.initialize(argv, connectConfigBuilder.bind(this)),
this.parent.getLocalConfig().promptLocalConfigTask(this.parent.getK8()),
this.tasks.selectContext(argv),
RemoteConfigTasks.loadRemoteConfig.bind(this)(argv),
this.tasks.updateLocalConfig(argv),
],
{
Expand Down
2 changes: 1 addition & 1 deletion src/commands/context/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export class ContextCommand extends BaseCommand {
constructor(opts: Opts) {
super(opts);

this.handlers = new ContextCommandHandlers(this, new ContextCommandTasks(this));
this.handlers = new ContextCommandHandlers(this, new ContextCommandTasks(this), this.remoteConfigManager);
}

getCommandDefinition() {
Expand Down
Loading

0 comments on commit bcdef8b

Please sign in to comment.