Groundfloor Docs

gf CLI

Install the gf command-line tool, sign in, and deploy, manage and script Groundfloor from your terminal.

gf is Groundfloor's command-line tool. Use it to deploy Coderunners, publish Shell apps, and manage secrets, flags and files from your terminal or a CI pipeline.

Install and sign in

You need Node.js 20 or later.

npm install -g @groundfloorcloud/cli
gf login          # opens your browser
gf whoami

On a machine without a browser, add --device to sign in with a code instead. Without installing, run any command through npx @groundfloorcloud/cli.

Your email address must be verified. If commands fail with 403 "Verify your email address to continue", click the link in your verification email and run gf login again. See Verify your email.

Choose a workspace

gf workspaces                     # list your workspaces
gf workspaces use <workspace-id>  # the default for later commands

Most commands also accept -w <workspace-id> for a single run.

gf workspaces use saves the default for every terminal on your machine, so gf deploy never uses it silently. On a terminal, it shows the saved workspace and asks you to confirm. Without a terminal, such as in CI or when an AI agent runs it, gf deploy refuses until you pass -w <workspace-id> or set GROUNDFLOOR_WORKSPACE_ID.

Commands

CommandWhat it does
gf deployDeploy a Coderunner from the current folder or a Git repository. See Functions
gf coderunner ls, status, logs, runList Coderunners, check one, read its logs (--limit up to 1000 lines, --since-seconds up to 7 days), start a run
gf coderunner cancel-deploymentDelete a Coderunner's deployment. See Deleting a deployment
gf coderunner bind-environment -c <coderunner> -e <environment>Bind a Coderunner that has no environment to one, so its code gets its environment's ID. Permanent. See Binding an environment
gf coderunner invoke-access -c <coderunner> [off|token|public]Show or change who may call a Function's or Job's Deployment URL. Needs gf 0.2.9 or later. See Changing who can call a Function
gf domains add, ls, verify, rm --app <id or slug>Custom domains for a standalone app. Domains belong to apps, not to Coderunners
gf apps init, create, publish, lsShell and standalone apps. See Build your first Shell app
gf apps auth <app>, add-origin, remove-origin, add-callback, remove-callbackA standalone app's sign-in settings. Rolling out; see App sign-in settings
gf tenants lsYour apps' tenants: ID, alias, name, domains and whether each is disabled. Read-only; needs Multi-tenant on. --json for scripts. In gf 0.2.10 and later
gf secrets ls, get, set, rmSecrets. Pass - as the value to read it from input
gf flags ls, get, set, rm, compare, promoteFeature flags, with -e <environment>
gf files ls, upload, download, rmFiles
gf environments listYour workspace's environments
gf dataplane status, provisionCheck or set up the data API for a workspace
gf usageYour organization's plan usage and billing estimate, read-only. --since-days <n> sets how many days back the estimate looks (default 30, at most 400; it isn't a statement's billing month), --account <id> picks another organization, --json for scripts. See Quotas and limits
gf token, gf env, gf m2m tokenTokens for scripts. See below
gf apiCall any API path with your session

gf <command> --help lists every option.

When the API refuses a request with 429 (too many requests), gf says how long to wait. When a gf api response says an email wasn't sent, such as an app user invitation over the sending limit, gf api prints a note with the reason on stderr; the JSON on stdout is unchanged.

App sign-in settings

gf apps auth shows and changes a standalone app's sign-in settings. It's rolling out: it needs gf 0.2.3 or later, and the status shows not switched on yet until app sign-in is on for your cell.

gf apps auth shop                                  # client ID, issuer, JWKS URL, redirect URIs, origins, status
gf apps auth shop --json                           # the same, for scripts
gf apps auth add-origin shop http://localhost:5173 # up to 20 extra origins; localhost ones can also complete sign-in
gf apps auth remove-origin shop http://localhost:5173
gf apps auth add-callback shop /login/done         # up to 5 extra paths; /auth/callback is always allowed
gf apps auth remove-callback shop /login/done

<app> is the app's ID or slug. Viewing needs any workspace role; changing needs Writer, Admin or Owner. gf checks a value before sending it and explains what's wrong: origins are https://host[:port] with a domain name, or http://localhost[:port] and http://127.0.0.1[:port]; paths are absolute, with no wildcard, query or fragment. An http://localhost or http://127.0.0.1 origin also becomes a redirect URI (<origin>/auth/callback and each extra path), so a local dev server can complete sign-in; other origins never do. See Develop locally. An archived app's settings can't be changed. In a workspace with External sign-in there's nothing to change: the app has no sign-in client. On a Shell app, gf apps auth notes that its users sign in through the Shell site: the app gets its own short-lived token with getAppToken(), and its backend checks it with verifyAppToken. The Shell site token is still accepted until Groundfloor announces a date to retire it.

Project settings: groundfloor.json

Keep gf deploy settings in a groundfloor.json next to your code, so the command needs no flags. Flags you pass override the file.

groundfloor.json
{
  "name": "greeter",
  "runtime": "node",
  "workloadType": "function",
  "cpu": "250m",
  "memory": "256Mi",
  "env": { "REPORT_REGION": "eu" }
}

Groundfloor doesn't keep deploy-time variable values between deploys, so keeping env here means every gf deploy sends them. gf deploy warns about variables the previous deployment had that this one doesn't send; see Confirmations. Never put secrets in it.

