Command-line Arguments¶
Canton supports a variety of command line arguments. Please run bin/canton --help
to see all of them. Here,
we explain the most relevant ones.
Selecting a Configuration¶
Canton requires a configuration file to run. There is no default topology configuration built in and
therefore, the user needs to at least define what kind of node (domain or participant) and how many
they want to run in the given process. Sample configuration files can be found in our release package,
under the examples
directory.
When starting Canton, configuration files can be provided using
bin/canton --config conf_filename -c conf_filename2
which will start Canton by merging the content of conf_filename2
into conf_filename
.
Both options -c
and --config
are equivalent.
If several configuration files assign values to the same key, the last value is taken.
The section on static configuration explains how to write a configuration file.
Run Modes¶
Canton can run in three different modes, depending on the desired environment and task.
Interactive Console¶
The default and recommended method to run Canton is in the interactive mode. This is the mode Canton will start in by default. The process will start a command line interface (REPL) which allows to conveniently operate, modify and inspect the Canton application.
In this mode, all errors will be reported as CommandExcecutionException
to the console, but Canton will remain running.
The interactive console can be started together with a script, using the --boostrap-script=...
option. The script uses
the same syntax as the console.
This is the recommended way to run Canton (for now).
For server use on Linux / OSX, we recommend to run the application using the screen command:
screen -S canton -d -m ./bin/canton -c ...
will start the Canton process in a screen session named canton
which does not terminate on user-logout and therefore
allows to inspect the Canton process whenever necessary.
A previously started process can be joined using
screen -r canton
and an active screen session can be detached using CTRL-A + D (in sequence). Be careful and avoid typing CTRL-D, as it will terminate the session. The screen session will continue to run even if you log out of the machine.
Remote Console Mode¶
You can also run the console process separate from the participant or domain nodes. Some advanced console commands (e.g. for testing) that require in-process access to the node will not be available, but all commands that run over the administrative GRPC APIs will work.
Running the console on the remote node requires a separate, albeit limited configuration with the information on how to connect to the admin and ledger-api.
For a participant, you need something like
canton {
remote-participants {
remoteParticipant1 {
admin-api {
port = 10012
address = 127.0.0.1 // is the default value if omitted
}
ledger-api {
port = 10011
address = 127.0.0.1 // is the default value if omitted
}
}
}
}
whereas for a domain, a configuration would look like
canton {
remote-domains {
remoteDomain1 {
public-api {
address = 127.0.0.1
port = 10018
}
admin-api {
port = 10019
address = 127.0.0.1 // default value if omitted
}
}
}
}
Headless Script Mode¶
For testing and scripting purposes, Canton can also start in headless script mode:
bin/canton run <script-path> --config ...
In this case, commands are specified in a script rather than executed interactively. Any errors with the script or during command execution should cause the Canton process to exit with a non-zero exit code.
This mode is sometimes useful for testing, but we are not convinced yet that we’ll keep it in a stable version.
Daemon¶
If the console is undesired, Canton can be started in daemon mode
bin/canton daemon --config ...
All configured entities will be automatically started and will resume operation. Any failures encountered during start up will immediately shutdown the Canton process with a non-zero exit code. This mode is interesting if a third party administration tool is used with Canton.
Flush Log Files Immediately¶
By default, Canton will immediately flush log output to the log file so that nothing is lost in case of a crash.
To get the best possible throughput, you can switch this off by running Canton with --log-immediate-flush false
.
Java Virtual Machine Arguments¶
The bin/canton
application is a convenient wrapper to start a Java virtual machine running the Canton process.
The wrapper supports providing additional JVM options using the JAVA_OPTS
environment variable.
For example, you can configure the heap size as follows:
JAVA_OPTS="-Xmx2G" ./bin/canton --config ...