Running multiple instances of create-daml-app simultaneously against multiple participants
- Phoebe_NicholsOP 2
Is there a way to run multiple instances of the create-daml-app UI at once, with the different UI instances connected to different instances of the http json api?
As far as I can see, create-daml-app relies on the http json api running on port 7575, so it looks like this can’t be done, but perhaps I missed something. If this actually can’t be done, would anyone mind me having a try at adding it?
- bernhard 3
The URLs and ports are configured in daml/config.ts at bda565fa4470d77a803fb4d9f0f6de41e4bf282a · digital-asset/daml · GitHub. This probably needs to be made a tad more flexible to allow the passing in of URLs and ports via environment variables. The app is intended to be cloned and modified so I’m not sure the functionality should be built in. I’d rather suggest you make the modification yourself. E.g. a simple measure would be to change line 34 from
? 'ws://localhost:7575/'to
? process.env.WS_BASE_URL || 'ws://localhost:7575/'Then you can run
WS_BASE_URL=wss://my.legher.io:1234/; yarn start - Phoebe_Nichols 1
It looks to me like the port is also configured from the
package.json, in this line:ui/package.json.template: "proxy": "http://localhost:7575", although I don’t know whether this is needed right now. If it is needed, then the change may not be as simple as a 1-liner. I don’t think you can read from environment variables in yourpackage.json.I am not keen to clone and modify the app, and would prefer to modify
create-daml-appitself. I am writing a “run create-daml-app on Canton” tutorial and I think it would be a bad experience if the users can’t just run the originalcreate-daml-app.Thoughts on whether this is a good-enough reason to add the functionality to
create-daml-app? Happy to do it myself ofc - georg 1
The webpack proxy configured in
package.jsononly supports a single URL afaik. If you instead specify different hosts/ports directly when creating yourDamlLedgercontext, you’ll likely run into CORS issues. So the only option I see is for you to run multiple instances of thecreate-daml-appproject. - bernhard 2
You could configure that via a .js configuration rather than through
package.json, I think. You just create awebpack.config.jsfile in your project root and configure according to https://webpack.js.org/configuration/dev-server/ - Phoebe_Nichols 4
I have now added this feature to
create-daml-app, here’s the PR if you’re interested.From the next release, it will be possible to specify the JSON API port expected by
create-daml-appvia the environment variableREACT_APP_HTTP_JSON_PORTwhen running in dev mode (ie a localyarn start). - vsh1982 1
Any suggestion how can start the ledger for multiple parties? @Phoebe_Nichols I need to understand is that possible to run create-daml-app for multiple parties on daml sandbox , if yes , then how?
- cocreature 1
@vsh1982 you don’t need to do anything special for starting Sandbox. Just starting it via
daml startordaml sandboxwill do the trick. And you only need one instance ofcreate-daml-appif you’re running with Sandbox. The getting started guide shows you how to set things up for two partiesAliceandBobbut you can use arbitrary other parties without changes.This thread is about distributed ledgers like Canton where different parties might be hosted on different participants. In that case you need one instance of create-daml-app per participant. But as long as you’re working with Sandbox there is no need to worry about any of that.
- vsh1982 1
@cocreature Thank you for your response . I am looking from distributed ledger perspective only . As per my understanding , every party have it’s node and the node have it’s Vault . I am not able to find the nodes and nodes information while using the application locally . Where I can find this ? My requirement is to use this application in DAML network and all parties can configured with different UI and server code .
- cocreature 1
If you run with Sandbox, there is only one node so you won’t find anything else. If you want a distributed setup, take a look at how to run
create-daml-appwith Canton for example DAML SDK and Canton — Canton 0.25.0 documentation - vsh1982 1
got it , Thanks alot !!