Trying to automate a few processes here in a bash script to
- run daml sandbox, and once the dars are uploaded
- run daml json api
- run the daml script to run the init script, which will populate parties
- run a few triggers.
Currently I have the below code (scroll down a bit). I’m using wait 10
, which does the job, but it’s a workaround, as the sandbox process is not guaranteed to take 10 seconds, and I need it to be running before I populate the parties.
Daml sandbox doesn’t output any completion status does it? apart from indicating Canton setup is complete
or something like that.
the start script below:
daml sandbox --dar main/Asset/asset.dar --dar main/User/user.dar --dar main/Account/account.dar &
sleep 10
daml json-api --config json-api-app.conf &
echo "launching ledger init script"
daml script --ledger-host localhost --ledger-port 6865 --dar main/account/account.dar --script-name Init:setup &
sleep 10
echo "ledger init script finished"
echo "starting Daml triggers"
daml trigger --dar triggers/triggers.dar \
--trigger-name SendAssetHoldingAccountInviteTrigger:sendAssetHoldingAccountInviteTrigger \
--ledger-host localhost \
--ledger-port 6865 \
--ledger-user "admin" &
daml trigger --dar triggers/triggers.dar \
--trigger-name AcceptAirdropRequestTrigger:acceptAirdropRequestTrigger \
--ledger-host localhost \
--ledger-port 6865 \
--ledger-user "admin" &
daml trigger --dar triggers/triggers.dar \
--trigger-name AcceptAssetInviteTrigger:acceptAssetInviteTrigger \
--ledger-host localhost \
--ledger-port 6865 \
--ledger-user "admin" &
daml trigger --dar triggers/triggers.dar \
--trigger-name AcceptSwapTrigger:acceptSwapTrigger \
--ledger-host localhost \
--ledger-port 6865 \
--ledger-user "admin" &
wait
Reason for wanting to add a bit of convenience is currently, to run the app locally we need to
- build dars
- codgen
- cd ui, npm i
- run daml sandbox
- run json-api server
- run daml script to populate parties
- run triggers (there are 4, so then its 4 separate terminal windows)
Ideally, we can just have one script that does everything.