How to run `daml start` with several specific parameters
- cohen.avrahamOP
G-d willing
Hello,
when I am running theJSON-APII am using the following command:daml json-api --ledger-host localhost --ledger-port 6865 --http-port 7575 --max-inbound-message-size=9000000How can I ensure this will be set when I run
daml start?
I want to control these arguments indaml startin case I need to change them.Thanks
- WallaceKelly 2
You can place
json-api-optionsin yourdaml.yamlfile. See here.For example:
json-api-options: - --log-level=DEBUG - --max-inbound-message-size=9000000The “ledger host” for
daml startis localhost. I’m not sure that can be changed withdaml start.For the ports,
daml starthas these two command line options:--sandbox-port 6865--json-api-port 7575
- cohen.avraham
Hi @WallaceKelly,
Thank you for your reply. I added thejson-api-optionsto thedaml.yamlfile, and also added the arguments you mentioned to it. But when I randaml startI received the following error:Error: Unknown option --sandbox-port=6865 Error: Unknown option --json-api-port=7575And when I used:
json-api-options: - --ledger-port=6865 - --http-port=7575 - --max-inbound-message-size=9000000then I received:
Waiting for canton sandbox to start. Exception in thread "main" java.io.IOException: Failed to bind to address /127.0.0.1:6866Not sure where this 6866 is coming from
- WallaceKelly
@cohen.avraham, the
json-api-optionsof thedaml.yamlfile contains options which the Daml Assistant (daml start) will pass to the HTTP JSON API binary (http-json-binary). You can see what those options can be by placing--helpin that section like this:json-api-options: - --helpWhen you run
daml startwith--helpin thejson-api-optionsas above it will not complete, but show you the command line options for the Sandbox’s HTTP JSON API service. You will not seesandbox-portorjson-api-portin that list. Consequently, if you try to include those two options in thejson-api-optionssection of thedaml.yamlfile, you get “Error: Unknown option.”The two options
sandbox-portandjson-api-portare command line options fordaml start. The following will work:daml start --sandbox-port 6865 --json-api-port 7575See this related post, which explains that because the
daml assistanthas an--json-api-portoption, you cannot put--http-portin thejson-api-optionssection of thedaml.yamlfile.
- cohen.avraham
Hi @WallaceKelly ,
I tried what you suggested, but it is not working.I tried the following command:
daml start --sandbox-port 6865 --json-api-port 7575And the following error was received:
Frontend running at http://localhost:7500. .Waiting for JSON API to start: Error: Unknown option --ledger-port=6865 Error: Unknown option --http-port=7575 Try --help for more information.In addition, I tried running the command again, and I am getting a different error:
Waiting for canton sandbox to start. Exception in thread "main" java.io.IOException: Failed to bind to address /127.0.0.1:6868 at io.grpc.netty.NettyServer.start(NettyServer.java:333) at io.grpc.internal.ServerImpl.start(ServerImpl.java:185) at io.grpc.internal.ServerImpl.start(ServerImpl.java:94) at com.digitalasset.canton.environment.CantonNodeBootstrapCommon.<init>(CantonNodeBootstrapCommon.scala:197) at com.digitalasset.canton.environment.CantonNodeBootstrapBase.<init>(CantonNodeBootstrap.scala:64) at com.digitalasset.canton.domain.DomainNodeBootstrap.<init>(DomainNodeBootstrap.scala:113) at com.digitalasset.canton.domain.EnterpriseDomainFactory$.$anonfun$create$1(EnterpriseDomainFactory.scala:35) at scala.util.Either.map(Either.scala:382) at com.digitalasset.canton.domain.EnterpriseDomainFactory$.create(EnterpriseDomainFactory.scala:34) at com.digitalasset.canton.environment.Environment.createDomain(Environment.scala:552) at com.digitalasset.canton.environment.Environment.createDomain$(Environment.scala:547) at com.digitalasset.canton.environment.EnterpriseEnvironment.createDomain(EnterpriseEnvironment.scala:63) at com.digitalasset.canton.environment.Environment.$anonfun$domains$1(Environment.scala:271) at com.digitalasset.canton.environment.ManagedNodes.$anonfun$startNode$2(Nodes.scala:158) at cats.data.EitherT.$anonfun$bimap$1(EitherT.scala:423) at scala.concurrent.impl.Promise$Transformation.run(Promise.scala:467) at com.daml.executors.QueueAwareExecutorService$TrackingRunnable.run(QueueAwareExecutorService.scala:98) at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1423) at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:387) at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1312) at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1843) at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1808) at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:188) Caused by: java.net.BindException: Address already in use: bind at java.base/sun.nio.ch.Net.bind0(Native Method) at java.base/sun.nio.ch.Net.bind(Net.java:556) at java.base/sun.nio.ch.ServerSocketChannelImpl.netBind(ServerSocketChannelImpl.java:344) at java.base/sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:301) at io.netty.channel.socket.nio.NioServerSocketChannel.doBind(NioServerSocketChannel.java:141) at io.netty.channel.AbstractChannel$AbstractUnsafe.bind(AbstractChannel.java:562) at io.netty.channel.DefaultChannelPipeline$HeadContext.bind(DefaultChannelPipeline.java:1334) at io.netty.channel.AbstractChannelHandlerContext.invokeBind(AbstractChannelHandlerContext.java:600) at io.netty.channel.AbstractChannelHandlerContext.bind(AbstractChannelHandlerContext.java:579) at io.netty.channel.DefaultChannelPipeline.bind(DefaultChannelPipeline.java:973) at io.netty.channel.AbstractChannel.bind(AbstractChannel.java:260) at io.netty.bootstrap.AbstractBootstrap$2.run(AbstractBootstrap.java:380) at io.netty.util.concurrent.AbstractEventExecutor.runTask(AbstractEventExecutor.java:173) at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:166) at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:470) at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:569) at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997) at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) at java.base/java.lang.Thread.run(Thread.java:1623) Port file was not written to 'C:\Users\Acohen\AppData\Local\Temp\extra-dir-406583509887\sandbox-portfile' in time. - WallaceKelly
Error: Unknown option --ledger-port=6865 Error: Unknown option --http-port=7575My guess is that the above errors are coming from your
daml.yamlfile in thejson-api-optionssection. If so, you should remove those two options from there.Failed to bind to address /127.0.0.1:6868
I don’t know where the port
6868is coming from. Maybe search your directory for “6868”? - cohen.avraham
WallaceKelly:My guess is that the above errors are coming from your
daml.yamlfile in thejson-api-optionssection. If so, you should remove those two options from there.You are right, I forgot removing them from the
daml.yamlfile.
But, the second error about port 6868 is still there. I have no idea where it is coming from. And I don’t have any folder with such name. - a_putkov 1
@cohen.avraham Ports 6865 - 6869 are the default ports used by various Daml sandbox processes. I think the error you see is likely due to port 6868 being occupied (probably by a runaway process from your previous tests that didn’t terminate correctly) when you start Daml sandbox. I suggest you check if there’s any process running that occupies port 6868 and kill it. Rebooting the machine is obviously another option.