Can I specify several dars to be uploaded when using the `daml start` command?

I know I can pass several dars to the daml sandbox command to be uploaded to Sandbox.

In addition to uploading several dars, I also would like to run a script after Sandbox is ready, which is possible using the --on-start option of the daml start command.

I would like to combine these two features.

There is no builtin feature for this. You have a few options:

  1. Don’t use daml start. You can use daml sandbox --port-file portfile and then wait for portfile to be created as an indication that sandbox is up. Even in something like a bash script waiting for a file to be created is reasonably simple.
  2. A DAR includes its dependencies. So if your project depends on other DARs, those should get uploaded as well. Note that you actually need to use them though (as in have a reference to them). Just putting them in data-dependencies isn’t going to include them.
  3. You could put daml ledger upload-dar commands in your on-start script.
1 Like

Thank you!

For some practical examples, in my file, I have something like :

  daml sandbox --dar main/Asset/asset.dar --dar main/User/user.dar --dar main/Account/account.dar --port-file ${cantonPortFile}

The below waits for the sandbox file to be created, then you can run another command after, for example, I’ll allocate parties.

  while [ ! -f "$cantonPortFile" ];
      echo "Setting up sandbox..."
      if [ "$timeout" == 0 ]; then
        echo "ERROR: Timeout while waiting for the file ${cantonPortFile}"
        exit 1
      sleep 2 # or less like 0.2
      sleep 1
  echo "Canton sandBox setup complete"

The json api server can also create a port-file, which outputs the file once the server is setup, which you can then run triggers.

    server {
      address = "localhost"
      port = 7575
    ledger-api {
      address = "localhost"
      port = 6865
1 Like