Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use CLI in quickstart #250

Merged
merged 2 commits into from
Jan 11, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 38 additions & 17 deletions docs/quickstart.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
- TypeScript: Latest stable version of [NodeJS](https://nodejs.org/en/) >= v18.17.1 and [npm CLI](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm) >= 9.6.7
- Java: [JDK](https://whichjdk.com/) >= 17
- [Docker](https://docs.docker.com/engine/install/) to run Restate
- (Optional): Restate CLI: [Installation guide](/restate/cli#installation)

Check notice on line 18 in docs/quickstart.mdx

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/quickstart.mdx#L18

[Google.Parens] Use parentheses judiciously.
Raw output
{"message": "[Google.Parens] Use parentheses judiciously.", "location": {"path": "docs/quickstart.mdx", "range": {"start": {"line": 18, "column": 3}}}, "severity": "INFO"}

Check warning on line 18 in docs/quickstart.mdx

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/quickstart.mdx#L18

[Google.WordList] Use 'command-line tool' instead of 'CLI'.
Raw output
{"message": "[Google.WordList] Use 'command-line tool' instead of 'CLI'.", "location": {"path": "docs/quickstart.mdx", "range": {"start": {"line": 18, "column": 23}}}, "severity": "WARNING"}

## Step 1: Scaffold the project

Expand All @@ -39,8 +40,13 @@
</TabItem>
<TabItem value="jvm" label="Java" default>

Grab the Java Hello world example:
Grab the Java Hello world example via the Restate CLI:

Check warning on line 43 in docs/quickstart.mdx

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/quickstart.mdx#L43

[Google.WordList] Use 'command-line tool' instead of 'CLI'.
Raw output
{"message": "[Google.WordList] Use 'command-line tool' instead of 'CLI'.", "location": {"path": "docs/quickstart.mdx", "range": {"start": {"line": 43, "column": 51}}}, "severity": "WARNING"}

```shell
restate example java-hello-world-http && cd java-hello-world-http
```

Or via `wget`:
```shell
wget https://github.com/restatedev/examples/releases/latest/download/java-hello-world-http.zip && unzip java-hello-world-http.zip -d java-hello-world-http && rm java-hello-world-http.zip
```
Expand Down Expand Up @@ -104,54 +110,69 @@
docker run --name restate_dev --rm -d --network=host docker.io/restatedev/restate:VAR::RESTATE_VERSION
```

:::tip
Restate is a single self-contained binary and Docker just one of the ways to run it. You can also obtain the binary from the

Check notice on line 114 in docs/quickstart.mdx

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/quickstart.mdx#L114

[write-good.E-Prime] Try to avoid using 'is'.
Raw output
{"message": "[write-good.E-Prime] Try to avoid using 'is'.", "location": {"path": "docs/quickstart.mdx", "range": {"start": {"line": 114, "column": 9}}}, "severity": "INFO"}

Check warning on line 114 in docs/quickstart.mdx

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/quickstart.mdx#L114

[write-good.TooWordy] 'obtain' is too wordy.
Raw output
{"message": "[write-good.TooWordy] 'obtain' is too wordy.", "location": {"path": "docs/quickstart.mdx", "range": {"start": {"line": 114, "column": 99}}}, "severity": "WARNING"}
[releases page](https://github.com/restatedev/restate/releases), from our [Homebrew tap](https://github.com/restatedev/homebrew-tap)

Check warning on line 115 in docs/quickstart.mdx

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/quickstart.mdx#L115

[Google.We] Try to avoid using first-person plural like 'our'.
Raw output
{"message": "[Google.We] Try to avoid using first-person plural like 'our'.", "location": {"path": "docs/quickstart.mdx", "range": {"start": {"line": 115, "column": 71}}}, "severity": "WARNING"}
with `brew install restatedev/tap/restate`, or from [npm](https://www.npmjs.com/package/@restatedev/restate-server)
with `npm install @restatedev/restate-server`.
:::

Register the service:

Now, we need to tell Restate where the service is running.
We do this by sending a request to the endpoint of the runtime at `http://localhost:9070/deployments`

We can do this via the CLI:

Check warning on line 124 in docs/quickstart.mdx

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/quickstart.mdx#L124

[Google.We] Try to avoid using first-person plural like 'We'.
Raw output
{"message": "[Google.We] Try to avoid using first-person plural like 'We'.", "location": {"path": "docs/quickstart.mdx", "range": {"start": {"line": 124, "column": 1}}}, "severity": "WARNING"}

Check warning on line 124 in docs/quickstart.mdx

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/quickstart.mdx#L124

[Google.WordList] Use 'command-line tool' instead of 'CLI'.
Raw output
{"message": "[Google.WordList] Use 'command-line tool' instead of 'CLI'.", "location": {"path": "docs/quickstart.mdx", "range": {"start": {"line": 124, "column": 24}}}, "severity": "WARNING"}
Comment on lines 122 to +124
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested:
Now, we need to tell Restate where the service is running. To do this, we register a new "deployment" on restate server.

We can do this via the CLI:


```shell
restate dep register http://localhost:9080
```

Or via `curl`, by sending a request to the endpoint of the runtime at `http://localhost:9070/deployments`
and providing it with the deployment endpoint of the service `http://localhost:9080`.
```shell
curl -X POST http://localhost:9070/deployments -H 'content-type: application/json' -d '{"uri": "http://localhost:9080"}'
```

Restate then sends a request to the service deployment to ask which services and methods
are running behind this deployment and will keep track of these (including of the method signatures).
After executing this curl request, you should see the discovered services and methods printed to your terminal.

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

Run the Restate Docker container:

```shell
docker run --name restate_dev --rm -d -p 8080:8080 -p 9070:9070 -p 9071:9071 docker.io/restatedev/restate:VAR::RESTATE_VERSION
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can drop the docker.io part, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this didn't work for some setups. I am not sure anymore which one though. Let me check...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed re dropping it
we need 9072 here - see #254

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's required for podman apparently

```

:::tip
Restate is a single self-contained binary and Docker just one of the ways to run it. You can also obtain the binary from the
[releases page](https://github.com/restatedev/restate/releases), from our [Homebrew tap](https://github.com/restatedev/homebrew-tap)
with `brew install restatedev/tap/restate`, or from [npm](https://www.npmjs.com/package/@restatedev/restate-server)
with `npm install @restatedev/restate-server`.
:::

Register the services:

</TabItem>
<TabItem value="mac" label="macOS">
Now, you need to tell Restate where the service is running.

Check notice on line 158 in docs/quickstart.mdx

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/quickstart.mdx#L158

[write-good.E-Prime] Try to avoid using 'is'.
Raw output
{"message": "[write-good.E-Prime] Try to avoid using 'is'.", "location": {"path": "docs/quickstart.mdx", "range": {"start": {"line": 158, "column": 49}}}, "severity": "INFO"}

Run the Restate Docker container:
We can do this via the CLI:

Check warning on line 160 in docs/quickstart.mdx

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/quickstart.mdx#L160

[Google.We] Try to avoid using first-person plural like 'We'.
Raw output
{"message": "[Google.We] Try to avoid using first-person plural like 'We'.", "location": {"path": "docs/quickstart.mdx", "range": {"start": {"line": 160, "column": 1}}}, "severity": "WARNING"}

Check warning on line 160 in docs/quickstart.mdx

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/quickstart.mdx#L160

[Google.WordList] Use 'command-line tool' instead of 'CLI'.
Raw output
{"message": "[Google.WordList] Use 'command-line tool' instead of 'CLI'.", "location": {"path": "docs/quickstart.mdx", "range": {"start": {"line": 160, "column": 24}}}, "severity": "WARNING"}

```shell
docker run --name restate_dev --rm -d -p 8080:8080 -p 9070:9070 -p 9071:9071 docker.io/restatedev/restate:VAR::RESTATE_VERSION
restate dep register http://host.docker.internal:9080
```

Register the services:

Now, we need to tell Restate where the service is running.
We do this by sending a request to the endpoint of the runtime at `http://localhost:9070/deployments`
Or via `curl`, by sending a request to the endpoint of the runtime at `http://localhost:9070/deployments`
and providing it with the deployment endpoint of the service `http://host.docker.internal:9080`.
```shell
curl -X POST http://localhost:9070/deployments -H 'content-type: application/json' -d '{"uri": "http://host.docker.internal:9080"}'
```

Restate then sends a request to the service deployment to ask which services and methods
are running behind this deployment and will keep track of these (including of the method signatures).
After executing this curl request, you should see the discovered services and methods printed to your terminal.

:::tip
Restate is a single self-contained binary and Docker just one of the ways to run it. You can also obtain the binary from the
[releases page](https://github.com/restatedev/restate/releases), from our [Homebrew tap](https://github.com/restatedev/homebrew-tap)
with `brew install restatedev/tap/restate`, or from [npm](https://www.npmjs.com/package/@restatedev/restate-server)
with `npm install @restatedev/restate-server`.
:::

</TabItem>
</Tabs>

Expand Down
Loading