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:
- The Stable channel contains binaries produced for the Capact releases.
- The Latest channel contains binaries built from the latest commit on the Capact repository
mainbranch.
Stable - from the latest release#
Install Capact CLI binary with curl:
- MacOS
- Linux
- Windows
- Docker
- Other
curl -Lo capact https://github.com/capactio/capact/releases/download/v0.5.0/capact-darwin-amd64Copy to binary directory:
chmod +x capact && mv capact /usr/local/bin/capactcurl -Lo capact https://github.com/capactio/capact/releases/download/v0.5.0/capact-linux-amd64Copy to binary directory:
chmod +x capact && mv capact /usr/local/bin/capactcurl -Lo capact.exe https://github.com/capactio/capact/releases/download/v0.5.0/capact-windows-amd64.exe# Export credential store configuration:export CAPACT_CREDENTIALS_STORE_BACKEND=fileexport CAPACT_CREDENTIALS_STORE_FILE_PASSPHRASE=pass
# Export variables to log in to Gatewayexport GATEWAY_URL=https://gateway.{domain}export USERNAME={username}export PASSWORD={password}
docker run --rm \-e CAPACT_CREDENTIALS_STORE_BACKEND \-e CAPACT_CREDENTIALS_STORE_FILE_PASSPHRASE \-v $HOME/.config/capact:/.config/capact/ \ghcr.io/capactio/tools/capact-cli:v0.5.0 login $GATEWAY_URL -u $USERNAME -p $PASSWORDTo install a different release version, change the path to point to the desired version and architecture:
curl -Lo capact https://github.com/capactio/capact/releases/download/v0.5.0/capact-$OS-$ARCHRun 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:
- MacOS
- Linux
- Windows
- Docker
- Other
curl -Lo capact https://storage.googleapis.com/capactio-binaries/latest/capact-darwin-amd64Copy to binary directory:
chmod +x capact && mv capact /usr/local/bin/capactcurl -Lo capact https://storage.googleapis.com/capactio-binaries/latest/capact-linux-amd64Copy to binary directory:
chmod +x capact && mv capact /usr/local/bin/capactcurl -Lo capact https://storage.googleapis.com/capactio-binaries/latest/capact-windows-amd64.exe# Export credential store configuration:export CAPACT_CREDENTIALS_STORE_BACKEND=fileexport CAPACT_CREDENTIALS_STORE_FILE_PASSPHRASE=pass
# Export variables to log in to Gatewayexport GATEWAY_URL=https://gateway.{domain}export USERNAME={username}export PASSWORD={password}
docker run --rm \ -e CAPACT_CREDENTIALS_STORE_BACKEND \ -e CAPACT_CREDENTIALS_STORE_FILE_PASSPHRASE \ -v $HOME/.config/capact:/.config/capact/ \ ghcr.io/capactio/tools/capact-cli:latest login $GATEWAY_URL -u $USERNAME -p $PASSWORDcurl -Lo capact https://storage.googleapis.com/capactio-binaries/latest/capact-$OS-$ARCHRun 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 loginIf 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 SucceededNow you are ready to interact with the cluster via CLI. For example, fetch all available Interfaces:
capact hub interfaces getNOTE: The
capact action watchcommand 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-contextsExample output:
SERVER AUTH TYPE DEFAULT+------------------------------------------------+------------+---------+ https://gateway.capact.local Basic Auth YES https://gateway.capact.io Basic Auth NOTo change the default context, run:
# Selects which Hub server to use of via a promptcapact config set-contextIf you want to log out, run:
# Select what server to log out of via a promptcapact logoutAutocompletion#
To learn how to enable capact autocompletion, run:
capact completion -hNOTE: 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:
- macOS Keychain
- Windows Credential Manager
- Secret Service (Gnome Keyring, KWallet)
- KWallet
- Pass
- Encrypted file
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.