Confirmations

Some commands ask before doing something you might not expect. On a terminal they show what they're about to change and wait for you; without a terminal, they stop unless you pass -y / --yes. The one exception is dropping environment variables, below: without a terminal, gf deploy warns and continues.

  • Updating an existing Coderunner. If gf deploy finds a Coderunner with the same name, it shows its name, ID and environment and asks before deploying to it.
  • Dropping environment variables. When gf deploy -c <coderunner> wouldn't send variables the previous deployment had, it lists their names (never their values) and asks "Deploy anyway and clear these variables?". The default is No, which stops before anything is uploaded. --yes skips the question. Without a terminal, such as in CI, it prints the names as a warning and deploys anyway, so send every variable on each deploy. See Deploy them every time.
  • Deleting a deployment. See below.
  • Binding an environment. See below.
  • Making a Function public or turning its address off. See Changing who can call a Function.

--yes doesn't replace choosing a workspace: without a terminal, gf deploy still needs -w or GROUNDFLOOR_WORKSPACE_ID.

Deleting a deployment

gf coderunner cancel-deployment -c <coderunner> (also delete-deployment) deletes the Coderunner's current deployment, or the one you name with --deployment-id. It doesn't stop a deploy in progress: if the deployment is the live one, the Coderunner goes offline until you deploy again. It asks you to confirm on a terminal and needs --yes without one.

If the Coderunner has a persistent disk, deleting the deployment may delete the data on it, so the command also needs --confirm-delete-disk-data (CLI 0.2.5 and later) and the permission to delete the Coderunner. Without the flag nothing is deleted: the command stops and asks you to get the confirmation of whoever owns that data before re-running it with the flag.

Binding an environment

gf coderunner bind-environment -c <coderunner> -e <environment> binds a Coderunner that has no environment, so its code gets its environment's ID (see Bind a Coderunner to an environment). -c takes the Coderunner's ID or slug and -e an environment ID or name, such as prod (see gf environments list); the environment must be active. --json prints the updated Coderunner. It needs gf 0.2.8 or later.

Binding is permanent: a bound Coderunner can't move to another environment, so the command shows the Coderunner and environment and asks you to confirm on a terminal, and needs --yes without one. If the Coderunner is already bound to that environment, nothing changes; if it's bound to another one, the command stops and says to create a Coderunner in the other environment or promote into it. Nothing changes for the running service until you deploy again with gf deploy. A connected Git repository stops deploying on push until a workspace member saves the Git source again. It needs the Writer, Admin or Owner role.

Changing who can call a Function

gf coderunner invoke-access -c <coderunner> [off|token|public] [-w <workspace-id>] [--yes] [--json] shows or changes who may call a Function's or Job's Deployment URL. It needs gf 0.2.9 or later:

  • With no value it only reads: it prints the current setting and the address.
  • token requires a workspace member's token or an M2M token. It applies without asking.
  • public lets anyone call it without a token, and off closes the address: every caller gets 404 until you switch it back (nothing is undeployed, and gf coderunner run still works). Both show the workspace (by name and ID), the Coderunner and the address and ask you to confirm. Without a terminal they need --yes, and the workspace named with -w or GROUNDFLOOR_WORKSPACE_ID; your saved default workspace isn't enough. Jobs can't be public.
  • --json prints access, invoke_url and workload_type.

It needs the Writer, Admin or Owner role; a machine client also needs Can deploy services. After a deploy, gf deploy prints an access: line for a Function or Job, with the command to change it.

Tokens for scripts

CommandGives youUse it for
gf tokenA short-lived token for your own sessionCalling the API from your terminal or a local script
eval "$(gf env)"GROUNDFLOOR_TOKEN, CONTROLPLANE_URL and GROUNDFLOOR_WORKSPACE_ID as environment variablesRunning your code locally against the workspace's real data
gf m2m tokenA token for an M2M client, from GROUNDFLOOR_M2M_CLIENT_ID and GROUNDFLOOR_M2M_CLIENT_SECRETCI pipelines and servers
eval "$(gf env)"
curl -H "Authorization: Bearer $(gf token)" \
  "$CONTROLPLANE_URL/v1/workspaces/$GROUNDFLOOR_WORKSPACE_ID/vault/collections"

CI pipelines

In CI there's no browser sign-in. Set GROUNDFLOOR_TOKEN to a token and gf uses it instead of a saved session. Set GROUNDFLOOR_WORKSPACE_ID too: without a terminal, gf deploy won't use a saved default workspace.

export GROUNDFLOOR_TOKEN="$(gf m2m token)"   # needs GROUNDFLOOR_M2M_CLIENT_ID and GROUNDFLOOR_M2M_CLIENT_SECRET
export GROUNDFLOOR_WORKSPACE_ID=<workspace-id>
gf coderunner ls

Commands that would ask for confirmation on a terminal need --yes in CI; see Confirmations.

gf deploy waits for the deployment it started. If that deployment fails, is deleted, or isn't ready within 5 minutes, gf deploy exits with a non-zero status and prints the reason, so the pipeline step fails. The previous version keeps serving.

The Developers page in the Client Portal, under Administer, also gives you a short-lived token and a ready-made example request, if you'd rather not use the CLI.

Next steps

On this page