Skip to content
foxdeployDocsSign up

The CLI

foxdeploy starts, runs, pauses and destroys computers from a terminal or a script. One binary for macOS and Linux.

View as Markdown

Install

Shell
npm install --global @foxdeploy/cli

The npm package downloads the binary for your computer (macOS or Linux, Intel or Arm) at install, and refuses it unless its SHA-256 sum matches the list inside the package. Behind a proxy it uses HTTPS_PROXY or HTTP_PROXY. If the download fails at install, the first run fetches and checks it instead.

fox is a short alias for the same command, so fox ls is foxdeploy ls. The examples below use the full name.

Sign in

Shell
foxdeploy login

This opens https://app.foxdeploy.ai/cli with a code, and prints the address and the code in the terminal too. Check that the code in the browser matches, then approve. The CLI receives a new key named after your computer, with full access, and keeps it in credentials.json in its config folder, readable by you only. The code lasts 10 minutes.

Other ways in:

WayWhen
foxdeploy login --no-browserprints the address only, for a computer without a browser
foxdeploy login --key -reads a key from standard input, for example from a secret manager
FOXDEPLOY_API_KEY in the environmentCI jobs and scripts; it wins over a saved sign in

foxdeploy login --key with the key itself on the command line is refused: it would stay in the shell history and the process list. foxdeploy logout forgets the saved key on this computer. The key itself stays valid until you revoke it on the API keys page.

Commands

CommandWhat it does
foxdeploy createstarts a computer: --size, --region, --image, --name, --env K=V, --snapshot
foxdeploy lslists your computers
foxdeploy get [ID]shows one computer
foxdeploy exec [ID] -- CMD [ARGS]runs a command; the CLI exits with the command's exit code
foxdeploy pause [ID]pauses to a snapshot; billing drops to storage only
foxdeploy resume [ID]resumes; --snapshot ID resumes a named snapshot
foxdeploy snapshot [ID]takes a named snapshot while it runs (--name)
foxdeploy snapshots [ID]lists a computer's snapshots
foxdeploy stop [ID]stops the computer and keeps its disk
foxdeploy start [ID]starts a stopped computer from its disk
foxdeploy preview [ID] PORTopens a private preview link to a port
foxdeploy destroy IDdestroys the computer and its snapshots; the id is required
foxdeploy versionprints the version

ID may be left out after create, except for destroy: the last computer created is used. --json prints the API's answer as JSON on every read.

An example run

Shell
foxdeploy create --size small --region sgp --name docs-example
foxdeploy exec -- echo hello from the computer
foxdeploy exec -- ls /root
foxdeploy snapshot --name after-setup
foxdeploy snapshots
foxdeploy pause
foxdeploy resume
foxdeploy ls

foxdeploy destroy always needs the id, so a slip of the keyboard cannot destroy the wrong computer: foxdeploy destroy cm_8f2k7q.

In a script

Shell
id=$(foxdeploy create --size small --region sgp --json | python3 -c 'import json,sys; print(json.load(sys.stdin)["id"])')
foxdeploy exec "$id" -- uname -a
foxdeploy pause "$id"
foxdeploy destroy "$id"

A call answered 429, or 503 when nothing was started, is tried again up to 3 times. Reads and creates are also tried again after other server errors; a command is never run twice by a retry. A call times out after 60 seconds; exec adds the command's own timeout.

Not in the CLI yet

The spec also names foxdeploy ssh, cp, logs, usage and keys. They are not built. Until they are, use the dashboard's terminal, files and logs tabs, or the SDKs.