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
This improves the configtxlator README.md to use '.pb' as the suffix for
files contain protobuf messages rather than '.proto' which confuses the
'make protos' target.
It also improves the scripts for the existing examples, to use common
functions and adds an interactive mode which pauses between each step,
so that the user may inspect the file artifacts as they are generated.
It additionally improves error checking on the output of the assorted
commands, as the script would not reliably fail at the error points, but
might continue several statements.
Finally, it adds a new example for adding an organization to a channel.
Change-Id: I5c60cefe364f41dfc0d15c1dc5dd8f9ddc85ea2b
Signed-off-by: Jason Yellick <[email protected]>
Copy file name to clipboardexpand all lines: examples/configtxupdate/README.md
+97-21
Original file line number
Diff line number
Diff line change
@@ -31,10 +31,10 @@ For extensibility, and because certain fields must be signed over, many proto fi
31
31
32
32
To convert a proto to its human readable JSON equivalent, simply post the binary proto to the rest target `http://$SERVER:$PORT/protolator/decode/<message.Name>` where `<message.Name>` is the fully qualified proto name of the message.
33
33
34
-
For instance, to decode a configuration block saved as `configuration_block.proto`, run the command:
34
+
For instance, to decode a configuration block saved as `configuration_block.pb`, run the command:
35
35
36
36
```
37
-
curl -X POST --data-binary @configuration_block.proto http://127.0.0.1:7059/protolator/decode/common.Block
37
+
curl -X POST --data-binary @configuration_block.pb http://127.0.0.1:7059/protolator/decode/common.Block
38
38
```
39
39
40
40
To convert the human readable JSON version of the proto message, simply post the JSON version to `http://$SERVER:$PORT/protolator/encode/<message.Name` where `<message.Name>` is again the fully qualified proto name of the message.
@@ -51,10 +51,10 @@ Any of the configuration related protos, including `common.Block`, `common.Envel
51
51
52
52
Given two different configurations, it is possible to compute the config update which transitions between them. Simply POST the two `common.Config` proto encoded configurations as `multipart/formdata`, with the original as field `original` and the updated as field `updated`, to `http://$SERVER:$PORT/configtxlator/compute/update-from-configs`.
53
53
54
-
For example, given the original config as the file `original_config.proto` and the updated config as the file `updated_config.proto` for the channel `desiredchannel`
54
+
For example, given the original config as the file `original_config.pb` and the updated config as the file `updated_config.pb` for the channel `desiredchannel`:
55
55
56
56
```
57
-
curl -X POST -F channel=desiredchannel -F original=@original_config.proto -F updated=@updated_config.proto http://127.0.0.1:7059/configtxlator/compute/update-from-configs
57
+
curl -X POST -F channel=desiredchannel -F original=@original_config.pb -F updated=@updated_config.pb http://127.0.0.1:7059/configtxlator/compute/update-from-configs
58
58
```
59
59
60
60
## Bootstraping example
@@ -72,23 +72,35 @@ $ configtxlator start
72
72
2017-05-31 12:57:22.499 EDT [configtxlator] main -> INFO 001 Serving HTTP requests on port: 7059
73
73
```
74
74
75
-
Then, in another window, build and run the `configtxgen` tool to produce a genesis block for the ordering system channel.
75
+
Then, in another window, build the `configtxgen` tool.
It is recommended to run the example by invoking the script `fabric/example/configtxupdate/bootstrap_batchsize/script.sh` as follows:
85
+
86
+
```
87
+
INTERACTIVE=true ./script.sh
83
88
```
84
-
$ configtxgen -outputBlock genesis_block.proto
89
+
90
+
This will write out what is happening at each step, pause, and allow you to inspect the artifacts generated before proceeding. Alternatively, you may run the steps below manually.
91
+
92
+
----
93
+
First produce a genesis block for the ordering system channel.
94
+
95
+
```
96
+
$ configtxgen -outputBlock genesis_block.pb
85
97
2017-05-31 14:15:16.634 EDT [common/configtx/tool] main -> INFO 001 Loading configuration
Decode the genesis block into a human editable form.
90
102
```
91
-
curl -X POST --data-binary @genesis_block.proto http://127.0.0.1:7059/protolator/decode/common.Block > genesis_block.json
103
+
curl -X POST --data-binary @genesis_block.pb http://127.0.0.1:7059/protolator/decode/common.Block > genesis_block.json
92
104
```
93
105
Edit the `genesis_block.json` file in your favorite JSON editor, or manipulate it programatically, here, we use the JSON CLI tool `jq`. For simplicity, we are editing the batch size for the channel, because it is a single numeric field, but any edits, including policy and MSP edits may be made here.
Start the orderer using the default options, including the provisional bootstrapper which will create a `testchainid` ordering system channel.
148
156
149
157
```
150
158
ORDERER_GENERAL_LOGLEVEL=debug orderer
151
159
```
152
160
161
+
Reconfiguring a channel can be performed in a very similar way to modifying a genesis config.
162
+
163
+
The recommended path to proceed with this example is to run the script located at `fabric/example/configtxupdate/reconfigure_batchsize/script.sh` by invoking
164
+
165
+
```
166
+
INTERACTIVE=true ./script.sh
167
+
```
168
+
169
+
This will write out what is happening at each step, pause, and allow you to inspect the artifacts generated before proceeding. Alternatively, you may run the steps below manually.
170
+
171
+
----
172
+
153
173
At this point, executing `examples/reconfig/script.sh` in another window will increase the batch size of the ordering system channel by 1, or, you may follow the steps below to do the process interactively.
2017-05-31 15:11:37.617 EDT [msp] getMspConfig -> INFO 001 intermediate certs folder not found at [/home/yellickj/go/src/github.com/hyperledger/fabric/sampleconfig/msp/intermediatecerts]. Skipping.: [stat /home/yellickj/go/src/github.com/hyperledger/fabric/sampleconfig/msp/intermediatecerts: no such file or directory]
158
178
2017-05-31 15:11:37.617 EDT [msp] getMspConfig -> INFO 002 crls folder not found at [/home/yellickj/go/src/github.com/hyperledger/fabric/sampleconfig/msp/intermediatecerts]. Skipping.: [stat /home/yellickj/go/src/github.com/hyperledger/fabric/sampleconfig/msp/crls: no such file or directory]
159
179
Received block: 1
@@ -164,7 +184,7 @@ Received block: 1
164
184
Send the config block to the `configtxlator` service for decoding:
165
185
166
186
```
167
-
curl -X POST --data-binary @config_block.proto http://127.0.0.1:7059/protolator/decode/common.Block > config_block.json
187
+
curl -X POST --data-binary @config_block.pb http://127.0.0.1:7059/protolator/decode/common.Block > config_block.json
At this point, the computed config update is now prepared, and traditionally, an SDK would be used to sign and wrap this message, but in the interest of using only the peer cli, the `configtxlator` can also be used for this task.
199
219
200
220
First, we decode the ConfigUpdate so that we may work with it as text.
201
221
202
222
```
203
-
$ curl -X POST --data-binary @config_update.proto http://127.0.0.1:7059/protolator/decode/common.ConfigUpdate > config_update.json
223
+
$ curl -X POST --data-binary @config_update.pb http://127.0.0.1:7059/protolator/decode/common.ConfigUpdate > config_update.json
The process to add an organization then follows exactly like the batch size example, but, instead of setting the batch size, a new org is defined at the application level. Adding an organization is slightly more involved, because we must first create a channel, then modify its membership set.
291
+
292
+
To see this example run the script `fabric/examples/configtxupdate/reconfig_membership/script.sh` by:
293
+
294
+
```
295
+
INTERACTIVE=true ./script.sh
296
+
```
297
+
298
+
Running the script interactively (as above), you may inspect the artifacts produced as they appear in the `example_output` directory.
0 commit comments