Set up the CLI

This guide will help you install and set up the Grey Matter CLI.

The Grey Matter Command Line Interface (CLI) is a configuration tool for the Grey Matter Control API. Leveraging the Control API, the CLI mainly performs dynamic configuration of the Fabric mesh.

circle-check

Prerequisites

To complete this tutorial, you’ll need an understanding of, and local access to the following environments and tools:

Step 1: Download and Install the greymatter CLI

The Grey Matter CLI is a binary written in Go. There are two ways to install it:

  1. Use gmenv, a manager for installing and setting different greymatter versions

  2. Download the binary manually from our published releasesarrow-up-right

We recommend using gmenv because it allows for easier versioning against different Grey Matter environments.

  1. Install gmenvarrow-up-right: a. On a Mac, using brew:

    b. Alteratively, you can follow these stepsarrow-up-right:

    a. Check out gmenv into any path (here is ${HOME}/.gmenv)

    b. Add ~/.gmenv/bin to your $PATH any way you like

  2. Once installed, list the versions of greymatter available

    Note: If you haven't used gmenv before, you will be prompted for your Grey Matter LDAP username and password.

  3. Install the latest version of greymatter using gmenv install <version>. This will download and install the latest version of the greymatter CLI:

  4. Tell gmenv to use the newly downloaded version of the Grey Matter CLI

  5. Verify the correct version of greymatter was installed

Option B: Install the greymatter binary manually

Web UI

Retrieve the latest release directlyarrow-up-right or visit Decipher's Nexus Repositoryarrow-up-right to browse all released versions of the CLI. When prompted, enter the username and password associated with your Grey Matter account.

circle-info

The greymatter CLI can be found in the raw-hosted section under the greymatter/gm-cli tree direct linkarrow-up-right. If you need binaries for a different platform, or for a different version, they can all be found on our Nexus repo.

Terminal

Any artifact in nexus can also be downloaded with a terminal. The below command demonstrates how to do this with curl. Before executing, replace -u user.name@organization.com with your username, and make sure the desired artifact is specified.

greymatter is distributed as a precompiled binary. The installation requires two steps:

  1. Unpacking the tarball

  2. Moving the greymatter binary onto your system's PATH

Untar the Binary

Once you've downloaded the Grey Matter binary, unzip it.

Move the Binary into Your $PATH

Next, move the binary for your operating system into your $PATH e.g.:

circle-check
triangle-exclamation

Step 2: Configure Your Environment for Grey Matter

In addition to downloading and installing the greymatter CLI, you'll need to set the necessary environment variables or command line flags so that you can talk to a deployed Grey Matter API. As each deployment is different, the specific endpoint and security context will be different, so make sure to verify your settings against the deployed environment.

The full configuration and usage of the CLI can be found in the support pages or by running greymatter --help, but some quick examples are shown here.

Configuration via Flags

Configuration options can be set by CLI flags with each use.

Configuration via Environment Variable

Configuration can also be set via the environment to avoid repeating verbose commands like the above. Any of the CLI flags will be parsed from the environment with underscore-delimited environment variables prefixed with "GREYMATTER_". For example, "--some.flag" becomes "GREYMATTER_SOME_FLAG". Command-line flags will still take precedence over environment variables.

NOTE: If you've used our Install on Kubernetes guide, then your GREYMATTER_API_PREFIX will be /services/control-api/latest like shown below.

Configuration via Configuration File

Configuration can also be set via a configuration file using JSON or YAML format. The CLI flag can be parsed from the configuration file with periods indicating the hierarchies of the variables. For example, "--some.flag x" becomes {"some":{"flag": "x"}}.

The configuration file can be specified using --config flag; if unspecified, Grey Matter CLI will search a user's home directory for a file with a name prefixed with .greymatter (e.g. ~/.greymatter.yaml, ~/.greymatter.yml, etc). The schema of the same configuration shown in the environment variable section above will look like:

or

Step 3: Test Installation

Run a quick test of the binary with the following command to verify a successful installation.

Step 4: Connect to the Grey Matter Control API

circle-exclamation

List Zone

Use greymatter list zone \ with the following keys and certs to connect to the Grey Matter Control API.

The returned Zone indicates that the connection was successful, and you've been able to inspect the Fabric Mesh.

Questions

circle-check

Last updated

Was this helpful?