Skip to main content
Version: Unreleased ๐Ÿšง

Getting Started

In addition to a Capact GraphQL API, Capact features a command-line interface that wraps common functionality and formats output. The Capact CLI is a single static binary. It is a wrapper around the Capact GraphQL API and Kubernetes API.

Install#

Capact has two types of release channels: Stable and Latest:

Stable - from the latest release#

Install Capact CLI binary with curl:

curl -Lo capact https://github.com/capactio/capact/releases/download/v0.5.0/capact-darwin-amd64

Copy to binary directory:

chmod +x capact && mv capact /usr/local/bin/capact

Run capact -h or capact <command> -h to see the help output which corresponds to a given command.

Latest - from the latest main commit#

Install Capact CLI binary with curl:

curl -Lo capact https://storage.googleapis.com/capactio-binaries/latest/capact-darwin-amd64

Copy to binary directory:

chmod +x capact && mv capact /usr/local/bin/capact

Run capact -h or capact <command> -h to see the help output which corresponds to a given command.

First use#

NOTE: This section requires acess to an existing Capact installation. To learn how to install Capact, see the Installation guides.

To begin working with Capact using the capact CLI, start with log in interactively into a given cluster:

# start interactive setupcapact login

If you do not know the authorization details, you can obtain them from the cluster where Capact was installed:

export CAPACT_GATEWAY_HOST=$(kubectl -n capact-system get ingress capact-gateway -ojsonpath='{.spec.rules[0].host}')export CAPACT_GATEWAY_USERNAME=$(kubectl -n capact-system get secret capact-gateway -ogo-template='{{.data.username | base64decode }}')export CAPACT_GATEWAY_PASSWORD=$(kubectl -n capact-system get secret capact-gateway -ogo-template='{{.data.password | base64decode}}')
# provide all information from command linecapact login "$CAPACT_GATEWAY_HOST" -u "$CAPACT_GATEWAY_USERNAME" -p "$CAPACT_GATEWAY_PASSWORD"

If URL and credentials are valid, the output is:

Login Succeeded

Now you are ready to interact with the cluster via CLI. For example, fetch all available Interfaces:

capact hub interfaces get

NOTE: The capact action watch command calls the Kubernetes API directly. If you want to use this command, kubeconfig has to be configured with the same cluster as the one which the Gateway points to.

Log into multiple servers#

NOTE: We do not support setting kubeconfig per server. You need to manage it manually by changing the kubeconfig context, for example via kubectl.

You can log into multiple clusters. To check in which cluster you already logged in, run:

capact config get-contexts

Example output:

                      SERVER                       AUTH TYPE    DEFAULT+------------------------------------------------+------------+---------+  https://gateway.capact.local                     Basic Auth   YES  https://gateway.capact.io                        Basic Auth   NO

To change the default context, run:

# Selects which Hub server to use of via a promptcapact config set-context

If you want to log out, run:

# Select what server to log out of via a promptcapact logout

Autocompletion#

To learn how to enable capact autocompletion, run:

capact completion -h

NOTE: Be sure to restart your shell after installing autocompletion.

When you start typing a capact command, press the <tab> character to show a list of available completions. Type -<tab> to show available flag completions.

Credential store options#

The capact login uses keyring library to store credentials securely. The supported store backends are:

Use the CAPACT_CREDENTIALS_STORE_BACKEND environment variable to change the default backend.

Next steps#

โœจ After setting up Capact CLI, you are ready to start a journey with the Capact project. Check out our Mattermost installation example to learn how to use Capact CLI to provision an example application.