且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

升级Hyperledger Fabric业务网络

更新时间:2023-10-18 09:15:46

Hyperledger Composer现在符合"在Fabric上部署和升级链码的标准方式,所以恐怕您对此一无所知. >

您创建的每个新版本的Network都会有一个新的Docker Image和一个新的Docker容器,因此,如果您在开发中进行许多迭代,则需要清理这些旧版本.

如果您想进行快速测试并且不需要REST服务器,则可以使用Composer Playground 在此处在线,或通过本地运行.如果您在线使用它,或者使用Web Profile在本地使用它,则业务网络将在浏览器本地存储中的模拟Fabric中运行,这是升级和测试的快速过程.

更新后的评论 升级业务网络时,您不会丢失数据-您可能会丢失数据的可见性!如果更改模型并添加字段而不使其成为可选字段,则会发生这种情况.有关更多详细信息,请参见数据迁移.

I am working with composer 0.19.8 to develop hyperledger blockchain app. My problem is that every time I make changes to the blockchain models I have to update the business network version in package.json and restart the fabric server in order for changes to reflect on Composer REST Server. If I do not do that the changes I made are not reflected on the rest server API(generated API by composer-rest-server command).

Is there a way to override the current business network version instead of updating to a new version number in the package.json file?

Hyperledger Composer is now 'compliant' with the standard way of deploying and upgrading chaincode on the Fabric, so you are stuck with this I'm afraid.

With each new version of the Network that you create there will be a new Docker Image and a new Docker container created, so if you are working with many iterations in your development you will want to clean up these old versions.

If you want to do quick testing and don't need the REST server, you could use the Composer Playground either online here, or by running locally. If you use it on line, or locally using the Web Profile, the Business Network is run in a simulated Fabric in the Browser local storage, and this is a fast process to upgrade and test.

Update Following Comment When you upgrade a Business Network you don't loose the data - you may loose visibility of the data! This happens if you change the model and add fields without making them optional. There are more details of this in the Composer Knowledge Wiki section on Data Migration.