Skip to content
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

User initialization #432

Open
Nova38 opened this issue Mar 14, 2024 · 9 comments
Open

User initialization #432

Nova38 opened this issue Mar 14, 2024 · 9 comments

Comments

@Nova38
Copy link

Nova38 commented Mar 14, 2024

Would it be possible to support creating users via the schema document. This would allow for streamlined setup of multi user environments, in addition to potentially useful for the snapshot feature in testing.

@dzikowski
Copy link
Contributor

What do you mean by schema document?

Currently when you create a snapshot of the network in Fablo, it also keeps all CA user accounts. You just need to create them upfront.

@Nova38
Copy link
Author

Nova38 commented Mar 15, 2024

Ah okay that is helpful. The schema i was refering to is the json schema for the config file (https://github.com/hyperledger-labs/fablo/releases/download/1.2.1-unstable.0/schema.json)

My main thought was to extend the config file to include declartive user creation.

The values bellow i used the hlf bevel operator cmd as a refrence (https://github.com/hyperledger/bevel-operator-fabric?tab=readme-ov-file#register-and-enrolling-org1msp-identity)

kubectl hlf ca register --name=org1-ca --namespace=default --user=admin --secret=adminpw \
    --type=admin --enroll-id enroll --enroll-secret=enrollpw --mspid=Org1MSP
{
  "organization": {
    "name": "Org1",
    "domain": "org1.example.com"
  },
  "peer": {
    "instances": 2,
    "db": "LevelDb"
  },
  "ca":{ 
    "enrollId": "enroll",
    "enrollSecret": "enrollpw",
    "users": [
      {
        "name": "admin",
        "type": "admin",
        "secret": "adminpw"
      }
    ]
  }
}

@dzikowski
Copy link
Contributor

I see. That would be useful. I suppose it involves two things:

  1. Adding relevant fields to config class (src/types/FabloConfigJson.ts) and config extended class (src/types/FabloConfigExtended.ts), and changing hardcoded values here: setup-docker/templates/fabric-docker/.env
  2. Register users, by calling CA server CLI or endpoint somewhere here (additional function?): setup-docker/templates/fabric-docker/commands-generated.sh.

@Nova38
Copy link
Author

Nova38 commented Mar 20, 2024

Awesome, when I get a chance this week/next I will take a look and put together a pull request

@Nova38
Copy link
Author

Nova38 commented Mar 27, 2024

Do you mind if I include the code needed to also generate a network configuration file for hyperledger caliper as with the users generated it should be simple to populate the needed paths in the config file for all the given users.

https://hyperledger.github.io/caliper/v0.5.0/fabric-tutorial/tutorials-fabric-existing/#create-a-template-network-configuration-file

That would also partially address issue #298 298

Or would it be better to do that in another pull request if there is interest in it?

@dzikowski
Copy link
Contributor

Please do it in a way that is more convenient for you. We'll be more than happy to have Caliper onboard. Thanks!

@Nova38
Copy link
Author

Nova38 commented Mar 30, 2024

It looks like the cli (fabric-tools) container doesn't have the fabric-ca-client exe. Should I download it dynamically, based on the fabric version, and then put it in the /workspaces/fablo/fablo-target/fabric-docker/scripts/cli folder that is mounted by the fabric-ci-box? Or is there a better place i should put it?

@dzikowski
Copy link
Contributor

Yeah, I think this is a good approach, since we want to deprecate fabric-tools anyway (#245). It's also deprecated in Hyperledger Fabric.

Have a look at this PR: #316. It seems there was an effort towards downloading binaries, but I'm not sure why it's not merged. I guess it was just not required at that time. (@gzhk do you remember?).

Anyway, I think you can reuse some code from #316 if you find it useful. And yes, scripts/cli path sounds good.

@dzikowski
Copy link
Contributor

dzikowski commented May 7, 2024

Hi @Nova38 how is it going? Do you need some help with this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants