-
Notifications
You must be signed in to change notification settings - Fork 8.9k
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
Upgrading the fabric components #4863
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -33,6 +33,7 @@ Here's a list of some of the **peer** environment variables (with sample values | |||||||||
|
||||||||||
``` | ||||||||||
CORE_PEER_TLS_ENABLED=true | ||||||||||
CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=fabric_test | ||||||||||
CORE_PEER_GOSSIP_USELEADERELECTION=true | ||||||||||
CORE_PEER_GOSSIP_ORGLEADER=false | ||||||||||
CORE_PEER_PROFILE_ENABLED=true | ||||||||||
|
@@ -47,12 +48,20 @@ CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:7052 | |||||||||
CORE_PEER_GOSSIP_BOOTSTRAP=peer0.org1.example.com:7051 | ||||||||||
CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org1.example.com:7051 | ||||||||||
CORE_PEER_LOCALMSPID=Org1MSP | ||||||||||
CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/fabric/msp | ||||||||||
//If using couchdb add these configurations also | ||||||||||
CORE_LEDGER_STATE_STATEDATABASE=CouchDB | ||||||||||
CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb0:5984 | ||||||||||
CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME=admin | ||||||||||
CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD=adminpw | ||||||||||
``` | ||||||||||
|
||||||||||
Here are some **ordering node** variables (again, these are sample values) that might be listed in the environment variable file for a node. Again, you may or may not need to set all of these environment variables: | ||||||||||
|
||||||||||
``` | ||||||||||
ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 | ||||||||||
ORDERER_GENERAL_LISTENPORT=7050 | ||||||||||
ORDERER_CHANNELPARTICIPATION_ENABLED=true | ||||||||||
ORDERER_GENERAL_GENESISMETHOD=file | ||||||||||
ORDERER_GENERAL_GENESISFILE=/var/hyperledger/orderer/orderer.genesis.block | ||||||||||
ORDERER_GENERAL_LOCALMSPID=OrdererMSP | ||||||||||
|
@@ -111,8 +120,11 @@ docker stop $ORDERER_CONTAINER | |||||||||
|
||||||||||
Once the orderer is down, you'll want to **backup its ledger and MSP**: | ||||||||||
|
||||||||||
Copying the orderer and production folder because the orderer checks for the certificate in the orderer folder only that is the reason we are copying the orderer and production folder. | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm ok with the below update to copy all the /var/hyperledger content, but I'd remove the sentence above because it is confusing and doesn't add much value. |
||||||||||
``` | ||||||||||
docker cp $ORDERER_CONTAINER:/var/hyperledger/production/orderer/ ./$LEDGERS_BACKUP/$ORDERER_CONTAINER | ||||||||||
docker cp $ORDERER_CONTAINER:/var/hyperledger/ ./$LEDGERS_BACKUP/$ORDERER_CONTAINER | ||||||||||
|
||||||||||
docker cp $ORDERER_CONTAINER:/etc/hyperledger/fabric ./$LEDGERS_BACKUP/Identity | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When using test-network I don't think the identity is stored in /etc/hyperledger/fabric. |
||||||||||
``` | ||||||||||
|
||||||||||
Then remove the ordering node container itself (since we will be giving our new container the same name as our old one): | ||||||||||
|
@@ -124,11 +136,7 @@ docker rm -f $ORDERER_CONTAINER | |||||||||
Then you can launch the new ordering node container by issuing: | ||||||||||
|
||||||||||
``` | ||||||||||
docker run -d -v /opt/backup/$ORDERER_CONTAINER/:/var/hyperledger/production/orderer/ \ | ||||||||||
-v /opt/msp/:/etc/hyperledger/fabric/msp/ \ | ||||||||||
--env-file ./env<name of node>.list \ | ||||||||||
--name $ORDERER_CONTAINER \ | ||||||||||
hyperledger/fabric-orderer:$IMAGE_TAG orderer | ||||||||||
docker run -d -v ./backup/$ORDERER_CONTAINER/:/var/hyperledger/ -v ./backup/Identity:/etc/hyperledger/fabric/ --env-file ./envorderer.list --name $ORDERER_NAME -p 7050:7050 -p 7053:7053 -p 9443:9443 --network fabric_test hyperledger/fabric-orderer:$IMAGE_TAG orderer | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please keep the line formatting. |
||||||||||
``` | ||||||||||
|
||||||||||
Once all of the ordering nodes have come up, you can move on to upgrading your peers. | ||||||||||
|
@@ -167,6 +175,8 @@ We can then **backup the peer’s ledger and MSP**: | |||||||||
|
||||||||||
``` | ||||||||||
docker cp $PEER_CONTAINER:/var/hyperledger/production ./$LEDGERS_BACKUP/$PEER_CONTAINER | ||||||||||
|
||||||||||
docker cp $PEER_CONTAINER:/etc/hyperledger/fabric/ ./$LEDGERS_BACKUP/Identity | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Again, which identity files? |
||||||||||
``` | ||||||||||
|
||||||||||
With the peer stopped and the ledger backed up, **remove the peer chaincode containers**: | ||||||||||
|
@@ -192,11 +202,7 @@ docker rm -f $PEER_CONTAINER | |||||||||
Then you can launch the new peer container by issuing: | ||||||||||
|
||||||||||
``` | ||||||||||
docker run -d -v /opt/backup/$PEER_CONTAINER/:/var/hyperledger/production/ \ | ||||||||||
-v /opt/msp/:/etc/hyperledger/fabric/msp/ \ | ||||||||||
--env-file ./env<name of node>.list \ | ||||||||||
--name $PEER_CONTAINER \ | ||||||||||
hyperledger/fabric-peer:$IMAGE_TAG peer node start | ||||||||||
docker run -d -v ./peer1_backup/$PEER_CONTAINER/production/:/var/hyperledger/production -v ./peer1_backup/Identity/:/etc/hyperledger/fabric -v /var/run/docker.sock:/var/run/docker.sock --env-file ./envpeer1.list --name $PEER1_NAME -p 7051:7051 -p 9444:9444 --network fabric_test hyperledger/fabric-peer:$IMAGE_TAG peer node start | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Again, keep the line formatting. |
||||||||||
``` | ||||||||||
|
||||||||||
You do not need to relaunch the chaincode container. When the peer gets a request for a chaincode, (invoke or query), it first checks if it has a copy of that chaincode running. If so, it uses it. Otherwise, as in this case, the peer launches the chaincode (rebuilding the image if required). | ||||||||||
|
@@ -211,6 +217,48 @@ Before you attempt this, you may want to upgrade peers from enough organizations | |||||||||
|
||||||||||
To learn how to upgrade your Fabric CA server, click over to the [CA documentation](http://hyperledger-fabric-ca.readthedocs.io/en/latest/users-guide.html#upgrading-the-server). | ||||||||||
|
||||||||||
(OR) | ||||||||||
|
||||||||||
You can also follow these steps: | ||||||||||
Comment on lines
+220
to
+222
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
|
||||||||||
``` | ||||||||||
export CA_ORDERER_CONTAINER=7af1328915cc // Replace with your docker container | ||||||||||
|
||||||||||
export CA_ORDERER_NAME=ca_orderer | ||||||||||
``` | ||||||||||
|
||||||||||
Create the backup folder | ||||||||||
|
||||||||||
``` | ||||||||||
mkdir ca_orderer_backup | ||||||||||
|
||||||||||
export LEDGERS_BACKUP=ca_orderer_backup | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is not a ledger backup. Use a more appropriate name. |
||||||||||
``` | ||||||||||
|
||||||||||
Backup the contents: | ||||||||||
|
||||||||||
``` | ||||||||||
docker cp $CA_ORDERER_CONTAINER:/etc/hyperledger/fabric-ca-server/ ./$LEDGERS_BACKUP/ca | ||||||||||
``` | ||||||||||
|
||||||||||
Stop the docker container and remove the old container | ||||||||||
|
||||||||||
``` | ||||||||||
docker stop $CA_ORDERER_CONTAINER | ||||||||||
|
||||||||||
docker rm -f $CA_ORDERER_NAME | ||||||||||
|
||||||||||
``` | ||||||||||
|
||||||||||
Run the docker ca with upgraded version | ||||||||||
|
||||||||||
``` | ||||||||||
docker run -d -v ./organizations/fabric-ca/ordererOrg:/etc/hyperledger/fabric-ca-server --env-file ./caorderer_backup.list --name $CA_ORDERER_NAME -p 9054:9054 -p 19054:19054 --network fabric_test hyperledger/fabric-ca:1.5.7 sh -c 'fabric-ca-server start -b admin:adminpw -d' | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please keep line formatting like the prior examples. |
||||||||||
|
||||||||||
``` | ||||||||||
|
||||||||||
Likewise do this for other organizations | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
|
||||||||||
## Upgrade SDK clients | ||||||||||
|
||||||||||
Upgrade Fabric before upgrading SDK clients. Fabric is tested for backwards compatibility with older SDK clients. While newer SDK clients often work with older Fabric releases, they may expose features that are not yet available in the older Fabric releases, and are not tested for full compatibility. | ||||||||||
|
@@ -226,6 +274,50 @@ To upgrade CouchDB: | |||||||||
3. Install the latest CouchDB binaries or update deployment scripts to use a new Docker image. | ||||||||||
4. Restart CouchDB. | ||||||||||
|
||||||||||
Follow these steps to upgrade the couchdb | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should listed as an option in the "Upgrade the peers" section above. |
||||||||||
|
||||||||||
``` | ||||||||||
export COUCHDB0_CONTAINER=a5525c4424c6 //Replace with your couchdb container | ||||||||||
|
||||||||||
export COUCHDB0_NAME=couchdb0 | ||||||||||
|
||||||||||
``` | ||||||||||
Create the couchdb backup folder | ||||||||||
|
||||||||||
``` | ||||||||||
mkdir couchdb0_backup | ||||||||||
|
||||||||||
export LEDGERS_BACKUP=couchdb0_backup | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use a more appropriate name. |
||||||||||
|
||||||||||
``` | ||||||||||
|
||||||||||
Stop the container | ||||||||||
|
||||||||||
``` | ||||||||||
docker stop $COUCHDB0_CONTAINER | ||||||||||
``` | ||||||||||
|
||||||||||
Backup the contents | ||||||||||
|
||||||||||
``` | ||||||||||
docker cp $COUCHDB0_CONTAINER:/opt/couchdb/data/ ./$LEDGERS_BACKUP/ | ||||||||||
|
||||||||||
``` | ||||||||||
|
||||||||||
Remove the existing container | ||||||||||
|
||||||||||
``` | ||||||||||
docker rm -f $COUCHDB0_NAME | ||||||||||
``` | ||||||||||
Run the couchdb with upgraded docker version | ||||||||||
|
||||||||||
``` | ||||||||||
docker run -d -v ./$LEDGERS_BACKUP/data/:/opt/couchdb/data/ --env-file ./couchdb0_backup.list --name $COUCHDB0_NAME -p 5984:5984 --network fabric_test couchdb:3.3.2 | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
|
||||||||||
``` | ||||||||||
|
||||||||||
Do this for all the couchdb containers | ||||||||||
|
||||||||||
## Upgrade Node chaincode shim | ||||||||||
|
||||||||||
To move to the new version of the Node chaincode shim a developer would need to: | ||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This addition breaks up the prior and next paragraphs which were meant to run together.
Also, we try not to repeat doc content in various places. The signature gathering for channel updates is documented here:
https://hyperledger-fabric.readthedocs.io/en/latest/channel_update_tutorial.html#sign-and-submit-the-config-update
I'd suggest to refer to the channel update tutorial instead of re-documenting it here.