Harthelm Docs

hart

The hart command line: global flags, settings, every command and the exit codes.

Generated from cmd/hart at v1.5.0

hart manages Harthelm workspaces, landscapes, domains and more through the API.

Settings come from flags, then HART_API, HART_TOKEN, HART_TEAM and HART_WORKSPACE, then the current context in ~/.config/hart/config.yaml.

hart [command]

hart is Harthelm's command line. It does what the console does, through the same REST API, so you can script it and use it in CI. Every workspace has it installed and set up; on your own machine, install it first.

Sign in

Terminal
hart login --api https://console.example.com
hart whoami

hart login opens the console in your browser, where you approve the sign-in; --code shows a code to approve on any device instead (the default over SSH and in workspaces). It stores an API key in a context: the installation, the key and your default team and workspace. hart ctx switches between contexts.

Where settings come from

Each setting is taken from the first of:

  1. the flag (--api, --team, --workspace, --context),
  2. the environment variable (HART_API, HART_TOKEN, HART_TEAM, HART_WORKSPACE, HART_CONTEXT),
  3. the current context in ~/.config/hart/config.yaml.

In CI, set HART_API, HART_TOKEN and HART_TEAM and skip hart login; see Use hart in CI. Teams are named by their id; workspaces by their id or their name.

Output

Lists print as tables. -o json and -o yaml print the API's objects for scripts:

Terminal
hart ws list -o json

When a command fails, hart prints the error and exits with an exit code that says what kind of error it was.

Commands

Signing in

CommandWhat it does
hart ctxList, switch and remove contexts (installations and their default team and workspace)
hart loginSign in and save an API key in a context
hart logoutDelete the context's API key and remove it from the contexts file
hart whoamiShow who the API key belongs to, and the context

Workspaces

CommandWhat it does
hart execRun a command in the workspace
hart gitGit in the workspace: pull, status
hart keep-awakeKeep the workspace from sleeping for a while
hart wsList, create, open, wake and delete workspaces

Landscape and stages

CommandWhat it does
hart logsShow the logs of stages and services
hart prepareRun the prepare stage in the workspace
hart runStart the run stage: every service starts its steps
hart scaleSet the replicas of services without a Sync
hart stopStop the run stage, one service, or a running prepare or test
hart syncSync the landscape with harthelm.yml: review the plan, then apply it
hart testRun the test stage in the workspace

Env vars, secrets and managed services

CommandWhat it does
hart envWorkspace environment variables: list, set, unset
hart msManaged services (databases and more): list, create, rotate, delete
hart secretVault secrets of the workspace: keys, set, generate, delete

Custom domains

CommandWhat it does
hart domainCustom domains of the team: add, verify, route

Tools

CommandWhat it does
hart completionGenerate the autocompletion script for the specified shell
hart curlMake a request to a workspace's dev domain with your API key
hart smokeCheck an installation end to end with a scratch workspace
hart validateCheck a harthelm.yml without a workspace
hart versionShow hart's version and the server's

Administration

CommandWhat it does
hart adminCluster administration: doctor, users, audit, licence

Global flags

Every command takes these flags.

FlagDescription
--api stringthe console's URL, e.g. https://console.example.org (HART_API)
--config stringthe contexts file (default ~/.config/hart/config.yaml; HART_CONFIG)
--context stringthe context to use (default: current-context; HART_CONTEXT)
--contexts stringthe contexts file, as --config; also where a command's own --config hides it (ms create)
-o, --output stringoutput format: table, json or yaml (default "table")
-t, --team intteam id (HART_TEAM)
-w, --workspace intworkspace id (HART_WORKSPACE)

Exit codes

hart exits with one of these codes, so scripts can branch without parsing messages.

CodeMeaning
0Success.
1Anything else (network, server errors, a local failure).
2Unknown command or flag, wrong arguments, a missing setting (no API, no team, no workspace).
3No or an invalid key (401); run hart login.
4The key's user may not do this (403).
5The object does not exist or is not visible (404).
6The API refused the change in the current state (409, 412, 428).

On this page