Skip to main content

CLI

You can use the CLI to interact with Restate, and manage your services, deployments and invocations.

Installation​

Install the Restate CLI via:

npm install --global @restatedev/restate

Configuration​

There are two ways to configure the CLI: via environment variables or via a configuration file.

Using environment variables​

You can specify the following environment variables:

  • RESTATE_HOST: The hostname/IP address of the server. Default is localhost.
  • RESTATE_HOST_SCHEME: Default is http.
  • RESTATE_ADMIN_URL: To specify the full URL of the admin server (scheme+host+port).
  • RESTATE_AUTH_TOKEN: Set if authentication is required.

For example, to specify the hostname myhost and the host scheme https, pass environment variables as follows:

RESTATE_HOST=myhost RESTATE_HOST_SCHEME=https restate <command>

Using a configuration file​

You can also specify the configuration in a .env file. The CLI will look for a .env file in its current directory.

For example, to connect to a Restate admin server running at http://myhost:9070, save the following in a .env file:

RESTATE_ADMIN_URL=http://myhost:9070

Usage​

Here are a few useful commands:

Check if the CLI is configured correctly

restate whoami

Printing help

restate --help

Downloading an example or template

restate example

Follow the prompts to select which template you want to download.

Listing your services

restate services list

Or use the shorthand:

restate svc ls

Show the status of the service(s)

restate svc status

Shows a summary of the services and their methods. It shows counters for the invocations in the various states (pending, running, suspended, etc.) It also lists a sample of active service keys.

To print the status of a specific service:

restate svc status <SERVICE_NAME>

Listing ongoing invocations

restate invocations list -w

Or use the shorthand:

restate inv list -w

This starts a watch-mode listing of ongoing invocations. Many of the CLI commands support -w, check --help to learn more.

Describing the status of an invocation

restate inv describe <INVOCATION_ID>

You can also use get as a shorthand for describe.

Use this command to understand the progress of the invocation: the status, any errors and retries that occurred, the current journal, etc.

Cancel an ongoing invocation

restate inv cancel <INVOCATION_ID>

You can also use rm as a shorthand for cancel.

Use this command to cancel an invocation and its children. Use the --kill flag to ungracefully kill the invocation and its children.

tip

The CLI can be a useful tool for debugging and troubleshooting. Have a look at the introspection page for a list of useful commands .