hyperledger-labs/fabric-operations-console

SampleConsortium not found when creating channel

Closed this issue · 14 comments

It seems that the consortium name SampleConsortium has been hardcoded, and there is no way to select/correct the consortium name, as a result, when creating a Channel on a different consortium, it fails.

@sownak yes, you are right... console does not have a way to configure the consortium name for channel creation... it would be fairly easy to add a config during channel creation to control it... We will look at it, but if you have time (and need it soon) I can walk you through how to get this feature added.

@varadgit Thanks. Can you please point to the files where this feature can be added?

There are two approaches I was thinking.

  1. The easiest is to add a default_consortium to the settings that allow the console to use the new one. This would work where all the orderers that are managed by a given console uses that name. There is no selection for the consortium name, but the console uses the newly configured one as the default.

Update the API layer to add a configuration that's customizable:

a. Add a new variable in https://github.com/hyperledger-labs/fabric-operations-console/blob/main/packages/athena/json_docs/default_settings_doc.json#L224
something like
"default_consortium": "SampleConsortium",

b. Export it into settings. If it is not available, you can set it to "SampleConsortium" for backward compatibility. This will expose the new variable into settings REST call (which the UI would use) - https://github.com/hyperledger-labs/fabric-operations-console/blob/main/packages/athena/libs/settings.js#L154

Update the UI to use the new configuration:

Set props -
https://github.com/hyperledger-labs/fabric-operations-console/blob/main/packages/apollo/src/App.js#L153

Load props into channel modal -

newProps['configtxlator_url'] = _.get(state, 'settings.configtxlator_url');

add to the options consortium_id

Remove hardcoded option -

options.consortium_id = 'SampleConsortium';

You may have to update the consortium name we use in the template based on what gets sent into the options
https://github.com/hyperledger-labs/fabric-operations-console/blob/main/packages/apollo/src/rest/ChannelApi.js#L272
read_set.values.Consortium.value.name
write_set.values.Consortium.value.name

  1. The next approach is to allow people to specify the consortium names as an array as part of the orderer JSON import. If there are more than one consortium names defined, when creating a channel it can allow people to select the consortium like below. We can work towards this one next.
    image

The pattern is sort of like how system channel name is handled, except use an array instead of a string and allow people to select during channel creation
https://github.com/hyperledger-labs/fabric-operations-console/search?q=system_channel_id

@varadgit Thanks for this. I have made the changes, but the ./scripts/buildImages.sh console command is failing with

Step 11/44 : RUN npm ci && npm run build_all
 ---> Running in 041250311f86
npm ERR! code EACCES
npm ERR! syscall mkdir
npm ERR! path /home/stitch/node_modules
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, mkdir '/home/stitch/node_modules'
npm ERR!  [OperationalError: EACCES: permission denied, mkdir '/home/stitch/node_modules'] {
npm ERR!   cause: [Error: EACCES: permission denied, mkdir '/home/stitch/node_modules'] {
npm ERR!     errno: -13,
npm ERR!     code: 'EACCES',
npm ERR!     syscall: 'mkdir',
npm ERR!     path: '/home/stitch/node_modules'
npm ERR!   },
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'mkdir',
npm ERR!   path: '/home/stitch/node_modules'
npm ERR! }
npm ERR! 
npm ERR! The operation was rejected by your operating system.

seems USER 1001 is causing permission issues.

@dshuffma-ibm is this due to the recent image update with UBI?

@sownak can you pull down and retry the build?

@varadgit Thanks, that fixed the docker build error. But I have made all the changes and now the consortium is coming as empty. Maybe I will just change the consortium name to our default one and wait for the Option 2 changes

@sownak can you tell me where consortium is coming as empty? also if you can make a draft PR, I can take a look if there are things that I can spot

cool! I missed mentioning one other spot and included that change as part of the PR... hopefully it works now with the new commit. We need expand the change a little bit if you want to be able to add/remove consortium members to the system channel. Most of that logic should be in https://github.com/hyperledger-labs/fabric-operations-console/blob/089afe360e5ee0e00db505653a5ebeac45c54720/packages/apollo/src/rest/OrdererRestApi.js

Thanks, that worked. Successfully able to add a new channel, though maybe will need to do the 2nd part of the changes as well to either select Consortium or set as ENV var

That's great! That can be a second feature in a separate PR now that you are fairly comfortable with making changes :-)

@sownak I took the liberty to update the PR with support for non-default consortium for system channel... feel free to flip the PR from draft mode when you are ready for me to merge.

Default consortium can now be changed via config.yaml, so this issue can be closed.

Thanks!
This PR addresses the main issue... we can open up a new issue for part 2 (to support multiple consortiums) later on if there is demand...
#51