Demeter CLI

CLI

Demeter provides multiple ways to manage and interact with your projects. One of those is dmtrctl (or dmtr for short), a command-line utility that lets you interact with the Demeter platform from your local terminal.

⚠️

The CLI aims to provide full control of all Demeter resources and features, but we're not quite there yet. For the initial release we're focusing on a single feature: providing local access to the Cardano Node unix socket. We'll be working on filling the gaps but in the meantime, please use the Console (web UI) for any task not currently supported by the CLI.

Installation

You'll want to install the version that's appropriate for your operating system. If you're using Mac or Linux, the easiest way to get started is our automated install script that can be triggered using the following snippet:

curl -L https://demeter.run/install/dmtrctl.sh | sh

If everything worked correctly, you'll be able to run dmtr in your terminal.

⚠️

You might need to restart your terminal in order for the command to appear in PATH.

The official name for the CLI is dmtrctl but to avoid typing so many characters, the installation creates an alias called dmtr. Throughout the documentation will be using the alias as the default way of accessing the CLI.

You can also download the precompmiled binaries from ourg Github release (opens in a new tab) page.

Configuration

The CLI needs to know which project to use when executing a command. It also requires an API-Key as authentication method. We call this information the "context".

dmtrcl uses a configuration file located within the root dir of the installation to store the context information. The default location for Mac and Linux users is ~/.dmtr/config.toml but this can be changed by specifying a different root dir.

To know in which context to execute a command, dmtrctl uses decision steps in the following order:

  1. if the --context option was specified, use this value
  2. if DMTR_CONTEXT env variables was specified, use this value
  3. if there's a default context defined in the configuration, use that value

To configure a new context, run the init command and follow the steps provided by the CLI to store the required values in the local configuration. Required values can be retrieved from the Console (Web UI).

The location of the root dir can be changed by using the --root-dir option or the DMTR_ROOT_DIR env var.

Command Hierarchy

The CLI is organized by a hierarchy of sub-commands. Each commands might also contains nested sub-commands. Each command provides quick usage instructions by using the --help flag (such as dmtr <SUBCOMMAND> --help)

We can group commands in three basic categories:

  • project management: project setup, usage, payments, etc
  • resource management: resource provisioning, configuration, monitoring, etc
  • resource interaction: domain-specific actions depending on the nature of the resource

Demeter documentation site organized by use-case, in-depth description of commands in each category can be found in the page where it applies.