Skip to content

Commit

Permalink
Add Restate CLI docs (#249)
Browse files Browse the repository at this point in the history
  • Loading branch information
gvdongen authored Jan 11, 2024
1 parent 6e10961 commit 6543daa
Show file tree
Hide file tree
Showing 4 changed files with 141 additions and 3 deletions.
138 changes: 138 additions & 0 deletions docs/restate/cli.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
---
sidebar_position: 4
description: "Use the CLI to interact with Restate."
---

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

# CLI

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

## Installation

Install the Restate CLI via:

<Tabs groupId="operating-systems">
<TabItem value="lin" label="npm">

```shell
npm install @restatedev/restate
```

</TabItem>
<TabItem value="mac" label="Homebrew">

```shell
brew install restatedev/tap/restate
```

</TabItem>
</Tabs>


## 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_META_URL`: To specify the full URL of meta service (scheme+host+port).
- `RESTATE_DATAFUSION_HTTP_URL`: To specify the full URL of datafusion HTTP endpoint.
- `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:

```shell
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 meta running at `http://myhost:7777`, save the following in a `.env` file:

```
RESTATE_META_URL=http://myhost:7777
```

## Usage

Here are a few useful commands:

**Check if the CLI is configured correctly**

```shell
restate whoami
```


**Printing help**

```shell
restate --help
```

**Downloading an example or template**

```shell
restate example
```

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

**Listing your services**

```shell
restate svc list
```

**Show the status of the service(s)**

```shell
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:

```shell
restate svc status <SERVICE_NAME>
```

**Listing ongoing invocations**

```shell
restate inv list
```

**Describing the status of an invocation**

```shell
restate inv describe <INVOCATION_ID>
```

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**

```shell
restate inv cancel <INVOCATION_ID>
```

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](/services/introspection) for a list of useful commands .
:::
2 changes: 1 addition & 1 deletion docs/restate/logging.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
sidebar_position: 4
sidebar_position: 5
description: "Find out how to configure logging for Restate."
---

Expand Down
2 changes: 1 addition & 1 deletion docs/restate/managed_service.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
sidebar_position: 6
sidebar_position: 7
description: "Try out Restate without any servers."
---

Expand Down
2 changes: 1 addition & 1 deletion docs/restate/tracing.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
sidebar_position: 4
sidebar_position: 6
description: "Find out how to export traces of your invocations."
---

Expand Down

0 comments on commit 6543daa

Please sign in to comment.