diff --git a/sample-network/README.md b/sample-network/README.md index b0fb46e1..57415394 100644 --- a/sample-network/README.md +++ b/sample-network/README.md @@ -12,20 +12,39 @@ Feedback, comments, questions, etc. at Discord : [#fabric-kubernetes](https://di ![sample-network](../docs/images/fabric-operator-sample-network.png) -## Prerequisites: +## Essential Setup -### General +### Clone this repo + +Remeber to clone this repo and change to the `sample-network` directory + +```shell +git clone https://github.com/hyperledger-labs/fabric-operator.git +cd fabric-operator/sample-network +``` + +### Required Tools + +If you don't have these already, please install these first. - [kubectl](https://kubernetes.io/docs/tasks/tools/) - [jq](https://stedolan.github.io/jq/) - [envsubst](https://www.gnu.org/software/gettext/manual/html_node/envsubst-Invocation.html) (`brew install gettext` on OSX) -- [k9s](https://k9scli.io) (recommended) -- Fabric binaries (peer, osnadmin, etc.) will be installed into the local `bin` folder. Add these to your PATH: +Note that the Fabric binaries (peer, osnadmin, etc.) will be installed for you into a local `bin` folder. These should be added to your PATH: ```shell export PATH=$PWD:$PWD/bin:$PATH ``` +### Optional Tools + +These are optional but strongly recommended; especially if you want to run a local cluster. + +- [kind](https://kind.sigs.k8s.io/) if you want to create a cluster locally, see below for other options +- [k9s](https://k9scli.io) (recommended, but not essential) +- [just](https://github.com/casey/just#installation) to run all the comamnds here directly + +If you've run this tutorial before, there is a `justfile` that can used as a helpful 'cheatsheet' of the commands. If you `just` installed then a `just ` will setup and create a channel for you. ### Kubernetes @@ -63,9 +82,7 @@ export TEST_NETWORK_INGRESS_DOMAIN=test-network.example.com For additional guidelines on configuring ingress and DNS, see [Considerations for Kubernetes Distributions](https://cloud.ibm.com/docs/blockchain-sw-252?topic=blockchain-sw-252-deploy-k8#console-deploy-k8-considerations). - - -## Sample Network +## Starting the Sample Network Install the Nginx controller and Fabric CRDs: ```shell @@ -82,8 +99,7 @@ Explore Kubernetes `Pods`, `Deployments`, `Services`, `Ingress`, etc.: kubectl -n test-network get all ``` - -## Chaincode +## Deploying Chaincode In the examples below, the `peer` binary will be used to invoke smart contracts on the org1-peer1 ledger. Set the CLI context with: ```shell diff --git a/sample-network/justfile b/sample-network/justfile new file mode 100644 index 00000000..36cd5ce8 --- /dev/null +++ b/sample-network/justfile @@ -0,0 +1,44 @@ +# Apache-2.0 + +# Main justfile to run all the scripts +# +# To install 'just' see https://github.com/casey/just#installation + + +# Ensure all properties are exported as shell env-vars +set export + +# set the current directory, and the location of the test dats +CWDIR := justfile_directory() + +_default: + @just --list + +# Starts and configures a local KIND cluster +cluster: + #!/bin/bash + set -ex -o pipefail + + # create and configure the cluster + ./network kind + ./network cluster init + +# Installs and configures a sample Fabric Network +network: + #!/bin/bash + set -ex -o pipefail + + # create Fabric network + ./network up + + kubectl -n test-network get all + + # create Fabric channnel + ./network channel create + +# Cluster and Fabric Network +everything: cluster network + +# Removes the local cluster +unkind: + ./network unkind \ No newline at end of file