CLI
The CLI is the product. Declare a slice in a Driftfile, see what applying it would change and cost, apply it, read its logs and roll it back without leaving the terminal. There is no web console to open and nothing to configure in a browser. Most commands are drift <noun> <verb>, and the nouns are the platform's own: a slice, a function, your data. The three that act on a whole Driftfile, drift plan, drift apply and drift size, are verbs on their own.
Where to go
One binary
Three commands are the binary talking about itself rather than about your account. They need no login and, apart from upgrade, no network.
| Command | Description |
|---|---|
drift | With no arguments in a terminal, opens a full-screen interactive dashboard (a btop/k9s-style TUI) over your slices, functions, and Backbone data; see The dashboard. In a pipe or CI (no TTY) it prints --help instead. There is no other command that opens it. |
drift --version | Three lines, offline: this binary's version, the Driftfile format it was built to implement (driftfile format implemented), and the format this machine has cached from the platform (driftfile format on this machine). They move independently, so a Driftfile the platform accepts and this CLI rejects is visible here. The format number belongs to the platform's schema; it is not written in your Driftfile. |
drift upgrade [version] | Update the CLI. It detects how this copy was installed: a go install binary is reinstalled in place, and a Homebrew one is never touched by it, so the command checks the version and prints brew update && brew upgrade drift for you to run. Pass a version to pin or roll back, for example drift upgrade v1.8.1. |
Installing it for the first time is the first step of Getting started.
The CLI says when it is older than the platform. The platform states the version of its API in an X-Drift-API-Version header, and only the major number counts. When an authenticated request is answered with a higher major than the one this binary was built for, the CLI says so on stderr, once per command, whatever the reply was. The first number is the CLI's and the second is the platform's:
This drift is older than the platform: it speaks API version 1 and the platform speaks 2. Run `drift upgrade`.A 404 that names no thing (an empty body, not found or 404 page not found) from such a platform is reported as a version difference and not as a missing resource, because a path this binary knows may no longer be served. The error carries the same sentence and a code of its own:
Couldn't delete function: the platform may no longer answer that request. This drift is older than the platform: it speaks API version 1 and the platform speaks 2. Run `drift upgrade`.
DRIFT-1015 · drift doctor explain DRIFT-1015A 404 that names what is missing, such as slice not found: demo, stays a missing resource. So does one that survives drift upgrade: the error says may because a slice's own bare not found, passed on by the platform, reads the same. Nothing is blocked or retried. The request is sent and answered as it would have been, and the only thing that changes is the wording of that one 404. The same major, a lower one, a reply that states no version and one that states something that is not a number all print nothing, so a newer CLI against an older platform is silent. CLI 0.91.0 is the first release that makes the comparison.
The whole project
Three commands read the Driftfile in the current directory and work on the one slice it declares. Each is documented on the drift file page, beside the commands that lint, format, explain and run the file.
| Command | Description | |
|---|---|---|
drift plan [environment] | Compare the Driftfile with the live slice and print every difference: what is added, changed and removed, the monthly price before and after, whether the slice restarts, and what data a removal could lose. Changes nothing. See drift plan. | |
| `drift apply [environment \ | plan.json]` | Make the slice what the Driftfile says: create it or resize it, then deploy what runs on it. Asks before the price moves, before anything is removed and before data could be lost. See drift apply. |
drift size | Write what each Function and Worker has measured into the Driftfile's memory lines. See drift size. |
Nothing here needs a browser.
drift plan in your terminal; a slice made without a file is drawn in a form in the terminal, the same as everything else here: signup, deploys, secrets, snapshots, rollbacks. Every one of them is a command.