Upgrading the business network to a newer version

There are only four steps that are necessary to upgrade a deployed business network:

  1. Open the package.json file and update the version number for the application. In our case, it will update to 0.0.2  and will look like this:
{
"engines": {
"composer": "^0.20.4"
},
"name": "food-safety-b10407",
"version": "0.0.2",
...
  1. Create a new BNA file by running the composer archive create -t dir -n . command:
$ composer archive create -t dir -n .
Creating Business Network Archive

Looking for package.json of Business Network Definition
Input directory: /projects/hands-on-iot-solutions-with-blockchain/ch7/food-safety-b10407
Found:
Description: Hands-on IoT solutions with Blockchain
Name: food-safety-b10407
Identifier: [email protected]
Written Business Network Definition Archive file to
Output file: [email protected]

Command succeeded
  1. Install the new archive file in the Hyperledger environment:
$ composer network install --card PeerAdmin@hlfv1 --archiveFile [email protected]
√ Installing business network. This may take a minute...
Successfully installed business network food-safety-b10407, version 0.0.2

Command succeeded
  1. Finally, upgrade the network version to the new one:
$ composer network upgrade --card PeerAdmin@hlfv1 --networkName food-safety-b10407 --networkVersion 0.0.2
Upgrading business network food-safety-b10407 to version 0.0.2

√ Upgrading business network definition. This may take a minute...

Command succeeded

If all of the commands have run successfully, the business network will now be running on the new version, including the transactions and ACLs that were created in the preceding sections.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.97.216