hyperledger-labs / fablo

Fablo is a simple tool to generate the Hyperledger Fabric blockchain network and run it on Docker. It supports RAFT and solo consensus protocols, multiple organizations and channels, chaincode installation and upgrade.
Apache License 2.0
192 stars 72 forks source link

feature- add CLI options to init command #444

Open Sanket-0510 opened 4 months ago

Sanket-0510 commented 4 months ago

Currently, executing fablo init initializes a small network configuration file. However, it would greatly enhance user experience if I could specify the number of organizations and peers directly from the command line interface (CLI). This would enable the generation of the configuration JSON file based on the inputs provided via CLI options.

Sanket-0510 commented 4 months ago

hey @dzikowski any thoughts over this? I may raise PR to add this feature soon then.

dzikowski commented 4 months ago

I think it might be a bit tricky to implement, but you can start it if you want

Sanket-0510 commented 4 months ago

This one is indeed a tricky one cause its such a difficult task to identify where exactly the fablo-config.json is getting created. Turns out that, this line - https://github.com/hyperledger-labs/fablo/blob/cbd4ed0049d1b0876927cdbea80ee10531bbc7ba/fablo.sh#L122

initializes a temporary directory which has fablo as starting name and then some random string eg. fablo.34dfgrt and this is created at /tmp/fablo.xxxxxx. I understand this gets created but from where are we getting this sample config file already defined in this folder. basically it should initialise the temp folder but from where do am I getting this sample config file?

from console debugging I identified where the flow is going turn out that the schema for the sample-config file is getting modified here -https://github.com/hyperledger-labs/fablo/blob/cbd4ed0049d1b0876927cdbea80ee10531bbc7ba/src/init/index.ts but again changing log statements here had no effect on actual command run.

Sanket-0510 commented 4 months ago

What I am guessing is that when I do init everything gets mounted to a docker container and that container and log statements and everything gets executed from there and that container gets destroyed after the execution, again I am not sure, I am guessing from this command - https://github.com/hyperledger-labs/fablo/blob/cbd4ed0049d1b0876927cdbea80ee10531bbc7ba/fablo.sh#L145C1-L150C9

Sanket-0510 commented 4 months ago

@dzikowski @Hejwo you guys have done a lot of engineering and encapsulation while setting up this sample fablo-config.json :disappointed_relieved: