Skip to content
Docs

Contexts & Environments

Hyve has two similar-sounding ideas that do different jobs:

ContextEnvironment
What it isThis machine’s pointer at where state livesA named scope inside your organization on a hyve-api server
LivesLocally, in ~/.hyve/hyve.dbOn the server, shared by everyone in the organization
Points atA local directory, a hyve-api URL, or bothA set of clusters (default, staging, production, …)
Commandhyve contexthyve environment
ModesLocal and cluster modeCluster mode only

Contexts

A context is a thin record — a name, a local path, and optionally a hyve-api URL. Hyve has no built-in git functionality: it never clones, pulls, pushes, or commits anything. A context only tracks where your commands read from and write to.

Terminal window
hyve context create prod --path ~/repos/prod-config
hyve context use prod # subsequent commands read/write here
hyve context current
hyve context list

Local mode: a plain directory, git optional

A local-directory context holds clusters/, templates/, workflows/, resources/, hyve.yaml, and hyve.lock — plain files hyve reconcile reads and writes directly.

Cluster mode: a hyve-api server

Terminal window
hyve context login --api-url https://hyve.example.com # registers the context too, if it's new

The active context decides the mode: a context with an API URL sends cluster commands to that server; one without works on local files. Switching contexts never logs you out, and logging in never switches which context is active (except that your very first login on a machine activates the context it registers).

Environments

Once you’re in cluster mode, an environment scopes the clusters you work with. Every organization starts with default; create more as you need them. Clusters are created in one environment, and two environments can each hold a cluster with the same name.

Terminal window
hyve environment create staging
hyve environment use staging # remembered on the active context
hyve cluster list # only staging's clusters
hyve cluster show web --env default # one-off override