Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggested updates to the sample network readme #19

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 33 additions & 9 deletions sample-network/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,47 @@ Feedback, comments, questions, etc. at Discord : [#fabric-kubernetes](https://di

![sample-network](../docs/images/fabric-operator-sample-network.png)

## Prerequisites:
## Essential Setup
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the term "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 have `just` installed then a `just everything` will setup everything!
For all the available recipies just run `just`
```shell
Available recipes:
cluster # Starts and configures a local KIND cluster
everything # Cluster and Fabric Network
network # Installs and configures a sample Fabric Network
unkind # Removes the local cluster
```

### Kubernetes

Expand Down Expand Up @@ -63,9 +90,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
Expand All @@ -82,8 +107,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
Expand Down
57 changes: 57 additions & 0 deletions sample-network/justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# 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

# Install the operations console
console:
#!/bin/bash
set -ex -o pipefail

./network console

# Installs just the operator
operator:
#!/bin/bash

./network operator

# Removes the local cluster
unkind:
./network unkind
3 changes: 2 additions & 1 deletion sample-network/scripts/console.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,11 @@ function console_up() {
wait_for_deployment hlf-console

local console_hostname=${NS}-hlf-console-console
local console_url="https://${CONSOLE_USERNAME}:${CONSOLE_PASSWORD}@${console_hostname}.${CONSOLE_DOMAIN}"
local console_url="https://${console_hostname}.${CONSOLE_DOMAIN}"

log ""
log "The Fabric Operations Console is available at ${console_url}"
log "Default user is \"${CONSOLE_USERNAME}\" with passworld \"${CONSOLE_PASSWORD}\""
log ""

# TODO: prepare an FoC bulk JSON import for the test network assets
Expand Down
Loading