You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+68-5Lines changed: 68 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -70,13 +70,22 @@ In this case, however, you should use generated `fablo-docker.sh` instead of `fa
70
70
### init
71
71
72
72
```bash
73
-
fablo init [node]
73
+
fablo init [node] [rest] [dev]
74
74
```
75
75
76
76
Creates simple network config file in current dir.
77
77
Good step to start your adventure with Fablo or set up a fast prototype.
78
78
79
-
Option `node` makes Fablo to generate a sample Node.js chaincode as well.
79
+
Fablo `init` command takes three parameters (the order does not matter):
80
+
* Option `node` makes Fablo to generate a sample Node.js chaincode as well.
81
+
* Option `rest` enables simple REST API with [Fablo REST](https://github.com/softwaremill/fablo-rest) as standalone Docker container.
82
+
* Option `dev` enables running peers in dev mode (so the hot reload for chaincode is possible).
83
+
84
+
Sample command:
85
+
86
+
```bash
87
+
fablo init node dev
88
+
```
80
89
81
90
Generated `fablo-config.json` file uses single node Solo consensus and no TLS support.
82
91
This is the simplest way to start with Hyperledger Fabric, since Raft consensus requires TLS and TLS itself adds a lot of complexity to the blockchain network and integration with it.
@@ -178,16 +187,69 @@ If you want to use Fablo for network configuration setup only, then the `fabric-
178
187
179
188
## Managing chaincodes
180
189
190
+
### chaincode(s) install
191
+
192
+
```bash
193
+
fablo chaincodes install
194
+
```
195
+
Install all chaincodes. Might be useful iffor some reason, Fablo won't manage to do it by itself.
196
+
197
+
If you want to install a single chaincode defined in Fablo config file, execute:
Upgrades and instantiates chaincode with given name on all relevant peers.
209
+
Upgrades chaincode with given name on all relevant peers.
188
210
Chaincode directory is specified in Fablo config file.
189
211
190
-
## Chaincode scripts
212
+
### Running chaincodes in dev mode
213
+
214
+
Hyperledger Fabric allows to run peers in [dev mode](https://hyperledger-fabric.readthedocs.io/en/release-2.4/peer-chaincode-devmode.html) in order to allow simple develop of chaincodes.
215
+
In this case chaincodes do not need to be upgraded each time, but they are run locally.
216
+
This feature allows hot reload of chaincode code and speeds up the development a lot.
217
+
218
+
Fablo will run peers in dev mode when `global.peerDevMode` is set to `true`.
219
+
Note: in this case TLS has to be disabled, otherwise config validation fails.
220
+
221
+
The simplest way of trying Fablo with dev mode is as follows:
222
+
223
+
1. Execute `fablo init node dev`.
224
+
It will initialize Fablo config file with sample node chaincode and dev mode enabled.
225
+
In this case Fablo config file has `global.peerDevMode` set to `true`, and the `package.json` file for sample Node.js chaincode has a script for running chaincode in dev mode (`start:dev`).
226
+
2. Start the network with `fablo up`.
227
+
Because dev mode is enabled, chaincode containers don't start.
228
+
Instead, Fablo approves and commits chaincode definitions from Fablo config file.
229
+
3. Npm install and start the sample chaincode with:
230
+
```bash
231
+
(cd chaincodes/chaincode-kv-node && nvm use && npm i && npm run start:watch)
232
+
```
233
+
Now, when you update the chaincode source code, it will be automatically refreshed on Hyperledger Fabric Network.
234
+
235
+
Our sample chaincode definition contains some scripts forrunning chaincodein dev mode:
exports[`samples/fablo-config-hlf1.3-2orgs-1chaincode-private-data.json should create proper e2e/__tmp__/samples/fablo-config-hlf1.3-2orgs-1chaincode-private-data.json.tmpdir/fablo-target/fabric-docker/.env from samples/fablo-config-hlf1.3-2orgs-1chaincode-private-data.json 1`] = `
2080
-
"FABLO_VERSION=1.0.3-unstable
2084
+
"FABLO_VERSION=1.1.0-unstable
2081
2085
FABLO_BUILD=<datewithgithash>
2082
2086
FABLO_REST_VERSION=0.1.0
2083
2087
HYPERLEDGER_EXPLORER_VERSION=1.1.8
@@ -2316,18 +2320,41 @@ installChaincodes() {
2316
2320
2317
2321
}
2318
2322
2319
-
notifyOrgsAboutChannels() {
2320
-
printHeadline \\"Creating new channel config blocks\\" \\"U1F537\\"
exports[`samples/fablo-config-hlf1.4-1org-1chaincode-raft.json should create proper e2e/__tmp__/samples/fablo-config-hlf1.4-1org-1chaincode-raft.json.tmpdir/fablo-target/fabric-docker/.env from samples/fablo-config-hlf1.4-1org-1chaincode-raft.json 1`] = `
1491
-
"FABLO_VERSION=1.0.3-unstable
1495
+
"FABLO_VERSION=1.1.0-unstable
1492
1496
FABLO_BUILD=<datewithgithash>
1493
1497
FABLO_REST_VERSION=0.1.0
1494
1498
HYPERLEDGER_EXPLORER_VERSION=1.1.8
@@ -1680,15 +1684,39 @@ installChaincodes() {
1680
1684
1681
1685
}
1682
1686
1683
-
notifyOrgsAboutChannels() {
1684
-
printHeadline \\"Creating new channel config blocks\\" \\"U1F537\\"
0 commit comments