From ae8d8bbdabf8f7583b670e65b9b23f4701aef296 Mon Sep 17 00:00:00 2001 From: Jeromy Cannon <jeromy@swirldslabs.com> Date: Fri, 4 Oct 2024 07:04:08 +0100 Subject: [PATCH] feat: convert hugo docs workflow calls to use Taskfile task (#642) Signed-off-by: Jeromy Cannon <jeromy@swirldslabs.com> --- .github/workflows/flow-hugo-publish.yaml | 69 +-- .gitignore | 7 + .remarkrc.yml | 1 + docs/Taskfile.yaml | 93 ++++ docs/content/_index.md | 8 +- docs/content/contribution/contribution.md | 7 - docs/content/contribution/docs.md | 7 - docs/content/getting-started/deploy.md | 515 ------------------- docs/content/getting-started/installation.md | 33 -- docs/content/getting-started/setup.md | 82 --- docs/data/menu/main.yml | 16 +- docs/generate_md.sh | 17 - docs/hugo.toml | 11 + docs/jsdoc.conf.json | 10 +- docs/jsdoc2md.conf.json | 10 - package-lock.json | 85 +++ package.json | 7 +- src/commands/cluster.mjs | 2 +- src/commands/init.mjs | 2 +- src/commands/node.mjs | 5 +- src/commands/node/configs.mjs | 1 - test/scripts/README.md | 4 +- 22 files changed, 245 insertions(+), 747 deletions(-) create mode 100644 docs/Taskfile.yaml delete mode 100644 docs/content/contribution/contribution.md delete mode 100644 docs/content/contribution/docs.md delete mode 100644 docs/content/getting-started/deploy.md delete mode 100644 docs/content/getting-started/installation.md delete mode 100644 docs/content/getting-started/setup.md delete mode 100755 docs/generate_md.sh delete mode 100644 docs/jsdoc2md.conf.json diff --git a/.github/workflows/flow-hugo-publish.yaml b/.github/workflows/flow-hugo-publish.yaml index 6d41fbbbe..deaa47cf5 100644 --- a/.github/workflows/flow-hugo-publish.yaml +++ b/.github/workflows/flow-hugo-publish.yaml @@ -18,6 +18,8 @@ name: Deploy Hugo site to Pages on: + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: # Runs on pushes targeting the default branch push: branches: @@ -28,9 +30,12 @@ on: - '**/package*.json' - 'DEV.md' - 'README.md' - - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: + # run in the pull request, but don't publish + pull_request: + types: + - opened + - reopened + - synchronize # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages permissions: @@ -81,58 +86,34 @@ jobs: with: enablement: true - - name: Install jsdoc - run: | - cd docs - npm i -g jsdoc - jsdoc --version - jsdoc -c jsdoc.conf.json - cd - - - - name: Install jsdoc-to-markdown - run: | - cd docs - npm i -g jsdoc-to-markdown - jsdoc2md --version - ./generate_md.sh - cd - - - - name: Copy existing documentation - run: | - mkdir -p docs/content/Developer - cp DEV.md docs/content/Developer/DEV.md - mkdir -p docs/content/User - cp README.md docs/content/User/README.md + - name: Install Task + uses: arduino/setup-task@b91d5d2c96a56797b48ac1e0e89220bf64044611 # v2.0.0 + with: + version: 3.39.2 + repo-token: ${{ secrets.GITHUB_TOKEN }} - name: Build with Hugo - env: - # For maximum backward compatibility with Hugo modules - HUGO_ENVIRONMENT: production - HUGO_ENV: production run: | cd docs - echo "base_url ${{ steps.pages.outputs.base_url }}" - echo "origin ${{ steps.pages.outputs.origin }}" - echo "host ${{ steps.pages.outputs.host }}" - echo "base_path ${{ steps.pages.outputs.base_path }}" - mkdir -p themes/hugo-geekdoc - curl -L https://github.com/thegeeklab/hugo-geekdoc/releases/latest/download/hugo-geekdoc.tar.gz | tar -xz -C themes/hugo-geekdoc/ --strip-components=1 - ls -ltr - hugo version - hugo config - hugo \ - --gc \ - --config hugo.toml \ - --minify \ - --baseURL "${{ steps.pages.outputs.base_url }}/" + task default - - name: Upload artifact + # Upload the built site to GitHub Pages + - name: Upload Pages Artifact uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3.0.1 + if: ${{ endsWith(github.ref, 'main') }} + with: + path: ./docs/public + + # Upload the built site to artifacts for troubleshooting or verification + - name: Upload Artifact + uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 + if: ${{ !endsWith(github.ref, 'main') }} with: path: ./docs/public # Deployment job deploy: + if: ${{ endsWith(github.ref, 'main') }} environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} diff --git a/.gitignore b/.gitignore index 9877d70bb..fe9500473 100644 --- a/.gitignore +++ b/.gitignore @@ -516,3 +516,10 @@ coverage/ deleteme.yaml /.nyc_output/ /.nvmrc +/docs/public/static/Classes/ +/docs/content/Classes/ +/docs/content/Developer/DEV.md +/docs/content/User/README.md +/docs/themes/ +/docs/.hugo_build.lock +/docs/public/ diff --git a/.remarkrc.yml b/.remarkrc.yml index 0bf23f8da..7736b5762 100644 --- a/.remarkrc.yml +++ b/.remarkrc.yml @@ -1,4 +1,5 @@ plugins: + - [ 'remark-frontmatter', 'yaml', '-' ] # Check that markdown is consistent. - remark-preset-lint-consistent # Few recommended rules. diff --git a/docs/Taskfile.yaml b/docs/Taskfile.yaml new file mode 100644 index 000000000..3076685e4 --- /dev/null +++ b/docs/Taskfile.yaml @@ -0,0 +1,93 @@ +version: 3 +output: prefixed +dotenv: + - .env +silent: false + +env: + HUGO_ENVIRONMENT: production + HUGO_ENV: production + HUGO_BASE_URL: https://hashgraph.github.io/solo + HUGO_ORIGIN: https://hashgraph.github.io + HUGO_HOST: hashgraph.github.io + HUGO_BASEPATH: /solo + +tasks: + default: + cmds: + - task: "check-doc-dir" + - task: "clean" + - task: "install" + - task: "build" + + start: + cmds: + - task: "default" + - hugo server + + check-doc-dir: + status: + - | + if [ "$(basename "$PWD")" != "docs" ]; then + exit 1 + fi + cmds: + - | + echo "Error: Must be in the 'docs' directory." + exit 1 + + clean: + cmds: + - rm -Rf content/Classes + - rm -f content/Developer/DEV.md + - rm -f content/User/README.md + - rm -Rf public + - rm -Rf themes + - rm -f .hugo_build.lock + + build: + cmds: + - task: "build:jsdoc" + - task: "build:copy" + - task: "build:hugo" + + build:hugo: + cmds: + - echo "base_url $HUGO_BASE_URL" + - echo "origin $HUGO_ORIGIN" + - echo "host $HUGO_HOST" + - echo "base_path $HUGO_BASEPATH" + - mkdir -p themes/hugo-geekdoc + - curl -L https://github.com/thegeeklab/hugo-geekdoc/releases/latest/download/hugo-geekdoc.tar.gz | tar -xz -C themes/hugo-geekdoc/ --strip-components=1 + - hugo version + - hugo config + - hugo --gc --config hugo.toml --minify --baseURL "$HUGO_BASE_URL/" + + build:jsdoc: + cmds: + - jsdoc -c jsdoc.conf.json + + build:copy: + cmds: + - mkdir -p content/Developer + - cp ../DEV.md content/Developer/DEV.md + - mkdir -p content/User + - cp ../README.md content/User/README.md + + install: + cmds: + - task: "install:hugo" + - task: "install:jsdoc" + + install:hugo: + status: + - command -v hugo + cmds: + - go install github.com/gohugoio/hugo@v0.124.1 + + install:jsdoc: + status: + - command -v jsdoc + cmds: + - npm i -g jsdoc + - jsdoc --version diff --git a/docs/content/_index.md b/docs/content/_index.md index 13e1d34c5..fb8f53242 100644 --- a/docs/content/_index.md +++ b/docs/content/_index.md @@ -1,12 +1,10 @@ -*** - +--- title: Welcome to Solo Documentation geekdocNav: true geekdocAlign: center geekdocAnchor: false geekdocDescription: Home page for Solo Documentation - -*** +--- <!-- markdownlint-capture --> @@ -23,7 +21,7 @@ geekdocDescription: Home page for Solo Documentation Solo is an opinionated CLI tool to deploy and manage standalone test networks. -{{< button size="large" relref="getting-started/installation.md" >}}Getting Started{{< /button >}} +{{< button size="large" relref="User/README.md" >}}Getting Started{{< /button >}} ## Feature overview diff --git a/docs/content/contribution/contribution.md b/docs/content/contribution/contribution.md deleted file mode 100644 index df86715ed..000000000 --- a/docs/content/contribution/contribution.md +++ /dev/null @@ -1,7 +0,0 @@ -*** - -title: Solo Contribution -weight: -20 -geekdocNav: true -geekdocAlign: center --------------------- diff --git a/docs/content/contribution/docs.md b/docs/content/contribution/docs.md deleted file mode 100644 index 1f02651bb..000000000 --- a/docs/content/contribution/docs.md +++ /dev/null @@ -1,7 +0,0 @@ -*** - -title: Docs Contribution -weight: -20 -geekdocNav: true -geekdocAlign: center --------------------- diff --git a/docs/content/getting-started/deploy.md b/docs/content/getting-started/deploy.md deleted file mode 100644 index e0c528189..000000000 --- a/docs/content/getting-started/deploy.md +++ /dev/null @@ -1,515 +0,0 @@ -*** - -title: Deploy -weight: -20 -geekdocNav: true -geekdocAlign: center -geekdocAnchor: false --------------------- - -### 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` - -``` -$ solo init -t v0.42.5 -i node0,node1,node2 -n "${SOLO_NAMESPACE}" -s "${SOLO_CLUSTER_SETUP_NAMESPACE}" --key-format pfx - -``` - -Example output - -``` - -******************************* Solo ********************************************* -Version : 0.27.0 -Kubernetes Context : kind-solo -Kubernetes Cluster : kind-solo -Kubernetes Namespace : solo -********************************************************************************** -β Setup home directory and cache -β Check dependency: helm [OS: linux, Release: 5.15.0-1061-gke, Arch: x64] -β Check dependencies -β Setup chart manager - -*************************************************************************************** -Note: solo stores various artifacts (config, logs, keys etc.) in its home directory: /home/runner/.solo -If a full reset is needed, delete the directory or relevant sub-directories before running 'solo init'. -*************************************************************************************** -β Copy templates in '/home/runner/.solo/cache' - -``` - -Generate `pfx` formatted node keys - -We need to generate `pfx` keys as `pem` key files are only supported by Hedera platform >=`0.47.0-alpha.0`. - -``` -$ solo node keys --gossip-keys --tls-keys --key-format pfx - -``` - -Example output - -``` - -******************************* Solo ********************************************* -Version : 0.27.0 -Kubernetes Context : kind-solo -Kubernetes Cluster : kind-solo -Kubernetes Namespace : solo -********************************************************************************** -β Initialize -β Check keytool exists (Version: 21.0.1+12) -β Backup old files -β Generate private-node0.pfx for node: node0 -β Generate private-node1.pfx for node: node1 -β Generate private-node2.pfx for node: node2 -β Generate public.pfx file -β Clean up temp files -β Generate gossip keys -β Backup old files -β TLS key for node: node2 -β TLS key for node: node1 -β TLS key for node: node0 -β Generate gRPC TLS keys -β Finalize - -``` - -Key files are generated in `~/.solo/keys` directory. - -``` -$ 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 -``` - -Setup cluster with shared components.\ -In a separate terminal, you may run `k9s` to view the pod status. - -``` -$ solo cluster setup -``` - -Example output - -``` - -******************************* Solo ********************************************* -Version : 0.27.0 -Kubernetes Context : kind-solo -Kubernetes Cluster : kind-solo -Kubernetes Namespace : solo -********************************************************************************** -β Initialize -β Prepare chart values -β Install 'fullstack-cluster-setup' chart - -``` - -Deploy helm chart with Hedera network components\ -It may take a while (5~15 minutes depending on your internet speed) to download various docker images and get the pods started.\ -If it fails, ensure you have enough resources allocated for Docker engine and retry the command. - -``` -$ solo network deploy - -``` - -Example output - -``` - -******************************* Solo ********************************************* -Version : 0.27.0 -Kubernetes Context : kind-solo -Kubernetes Cluster : kind-solo -Kubernetes Namespace : solo -********************************************************************************** -β Initialize -β Install chart 'fullstack-deployment' -β Check Node: node0 -β Check Node: node1 -β Check Node: node2 -β Check node pods are running -β Check Envoy Proxy for: node0 -β Check Envoy Proxy for: node2 -β Check Envoy Proxy for: node1 -β Check HAProxy for: node0 -β Check HAProxy for: node1 -β Check HAProxy for: node2 -β Check proxy pods are running -β Check MinIO -β Check auxiliary pods are ready - -``` - -Setup node with Hedera platform software.\ -It may take a while as it download the hedera platform code from <https://builds.hedera.com/> - -``` -$ solo node setup - -``` - -Example output - -``` - -******************************* Solo ********************************************* -Version : 0.27.0 -Kubernetes Context : kind-solo -Kubernetes Cluster : kind-solo -Kubernetes Namespace : solo -********************************************************************************** -β Initialize -β Check network pod: node0 -β Check network pod: node1 -β Check network pod: node2 -β Identify network pods -β Copy configuration files -β Copy Gossip keys to staging -β Copy gRPC TLS keys to staging -β Prepare config.txt for the network -β Prepare staging directory -β Update node: node0 -β Update node: node1 -β Update node: node2 -β Fetch platform software into network nodes -β Copy Gossip keys -β Copy Gossip keys -β Copy Gossip keys -β Copy TLS keys -β Copy TLS keys -β Copy TLS keys -β Copy configuration files -β Copy configuration files -β Copy configuration files -β Set file permissions -β Node: node2 -β Set file permissions -β Node: node0 -β Set file permissions -β Node: node1 -β Setup network nodes -β Finalize - -``` - -Start the nodes. - -``` -$ solo node start - -``` - -Example output - -``` - -******************************* Solo ********************************************* -Version : 0.27.0 -Kubernetes Context : kind-solo -Kubernetes Cluster : kind-solo -Kubernetes Namespace : solo -********************************************************************************** -β Initialize -β Check network pod: node0 -β Check network pod: node2 -β Check network pod: node1 -β Identify network pods -β Start node: node1 -β Start node: node0 -β Start node: node2 -β Starting nodes -β Check node: node0 -β Check node: node1 -β Check node: node2 -β Check nodes are ACTIVE -β Check proxy for node: node0 -β Check proxy for node: node2 -β Check proxy for node: node1 -β Check node proxies are ACTIVE - -``` - -Deploy mirror node - -``` -$ solo mirror-node deploy - -``` - -Example output - -``` - -******************************* Solo ********************************************* -Version : 0.27.0 -Kubernetes Context : kind-solo -Kubernetes Cluster : kind-solo -Kubernetes Namespace : solo -********************************************************************************** -β Initialize -β Prepare address book -β Deploy mirror-node -β Enable mirror-node -β Check Hedera Explorer -β Check Postgres DB -β Check GRPC -β Check Monitor -β Check REST API -β Check Importer -β Check pods are ready - -``` - -Deploy a JSON RPC relay - -``` -$ solo relay deploy - -``` - -Example output - -``` - -******************************* Solo ********************************************* -Version : 0.27.0 -Kubernetes Context : kind-solo -Kubernetes Cluster : kind-solo -Kubernetes Namespace : solo -********************************************************************************** -β Initialize -β Prepare chart values -β Deploy JSON RPC Relay -β Check relay is ready - -``` - -You may view the list of pods using `k9s` as below: - -``` - Context: kind-solo-e2e <0> all <a> Attach <l> β¦ ____ __.________ - Cluster: kind-solo-e2e <1> default <ctrl-d> Delete <p> | |/ _/ __ \______ - User: kind-solo-e2e <d> Describe <shift-f>| < \____ / ___/ - K9s Rev: v0.27.4 β‘οΈv0.32.4 <e> Edit <s> | | \ / /\___ \ - K8s Rev: v1.27.3 <?> Help <n> |____|__ \ /____//____ > - CPU: n/a <ctrl-k> Kill <f> \/ \/ - MEM: n/a -ββββββββββββββββββββββββββββββββββββββββββββββββββββ Pods(all)[27] βββββββββββββββββββββββββββββββββββββββββββββββββββββ -β NAMESPACEβ NAME PF READY RESTARTS STATUS IP β -β fullstack-setup console-557956d575-fqctd β 1/1 0 Running 10.244.0.4 β -β fullstack-setup minio-operator-7d575c5f84-j9p6f β 1/1 0 Running 10.244.0.3 β -β kube-system coredns-5d78c9869d-gknqp β 1/1 0 Running 10.244.0.6 β -β kube-system coredns-5d78c9869d-q59pc β 1/1 0 Running 10.244.0.5 β -β kube-system etcd-solo-e2e-control-plane β 1/1 0 Running 172.18.0.2 β -β kube-system kindnet-w9ps5 β 1/1 0 Running 172.18.0.2 β -β kube-system kube-apiserver-solo-e2e-control-plane β 1/1 0 Running 172.18.0.2 β -β kube-system kube-controller-manager-solo-e2e-control-plane β 1/1 0 Running 172.18.0.2 β -β kube-system kube-proxy-p69z8 β 1/1 0 Running 172.18.0.2 β -β kube-system kube-scheduler-solo-e2e-control-plane β 1/1 0 Running 172.18.0.2 β -β local-path-storage local-path-provisioner-6bc4bddd6b-8pkfk β 1/1 0 Running 10.244.0.2 β -β solo envoy-proxy-node0-84947f844f-f28tp β 1/1 0 Running 10.244.0.215 β -β solo envoy-proxy-node1-65f8879dcc-j2lrk β 1/1 0 Running 10.244.0.216 β -β solo envoy-proxy-node2-667f848689-dkmf9 β 1/1 0 Running 10.244.0.214 β -β solo fullstack-deployment-grpc-69f9cc5666-lf6ql β 1/1 0 Running 10.244.0.227 β -β solo fullstack-deployment-hedera-explorer-79f79b7df4-wjdct β 1/1 0 Running 10.244.0.226 β -β solo fullstack-deployment-importer-864489ffb8-6v8tk β 1/1 0 Running 10.244.0.228 β -β solo fullstack-deployment-postgres-postgresql-0 β 1/1 0 Running 10.244.0.232 β -β solo fullstack-deployment-rest-584f5cb6bb-q9vnt β 1/1 0 Running 10.244.0.230 β -β solo fullstack-deployment-web3-69dcdfc4fb-mm5pk β 1/1 0 Running 10.244.0.229 β -β solo haproxy-node0-6969f76c77-n5cfl β 1/1 1 Running 10.244.0.219 β -β solo haproxy-node1-59f6976d45-x6xmp β 1/1 1 Running 10.244.0.217 β -β solo haproxy-node2-6df64d5457-hf9ps β 1/1 1 Running 10.244.0.218 β -β solo minio-pool-1-0 β 2/2 1 Running 10.244.0.224 β -β solo network-node0-0 β 5/5 0 Running 10.244.0.221 β -β solo network-node1-0 β 5/5 0 Running 10.244.0.222 β -β solo network-node2-0 β 5/5 0 Running 10.244.0.220 β - -``` - -#### Access Hedera Network services - -Once the nodes are up, you may now expose various services (using `k9s` (shift-f) or `kubectl port-forward`) and access. Below are most used services that you may expose. - -Node services: `network-<node ID>-svc`\ -HAProxy: `haproxy-<node ID>-svc`\ -Envoy Proxy: `envoy-proxy-<node ID>-svc`\ -Hedera explorer: `fullstack-deployment-hedera-explorer`\ -JSON Rpc Relays\ -You can deploy JSON RPC relays for one or more nodes as below: - -``` -$ solo relay deploy -i node0,node1 - -``` - -Example output - -``` - -******************************* Solo ********************************************* -Version : 0.27.0 -Kubernetes Context : kind-solo -Kubernetes Cluster : kind-solo -Kubernetes Namespace : solo -********************************************************************************** -β Initialize -β Prepare chart values -β Deploy JSON RPC Relay -β Check relay is ready - -``` - -### 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 `node0,node1,node2`: - -``` -# reset .solo directory -$ rm -rf ~/.solo - -$ solo init -t v0.47.0-alpha.0 -i node0,node1,node2 -n "${SOLO_NAMESPACE}" -s "${SOLO_CLUSTER_SETUP_NAMESPACE}" --key-format pem - -``` - -Example output - -``` - -******************************* Solo ********************************************* -Version : 0.27.0 -Kubernetes Context : kind-solo -Kubernetes Cluster : kind-solo -Kubernetes Namespace : solo -********************************************************************************** -β Setup home directory and cache -β Check dependency: helm [OS: linux, Release: 5.15.0-1061-gke, Arch: x64] -β Check dependencies -β Setup chart manager - -*************************************************************************************** -Note: solo stores various artifacts (config, logs, keys etc.) in its home directory: /home/runner/.solo -If a full reset is needed, delete the directory or relevant sub-directories before running 'solo init'. -*************************************************************************************** -β Copy templates in '/home/runner/.solo/cache' - -``` - -Generate `pem` formatted node keys - -``` -$ solo node keys --gossip-keys --tls-keys --key-format pem - -``` - -Example output - -``` - -******************************* Solo ********************************************* -Version : 0.27.0 -Kubernetes Context : kind-solo -Kubernetes Cluster : kind-solo -Kubernetes Namespace : solo -********************************************************************************** -β Initialize -β Backup old files -β Gossip pem key for node: node0 -β Gossip pem key for node: node1 -β Gossip pem key for node: node2 -β Generate gossip keys -β Backup old files -β TLS key for node: node0 -β TLS key for node: node1 -β TLS key for node: node2 -β Generate gRPC TLS keys -β Finalize - -``` - -PEM key files are generated in `~/.solo/keys` directory. - -``` -$ ls ~/.solo/cache/keys -a-private-node0.pem a-public-node1.pem hedera-node1.crt s-private-node0.pem s-public-node1.pem -a-private-node1.pem a-public-node2.pem hedera-node1.key s-private-node1.pem s-public-node2.pem -a-private-node2.pem hedera-node0.crt hedera-node2.crt s-private-node2.pem -a-public-node0.pem hedera-node0.key hedera-node2.key s-public-node0.pem - -``` - -Setup cluster with shared components - -``` -$ solo cluster setup - -# output is similar to example-1 - -``` - -In a separate terminal, you may run `k9s` to view the pod status. - -Deploy helm chart with Hedera network components - -``` -$ solo network deploy - -# output is similar to example-1 - -``` - -Setup node with Hedera platform.\ -It may take a while (~10 minutes depending on your internet speed) to download various docker images and get the -pods started. - -``` -$ solo node setup - -# output is similar to example-1 - -``` - -Start the nodes - -``` -$ solo node start - -# output is similar to example-1 - -``` - -### For Developers Working on Hedera Service Repo - -First, pleaes clone hedera service repo `https://github.com/hashgraph/hedera-services/` and build the code -with `./gradlew assemble`. If need to running nodes with different versions or releases, please duplicate the repo or build directories in -multiple directories, checkout to the respective version and build the code. - -To set customized `settings.txt` file, edit the file -`~/.solo/cache/templates/settings.txt` after `solo init` command. - -Then you can start customized built hedera network with the following command: - -``` -solo node setup --local-build-path <default path to hedera repo>,node1=<custom build hedera repo>,node2=<custom build repo> - -``` - -### For Developers Working on Platform core - -To deploy node with local build PTT jar files, run the following command: - -``` -solo node setup --local-build-path <default path to hedera repo>,node1=<custom build hedera repo>,node2=<custom build repo> - --app PlatformTestingTool.jar --app-config <path-to-test-json1,path-to-test-json2> - -``` - -### Logs - -You can find log for running solo command under the directory `~/.solo/logs/` -The file `solo.log` contains the logs for the solo command. -The file `hashgraph-sdk.log` contains the logs from solo client when sending transactions to network nodes. diff --git a/docs/content/getting-started/installation.md b/docs/content/getting-started/installation.md deleted file mode 100644 index d9c08b923..000000000 --- a/docs/content/getting-started/installation.md +++ /dev/null @@ -1,33 +0,0 @@ -*** - -title: Installation -weight: -20 -geekdocNav: true -geekdocAlign: center -geekdocAnchor: false --------------------- - -### Requirements - -Node(>=20.14.0) (*lts/hydrogen*) - -### Setup - -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 -``` - -### Install Solo - -Run `npm install -g @hashgraph/solo` - -{{< expand "Useful tools" ">" >}} - -Install [kubectl](https://kubernetes.io/docs/tasks/tools/) - -Install [k9s](https://k9scli.io/) -{{< /expand >}} diff --git a/docs/content/getting-started/setup.md b/docs/content/getting-started/setup.md deleted file mode 100644 index 7e6bb1edc..000000000 --- a/docs/content/getting-started/setup.md +++ /dev/null @@ -1,82 +0,0 @@ -*** - -title: Setup -weight: -20 -geekdocNav: true -geekdocAlign: center -geekdocAnchor: false --------------------- - -### Remote cluster - -You may use remote kubernetes cluster. In this case, ensure kubernetes context is set up correctly. - -``` -kubectl config use-context <context-name> - -``` - -### Local cluster - -You may use [kind](https://kind.sigs.k8s.io/) or [microk8s](https://microk8s.io/) to create a cluster.\ -In this case, -ensure your Docker engine has enough resources (e.g. Memory >=8Gb, CPU: >=4). Below we show how you can use `kind` to create a cluster - -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: - -```bash -kind create cluster -n "${SOLO_CLUSTER_NAME}" -``` - -Example output - -``` -Creating cluster "solo" ... - β Ensuring node image (kindest/node:v1.29.1) πΌ - β Preparing nodes π¦ - β Writing configuration π - β Starting control-plane πΉοΈ - β Installing CNI π - β Installing StorageClass πΎ -Set kubectl context to "kind-solo" -You can now use your cluster with: - -kubectl cluster-info --context kind-solo - -Have a nice day! π - -``` - -You may now view pods in your cluster using `k9s -A` as below: - -``` - Context: kind-solo <0> all <a> Attacβ¦ ____ __.________ - Cluster: kind-solo <1> default <ctrl-d> Delete| |/ _/ __ \______ - User: kind-solo <d> Descri| < \____ / ___/ - K9s Rev: v0.27.4 β‘οΈv0.32.3 <e> Edit | | \ / /\___ \ - K8s Rev: v1.27.3 <?> Help |____|__ \ /____//____ > - CPU: n/a <ctrl-k> Kill \/ \/ - MEM: n/a -ββββββββββββββββββββββββββββββββββββββββββββββ Pods(all)[9] ββββββββββββββββββββββββββββββββββββββββββββββ -β NAMESPACEβ NAME PF READY RESTARTS STATUS IP β -β kube-system coredns-5d78c9869d-kc27p β 1/1 0 Running 10.244.0.4 β -β kube-system coredns-5d78c9869d-r8mzz β 1/1 0 Running 10.244.0.3 β -β kube-system etcd-solo-control-plane β 1/1 0 Running 172.18.0.2 β -β kube-system kindnet-gppbk β 1/1 0 Running 172.18.0.2 β -β kube-system kube-apiserver-solo-control-plane β 1/1 0 Running 172.18.0.2 β -β kube-system kube-controller-manager-solo-control-plane β 1/1 0 Running 172.18.0.2 β -β kube-system kube-proxy-wb9w5 β 1/1 0 Running 172.18.0.2 β -β kube-system kube-scheduler-solo-control-plane β 1/1 0 Running 172.18.0.2 β -β local-path-storage local-path-provisioner-6bc4bddd6b-5vh5d β 1/1 0 Running 10.244.0.2 β -β β ----------------------------------------------------------------------------------------------------------- -``` diff --git a/docs/data/menu/main.yml b/docs/data/menu/main.yml index 4a3b1b4ab..538527ec5 100644 --- a/docs/data/menu/main.yml +++ b/docs/data/menu/main.yml @@ -1,19 +1,9 @@ --- main: - name: Getting Started - sub: - - name: Installation - ref: "/getting-started/installation.md" - - name: Setup - ref: "/getting-started/setup.md" - - name: Deploy - ref: "/getting-started/deploy.md" - - name: Contribution - sub: - - name: Solo - ref: "/contribution/contribution.md" - - name: Docs - ref: "/contribution/docs.md" + ref: "/User/README.md" + - name: Development + ref: "/Developer/DEV.md" - name: Classes ref: "/solo/static/Classes/index.html" external: true diff --git a/docs/generate_md.sh b/docs/generate_md.sh deleted file mode 100755 index 3c00c36d7..000000000 --- a/docs/generate_md.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env bash - -# find javascript files -FIND_CMD=$(find ../src -name "*js") - -# save result to array -FILES=($FIND_CMD) - -mkdir -p content/Classes - -for i in "${FILES[@]}" -do -# echo $i - # extract base file name from path, remove path and extension - BASENAME=$(basename $i .js) - jsdoc2md --no-cache -c jsdoc2md.conf.json $i > ./content/Classes/$BASENAME.md -done diff --git a/docs/hugo.toml b/docs/hugo.toml index 23e2f2fd5..b993fb722 100644 --- a/docs/hugo.toml +++ b/docs/hugo.toml @@ -33,3 +33,14 @@ tag = "tags" # (Optional, default false) Render menu from data file in 'data/menu/main.yaml'. # See also https://geekdocs.de/usage/menus/#bundle-menu. geekdocMenuBundle = true + # (Optional, default false) Display search results with the parent folder as prefix. This + # option allows you to distinguish between files with the same name in different folders. + # NOTE: This parameter only applies when 'geekdocSearch = true'. + geekdocSearchShowParent = true + # Set to true to make a section foldable in side menu. + geekdocCollapseSection = true + # Add an anchor link to headlines. + geekdocAnchor = true + +[minify] +disableHTML = true diff --git a/docs/jsdoc.conf.json b/docs/jsdoc.conf.json index e9f71d721..fa53de986 100644 --- a/docs/jsdoc.conf.json +++ b/docs/jsdoc.conf.json @@ -1,12 +1,12 @@ { + "plugins": ["plugins/markdown"], "source": { - "include": [ "../src" ], - "includePattern": ".+\\.(js(doc|x)?|mjs)$" + "include": [ "../src" ], + "includePattern": ".+\\.(js(doc|x)?|mjs)$" }, "sourceType": "module", "opts": { - "recurse": true, - "destination": "public/static/Classes" + "recurse": true, + "destination": "public/static/Classes" } } - diff --git a/docs/jsdoc2md.conf.json b/docs/jsdoc2md.conf.json deleted file mode 100644 index 14c09dfa1..000000000 --- a/docs/jsdoc2md.conf.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "source": { - "includePattern": ".+\\.(js(doc|x)?|mjs)$" - }, - "sourceType": "module", - "opts": { - "recurse": true - } -} - diff --git a/package-lock.json b/package-lock.json index 2e5251bd7..f4fd3dab5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -59,6 +59,7 @@ "jest-junit": "^16.0.0", "nyc": "^17.1.0", "remark-cli": "^12.0.1", + "remark-frontmatter": "^5.0.0", "remark-lint-list-item-indent": "^4.0.0", "remark-lint-unordered-list-marker-style": "^4.0.0", "remark-preset-lint-consistent": "^6.0.0", @@ -5378,6 +5379,19 @@ "reusify": "^1.0.4" } }, + "node_modules/fault": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/fault/-/fault-2.0.1.tgz", + "integrity": "sha512-WtySTkS4OKev5JtpHXnib4Gxiurzh5NCGvWrFaZ34m6JehfTUhKZvn9njTfw48t6JumVQOmrKqpmGcdwxnhqBQ==", + "dev": true, + "dependencies": { + "format": "^0.2.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, "node_modules/fb-watchman": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.2.tgz", @@ -5589,6 +5603,15 @@ "node": ">= 18" } }, + "node_modules/format": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/format/-/format-0.2.2.tgz", + "integrity": "sha512-wzsgA6WOq+09wrU1tsJ09udeR/YZRaeArL9e1wPbFg3GG2yDnC2ldKpxs4xunpFF9DgqCqOIra3bc1HWrJ37Ww==", + "dev": true, + "engines": { + "node": ">=0.4.x" + } + }, "node_modules/fromentries": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/fromentries/-/fromentries-1.3.2.tgz", @@ -8359,6 +8382,36 @@ "url": "https://opencollective.com/unified" } }, + "node_modules/mdast-util-frontmatter": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/mdast-util-frontmatter/-/mdast-util-frontmatter-2.0.1.tgz", + "integrity": "sha512-LRqI9+wdgC25P0URIJY9vwocIzCcksduHQ9OF2joxQoyTNVduwLAFUzjoopuRJbJAReaKrNQKAZKL3uCMugWJA==", + "dev": true, + "dependencies": { + "@types/mdast": "^4.0.0", + "devlop": "^1.0.0", + "escape-string-regexp": "^5.0.0", + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0", + "micromark-extension-frontmatter": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-frontmatter/node_modules/escape-string-regexp": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-5.0.0.tgz", + "integrity": "sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/mdast-util-heading-style": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/mdast-util-heading-style/-/mdast-util-heading-style-3.0.0.tgz", @@ -8532,6 +8585,22 @@ "micromark-util-types": "^2.0.0" } }, + "node_modules/micromark-extension-frontmatter": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/micromark-extension-frontmatter/-/micromark-extension-frontmatter-2.0.0.tgz", + "integrity": "sha512-C4AkuM3dA58cgZha7zVnuVxBhDsbttIMiytjgsM2XbHAB2faRVaHRle40558FBN+DJcrLNCoqG5mlrpdU4cRtg==", + "dev": true, + "dependencies": { + "fault": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, "node_modules/micromark-factory-destination": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/micromark-factory-destination/-/micromark-factory-destination-2.0.0.tgz", @@ -10228,6 +10297,22 @@ "url": "https://opencollective.com/unified" } }, + "node_modules/remark-frontmatter": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/remark-frontmatter/-/remark-frontmatter-5.0.0.tgz", + "integrity": "sha512-XTFYvNASMe5iPN0719nPrdItC9aU0ssC4v14mH1BCi1u0n1gAocqcujWUrByftZTbLhRtiKRyjYTSIOcr69UVQ==", + "dev": true, + "dependencies": { + "@types/mdast": "^4.0.0", + "mdast-util-frontmatter": "^2.0.0", + "micromark-extension-frontmatter": "^2.0.0", + "unified": "^11.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, "node_modules/remark-lint": { "version": "10.0.0", "resolved": "https://registry.npmjs.org/remark-lint/-/remark-lint-10.0.0.tgz", diff --git a/package.json b/package.json index 181060679..784352864 100644 --- a/package.json +++ b/package.json @@ -30,8 +30,8 @@ "merge-unit": "nyc merge ./coverage/unit/ .nyc_output/coverage.json", "report-coverage": "npm run merge-clean && npm run merge-unit && npm run merge-e2e && nyc report --reporter=json --reporter=html --reporter=lcov", "solo": "NODE_OPTIONS=--experimental-vm-modules node --no-deprecation solo.mjs", - "check": "rm -rf docs/public/*; remark . --quiet --frail && eslint .; cd docs; jsdoc -c jsdoc.conf.json", - "format": "remark . --quiet --frail --output && eslint --fix .", + "check": "remark . --quiet --frail && eslint . --ignore-pattern \"docs/*\"; cd docs; jsdoc -c jsdoc.conf.json", + "format": "remark . --quiet --frail --output && eslint --fix . --ignore-pattern \"docs/*\"", "test-setup": "./test/e2e/setup-e2e.sh", "test-coverage": "npm run test && npm run test-setup && npm run test-e2e-all && npm run report-coverage" }, @@ -57,9 +57,9 @@ "got": "^14.4.2", "inquirer": "^11.1.0", "ip": "^2.0.1", - "jsdoc": "^4.0.3", "js-base64": "^3.7.7", "js-yaml": "^4.1.0", + "jsdoc": "^4.0.3", "listr2": "^8.2.4", "semver": "^7.6.3", "stream-buffers": "^3.0.3", @@ -85,6 +85,7 @@ "jest-junit": "^16.0.0", "nyc": "^17.1.0", "remark-cli": "^12.0.1", + "remark-frontmatter": "^5.0.0", "remark-lint-list-item-indent": "^4.0.0", "remark-lint-unordered-list-marker-style": "^4.0.0", "remark-preset-lint-consistent": "^6.0.0", diff --git a/src/commands/cluster.mjs b/src/commands/cluster.mjs index d270b0e34..30d790a8a 100644 --- a/src/commands/cluster.mjs +++ b/src/commands/cluster.mjs @@ -17,7 +17,7 @@ 'use strict' import { ListrEnquirerPromptAdapter } from '@listr2/prompt-adapter-enquirer' import { Listr } from 'listr2' -import { SoloError, IllegalArgumentError } from '../core/errors.mjs' +import { SoloError } from '../core/errors.mjs' import * as flags from './flags.mjs' import { BaseCommand } from './base.mjs' import chalk from 'chalk' diff --git a/src/commands/init.mjs b/src/commands/init.mjs index 916fdaaf7..715734ba0 100644 --- a/src/commands/init.mjs +++ b/src/commands/init.mjs @@ -21,7 +21,7 @@ import { BaseCommand } from './base.mjs' import * as core from '../core/index.mjs' import { constants } from '../core/index.mjs' import * as fs from 'fs' -import { SoloError, IllegalArgumentError } from '../core/errors.mjs' +import { SoloError } from '../core/errors.mjs' import * as flags from './flags.mjs' import chalk from 'chalk' diff --git a/src/commands/node.mjs b/src/commands/node.mjs index 320df7ee6..186d36a03 100644 --- a/src/commands/node.mjs +++ b/src/commands/node.mjs @@ -43,8 +43,7 @@ import { NodeCreateTransaction, NodeUpdateTransaction, NodeDeleteTransaction, - ServiceEndpoint, - Timestamp + ServiceEndpoint } from '@hashgraph/sdk' import * as crypto from 'crypto' import { @@ -357,6 +356,8 @@ export class NodeCommand extends BaseCommand { /** * stops and closes the port forwards + * - calls the accountManager.close() + * - for all portForwards, calls k8.stopPortForward(srv) * @returns {Promise<void>} */ async close () { diff --git a/src/commands/node/configs.mjs b/src/commands/node/configs.mjs index 8e420f57b..1c90ad5db 100644 --- a/src/commands/node/configs.mjs +++ b/src/commands/node/configs.mjs @@ -14,7 +14,6 @@ * limitations under the License. * */ -import * as flags from '../flags.mjs' import { FREEZE_ADMIN_ACCOUNT } from '../../core/constants.mjs' export const PREPARE_UPGRADE_CONFIGS_NAME = 'prepareUpgradeConfig' diff --git a/test/scripts/README.md b/test/scripts/README.md index d66764375..2b9749f05 100644 --- a/test/scripts/README.md +++ b/test/scripts/README.md @@ -6,6 +6,7 @@ There are two scripts to generate node gossip keys and grpc TLS keys as below: * `test/scripts/gen-openssl-keys.sh`: It generates keys using `openssl` where each private and public keys are separate `pem` files. ## Usage + In order to generate keys in PEM format for 3 nodes (`node0,node1,node3`), run as below: ``` @@ -14,7 +15,8 @@ $ ./gen-openssl-keys.sh node0,node1,node3 ./keys ``` View the certificate using command below: -``` + +``` $ ls keys a-private-node0.pem a-public-node0.pem backup hedera-node0.crt hedera-node0.key s-private-node0.pem s-public-node0.pem $ openssl x509 -in keys/s-public-node0.pem -noout -text