How to run start script when daml projects are separate

Question:
I have a daml app, where there are several daml projects linked together. Where would I place the start script, and how do I start the script? (root level?) I’m trying to allocate parties at the start in my local dev env, since pre-allocating parties is necessary now in sdk 2.x.

In the docs, daml start is required to used to compile Daml code to dar, generate JS library, starts sandbox, and starts server.

However, since I have separate daml projects, the way I start everything separately and not via daml start. I also build the dar files, and run daml codedgen separately.

  1. start sandbox with
    daml sandbox --ledgerid wallet-refapp-sandbox main/Asset/asset.dar main/User/user.dar main/Account/account.dar

Start server with
daml json-api --ledger-host localhost --ledger-port 6865 --http-port 7575

Question
At what point, and how do I run the start script ?

From the create-daml-app template, there is single daml project, the repo structure looks like

/daml
   Setup.daml (setup script) 
   User.daml
/ui
.dlint.yaml
daml.yaml (root level yaml file, where init-script: Setup:setup is)

And we just run daml start, and the script runs.

Hi @rikotacards,

First, a small clarification: daml start is a convenience, not a requirement.

Depending on how many separate Daml projects you are trying to coordinate here, your best bet may be a plain Bash script that runs the commands in the right order.

Running your script can be done with daml script. For the kind of setup you describe, you’ll probably want a separate script to allocate parties that runs before most other things (though obviously after starting the sandbox); since party IDs are hard to predict, I suggest looking into the approach @cocreature described here: initially run daml script with --output-file to create the parties, and then get those parties with --input-file for subsequent scripts / tests.

Does that help?

1 Like