Skip to content

Commit

Permalink
chore: Sync 0.21.1 to release 0.21 (#64)
Browse files Browse the repository at this point in the history
Signed-off-by: dependabot[bot] <[email protected]>
Signed-off-by: Jeromy Cannon <[email protected]>
Signed-off-by: Nathan Klick <[email protected]>
Signed-off-by: Lenin Mehedy <[email protected]>
Signed-off-by: Jeffrey Tang <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Nathan Klick <[email protected]>
Co-authored-by: Lenin Mehedy <[email protected]>
Co-authored-by: JeffreyDallas <[email protected]>
Co-authored-by: Hedera Eng Automation <[email protected]>
  • Loading branch information
6 people authored Feb 26, 2024
1 parent 0c2a96b commit 19c3966
Show file tree
Hide file tree
Showing 16 changed files with 348 additions and 70 deletions.
1 change: 1 addition & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ updates:
schedule:
interval: "daily"
open-pull-requests-limit: 15
versioning-strategy: increase
6 changes: 3 additions & 3 deletions .github/workflows/flow-deploy-release-artifact.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
fetch-depth: 0

- name: Setup Node
uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version: 20

Expand Down Expand Up @@ -111,12 +111,12 @@ jobs:
git_tag_gpgsign: false

- name: Setup Node
uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version: 20

- name: Setup JFrog CLI
uses: jfrog/setup-jfrog-cli@8fc3d0018a8721b9a797cd7fd97c8e4833f5a3d1 # v3.5.3
uses: jfrog/setup-jfrog-cli@26da2259ee7690e63b5410d7451b2938d08ce1f9 # v4.0.0
env:
JF_URL: ${{ vars.JF_URL }}
JF_ACCESS_TOKEN: ${{ secrets.JF_ACCESS_TOKEN }}
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/zxc-compile-code.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,15 @@ jobs:
if: ${{ inputs.enable-e2e-tests && !cancelled() && !failure() }}
run: npm run test-e2e

- name: Upload E2E Logs to GitHub
if: ${{ inputs.enable-e2e-tests && !cancelled() }}
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
with:
name: solo.log
path: ~/.solo/logs/solo.log
overwrite: true
if-no-files-found: error

- name: Publish E2E Test Report
uses: EnricoMi/publish-unit-test-result-action@8885e273a4343cd7b48eaa72428dea0c3067ea98 # v2.14.0
if: ${{ inputs.enable-e2e-tests && steps.npm-deps.conclusion == 'success' && !cancelled() }}
Expand Down
56 changes: 36 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# Solo

An opinionated CLI tool to deploy and manage private Hedera Networks.
[![NPM Version](https://img.shields.io/npm/v/%40hashgraph%2Fsolo?logo=npm)](https://www.npmjs.com/package/@hashgraph/solo)
[![GitHub License](https://img.shields.io/github/license/hashgraph/solo?logo=apache\&logoColor=red)](LICENSE)
![node-lts](https://img.shields.io/node/v-lts/%40hashgraph%2Fsolo)
[![Build Application](https://github.com/hashgraph/solo/actions/workflows/flow-build-application.yaml/badge.svg)](https://github.com/hashgraph/solo/actions/workflows/flow-build-application.yaml)
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/83a423a3a1c942459127b3aec62ab0b5)](https://app.codacy.com/gh/hashgraph/solo/dashboard?utm_source=gh\&utm_medium=referral\&utm_content=\&utm_campaign=Badge_grade)
[![codecov](https://codecov.io/gh/hashgraph/solo/graph/badge.svg?token=hBkQdB1XO5)](https://codecov.io/gh/hashgraph/solo)

An opinionated CLI tool to deploy and manage standalone test networks.

## Table of Contents

Expand All @@ -12,8 +19,8 @@ An opinionated CLI tool to deploy and manage private Hedera Networks.
* [Legacy keys (.pfx file)](#legacy-keys-pfx-file)
* [Standard keys (.pem file)](#standard-keys-pem-file)
* [Examples](#examples)
* [Example - 1: Deploy a private Hedera network (version `0.42.5`)](#example---1-deploy-a-private-hedera-network-version-0425)
* [Example - 2: Deploy a private Hedera network (version `0.47.0-alpha.0`)](#example---2-deploy-a-private-hedera-network-version-0470-alpha0)
* [Example - 1: Deploy a standalone test network (version `0.42.5`)](#example---1-deploy-a-standalone-test-network-version-0425)
* [Example - 2: Deploy a standalone test network (version `0.47.0-alpha.0`)](#example---2-deploy-a-standalone-test-network-version-0470-alpha0)
* [Support](#support)
* [Contributing](#contributing)
* [Code of Conduct](#code-of-conduct)
Expand All @@ -30,8 +37,8 @@ An opinionated CLI tool to deploy and manage private Hedera Networks.
* Install [Node](https://nodejs.org/en/download). You may also use [nvm](https://github.com/nvm-sh/nvm) to manage different Node versions locally:

```
$ nvm install lts/hydrogen
$ nvm use lts/hydrogen
nvm install lts/hydrogen
nvm use lts/hydrogen
```

* Install [kubectl](https://kubernetes.io/docs/tasks/tools/)
Expand All @@ -51,20 +58,28 @@ $ nvm use lts/hydrogen
Check and select appropriate kubernetes context using `kubectx` command as below:

```
$ kubectx <context-name>
kubectx <context-name>
```

* For a local cluster, you may use [kind](https://kind.sigs.k8s.io/) and [kubectl](https://kubernetes.io/docs/tasks/tools/) to create a cluster and namespace as below.
* In this case, ensure your Docker engine has enough resources (e.g. Memory >=8Gb, CPU: >=4).

First, use the following command to set up the environment variables:
```
export SOLO_CLUSTER_NAME=solo
export SOLO_NAMESPACE=solo
export SOLO_CLUSTER_SETUP_NAMESPACE=solo-cluster
```

Then run the following command to set the kubectl context to the new cluster:
```
kind create cluster -n "${SOLO_CLUSTER_NAME}"
kubectl create ns "${SOLO_NAMESPACE}"
kubectl create ns "${SOLO_CLUSTER_SETUP_NAMESPACE}"
```
$ export SOLO_CLUSTER_NAME=solo
$ export SOLO_NAMESPACE=solo
$ export SOLO_CLUSTER_SETUP_NAMESPACE=solo-cluster
$ kind create cluster -n "${SOLO_CLUSTER_NAME}"
$ kubectl create ns "${SOLO_NAMESPACE}"
$ kubectl create ns "${SOLO_CLUSTER_SETUP_NAMESPACE}"

and the command output should look like this:
```
Creating cluster "solo" ...
✓ Ensuring node image (kindest/node:v1.27.3) 🖼
✓ Preparing nodes 📦
Expand Down Expand Up @@ -117,10 +132,10 @@ cache directory (`$HOME/.solo/cache/keys`):

```
# Option - 1: Generate keys for default node IDs: node0,node1,node2
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/hashgraph/full-stack-testing/main/solo/test/scripts/gen-legacy-keys.sh)"
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/hashgraph/solo/main/test/scripts/gen-legacy-keys.sh)"
# Option - 2: Generate keys for custom node IDs
curl https://raw.githubusercontent.com/hashgraph/full-stack-testing/main/solo/test/scripts/gen-legacy-keys.sh -o gen-legacy-keys.sh
curl https://raw.githubusercontent.com/hashgraph/solo/main/test/scripts/gen-legacy-keys.sh -o gen-legacy-keys.sh
chmod +x gen-legacy-keys.sh
./gen-legacy-keys.sh alice,bob,carol
```
Expand All @@ -132,7 +147,7 @@ You may run `solo node keys --gossip-keys --tls-keys --key-format pem -i node0,n

## Examples

### Example - 1: Deploy a private Hedera network (version `0.42.5`)
### Example - 1: Deploy a standalone test network (version `0.42.5`)

* Initialize `solo` with tag `v0.42.5` and list of node names `node0,node1,node2`:

Expand All @@ -155,12 +170,13 @@ Kubernetes Namespace : solo
* Generate `pfx` node keys (You will need `curl`, `keytool` and `openssl`)

```
$ curl https://raw.githubusercontent.com/hashgraph/full-stack-testing/main/solo/test/scripts/gen-legacy-keys.sh -o gen-legacy-keys.sh
$ chmod +x gen-legacy-keys.sh
$ ./gen-legacy-keys.sh node0,node1,node2
curl https://raw.githubusercontent.com/hashgraph/solo/main/test/scripts/gen-legacy-keys.sh -o gen-legacy-keys.sh
chmod +x gen-legacy-keys.sh
./gen-legacy-keys.sh node0,node1,node2
# view the list of generated keys in the cache folder
$ ls ~/.solo/cache/keys
ls ~/.solo/cache/keys
hedera-node0.crt hedera-node1.crt hedera-node2.crt private-node0.pfx private-node2.pfx
hedera-node0.key hedera-node1.key hedera-node2.key private-node1.pfx public.pfx
Expand Down Expand Up @@ -362,7 +378,7 @@ Once the nodes are up, you may now expose various services (using `k9s` (shift-f
│ │
```

### Example - 2: Deploy a private Hedera network (version `0.47.0-alpha.0`)
### Example - 2: Deploy a standalone test network (version `0.47.0-alpha.0`)

* Initialize `solo` with tag `v0.47.0-alpha.0` and list of node names `n0,n1,n2`:

Expand Down
3 changes: 3 additions & 0 deletions jest.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
*
*/
const config = {
rootDir: '.',
testRunner: 'jest-circus/runner',
testEnvironment: '<rootDir>/test/jest/fail_fast.mjs',
testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.(mjs?)$',
moduleFileExtensions: ['js', 'mjs'],
verbose: true,
Expand Down
23 changes: 14 additions & 9 deletions package-lock.json

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

13 changes: 9 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hashgraph/solo",
"version": "0.21.0",
"version": "0.21.1",
"description": "An opinionated CLI tool to deploy and manage private Hedera Networks.",
"main": "src/index.mjs",
"type": "module",
Expand All @@ -25,18 +25,20 @@
"author": "Swirlds Labs",
"license": "Apache2.0",
"dependencies": {
"@hashgraph/proto": "^2.14.0-beta.3",
"@hashgraph/sdk": "^2.41.0",
"@kubernetes/client-node": "^0.20.0",
"@listr2/prompt-adapter-enquirer": "^2.0.2",
"@peculiar/x509": "^1.9.7",
"adm-zip": "^0.5.10",
"chalk": "^5.3.0",
"dotenv": "^16.4.4",
"dotenv": "^16.4.5",
"enquirer": "^2.4.1",
"esm": "^3.2.25",
"figlet": "^1.7.0",
"got": "^14.2.0",
"inquirer": "^9.2.15",
"js-base64": "^3.7.6",
"listr2": "^8.0.2",
"tar": "^6.2.0",
"uuid": "^9.0.1",
Expand All @@ -46,19 +48,22 @@
},
"devDependencies": {
"@jest/globals": "^29.7.0",
"@jest/test-sequencer": "^29.7.0",
"eslint": "^8.56.0",
"eslint-config-standard": "^17.1.0",
"eslint-plugin-headers": "^1.1.2",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-n": "^16.6.2",
"eslint-plugin-promise": "^6.1.1",
"jest": "^29.7.0",
"jest-circus": "^29.7.0",
"jest-environment-node": "^29.7.0",
"jest-junit": "^16.0.0",
"remark-cli": "^12.0.0",
"remark-lint-list-item-indent": "^3.1.2",
"remark-lint-unordered-list-marker-style": "^3.1.2",
"remark-preset-lint-consistent": "^5.1.2",
"remark-preset-lint-recommended": "^6.1.3",
"remark-lint-unordered-list-marker-style": "^3.1.2"
"remark-preset-lint-recommended": "^6.1.3"
},
"repository": {
"type": "git",
Expand Down
22 changes: 4 additions & 18 deletions src/commands/account.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -73,23 +73,10 @@ export class AccountCommand extends BaseCommand {
const serviceMap = await this.accountManager.getNodeServiceMap(ctx.config.namespace)

ctx.nodeClient = await this.accountManager.getNodeClient(ctx.config.namespace,
serviceMap, ctx.treasuryAccountId, ctx.treasuryPrivateKey)
serviceMap, ctx.treasuryAccountInfo.accountId, ctx.treasuryAccountInfo.privateKey)
this.nodeClient = ctx.nodeClient // store in class so that we can make sure connections are closed
}

async loadTreasuryAccount (ctx) {
ctx.treasuryAccountId = constants.TREASURY_ACCOUNT_ID
// check to see if the treasure account is in the secrets
const accountInfo = await this.accountManager.getAccountKeysFromSecret(ctx.treasuryAccountId, ctx.config.namespace)

// if it isn't in the secrets we can load genesis key
if (accountInfo) {
ctx.treasuryPrivateKey = accountInfo.privateKey
} else {
ctx.treasuryPrivateKey = constants.GENESIS_KEY
}
}

async getAccountInfo (ctx) {
return this.accountManager.accountInfoQuery(ctx.config.accountId, ctx.nodeClient)
}
Expand All @@ -101,7 +88,6 @@ export class AccountCommand extends BaseCommand {
this.logger.error(`failed to update account keys for accountId ${ctx.accountInfo.accountId}`)
return false
}
this.logger.debug(`sent account key update for account ${ctx.accountInfo.accountId}`)
} else {
amount = amount || flags.amount.definition.defaultValue
}
Expand Down Expand Up @@ -156,7 +142,7 @@ export class AccountCommand extends BaseCommand {

self.logger.debug('Initialized config', { config })

await self.loadTreasuryAccount(ctx)
ctx.treasuryAccountInfo = await self.accountManager.getTreasuryAccountKeys(ctx.config.namespace)
await self.loadNodeClient(ctx)
}
},
Expand Down Expand Up @@ -219,7 +205,7 @@ export class AccountCommand extends BaseCommand {
{
title: 'get the account info',
task: async (ctx, task) => {
await self.loadTreasuryAccount(ctx)
ctx.treasuryAccountInfo = await self.accountManager.getTreasuryAccountKeys(ctx.config.namespace)
await self.loadNodeClient(ctx)
ctx.accountInfo = await self.buildAccountInfo(await self.getAccountInfo(ctx), ctx.config.namespace, ctx.config.privateKey)
}
Expand Down Expand Up @@ -286,7 +272,7 @@ export class AccountCommand extends BaseCommand {
{
title: 'get the account info',
task: async (ctx, task) => {
await self.loadTreasuryAccount(ctx)
ctx.treasuryAccountInfo = await self.accountManager.getTreasuryAccountKeys(ctx.config.namespace)
await self.loadNodeClient(ctx)
self.accountInfo = await self.buildAccountInfo(await self.getAccountInfo(ctx), ctx.config.namespace, false)
this.logger.showJSON('account info', self.accountInfo)
Expand Down
4 changes: 3 additions & 1 deletion src/commands/network.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ export class NetworkCommand extends BaseCommand {

valuesArg += this.prepareValuesFiles(config.valuesFile)

valuesArg += ` --set hedera-mirror-node.enabled=${config.deployMirrorNode} --set hedera-explorer.enabled=${config.deployHederaExplorer}`
// do not deploy mirror node until after we have the updated address book
valuesArg += ' --set hedera-mirror-node.enabled=false --set hedera-explorer.enabled=false'

valuesArg += ` --set telemetry.prometheus.svcMonitor.enabled=${config.enablePrometheusSvcMonitor}`

if (config.enableHederaExplorerTls) {
Expand Down
Loading

0 comments on commit 19c3966

Please sign in to comment.