From 54f20d2f8bfc3522a0a2f8f084a9297fccf7311f Mon Sep 17 00:00:00 2001 From: Giselle van Dongen Date: Tue, 30 Jan 2024 18:46:16 +0100 Subject: [PATCH] Unify docker commands for MacOS and Linux for quickstart and tour of Restate --- docs/quickstart.mdx | 43 ++------------------------------------ docs/tour.mdx | 50 ++------------------------------------------- 2 files changed, 4 insertions(+), 89 deletions(-) diff --git a/docs/quickstart.mdx b/docs/quickstart.mdx index 07054453..246f2610 100644 --- a/docs/quickstart.mdx +++ b/docs/quickstart.mdx @@ -102,13 +102,10 @@ Once you have implemented your service, run it: ## Step 3: Launch the Restate runtime - - - Run the Restate Docker container: ```shell -docker run --name restate_dev --rm -d --network=host docker.io/restatedev/restate:VAR::RESTATE_VERSION +docker run --name restate_dev --rm -p 8080:8080 -p 9070:9070 -p 9071:9071 --add-host=host.docker.internal:host-gateway docker.io/restatedev/restate:VAR::RESTATE_VERSION ``` :::tip @@ -121,45 +118,12 @@ Now, we need to tell Restate where the service is running. We can do this via the CLI: -```shell -restate dp add 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 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. - - - - -Run the Restate Docker container: - -```shell -docker run --name restate_dev --rm -d -p 8080:8080 -p 9070-9071:9070-9071 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. Check out our [download page](https://restate.dev/get-restate/) for how to install the binary via Homebrew and npm. -::: - -Register the services: - -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 dp add http://host.docker.internal: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://host.docker.internal:9080`. +and providing it with the deployment endpoint of the service `http://localhost:9080`. ```shell curl localhost:9070/deployments -H 'content-type: application/json' -d '{"uri": "http://host.docker.internal:9080"}' ``` @@ -168,9 +132,6 @@ Restate then sends a request to the service deployment to ask which services and 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. - - - ## Step 4: Send requests to the service Invoke the function via: diff --git a/docs/tour.mdx b/docs/tour.mdx index 85259117..ea5e58cb 100644 --- a/docs/tour.mdx +++ b/docs/tour.mdx @@ -128,22 +128,10 @@ If you do not want to follow along by coding yourself, you can run the solution Next, let's launch Restate itself. Restate can be deployed as a simple standalone binary, all the way up to a fully managed service. In this tour we'll be running it standalone from a container image. - - - -```shell -docker run --name restate_dev --rm -d --network=host docker.io/restatedev/restate:VAR::RESTATE_VERSION -``` - - - - ```shell -docker run --name restate_dev --rm -d -p 8080:8080 -p 9070-9071:9070-9071 docker.io/restatedev/restate:VAR::RESTATE_VERSION +docker run --name restate_dev --rm -p 8080:8080 -p 9070:9070 -p 9071:9071 --add-host=host.docker.internal:host-gateway docker.io/restatedev/restate:VAR::RESTATE_VERSION ``` - - When you are finished with the tour, you can stop Restate with `docker stop restate_dev`. This also deletes any persisted state because we start the container with the `--rm` flag. You can restart Restate at a later time (without losing state) with `docker restart restate_dev`. You can view Restate logs using `docker logs restate_dev` or follow them live by adding `--follow`. @@ -151,26 +139,10 @@ When you are finished with the tour, you can stop Restate with `docker stop rest When Restate first comes up, it doesn't know anything about our services. Let's tell it where they are running. You can trigger service discovery by calling the Restate admin API informing it about the service deployment where our service is listening. - - - -```shell -curl localhost:9070/deployments -H 'content-type: application/json' -d '{"uri": "http://localhost:9080"}' -``` - - - - -You do this by sending a request to the Restate endpoint at `http://localhost:9070/deployments` -and providing it with the service deployment URL `http://host.docker.internal:9080`. - ```shell curl localhost:9070/deployments -H 'content-type: application/json' -d '{"uri": "http://host.docker.internal:9080"}' ``` - - - Restate will send a discovery request to the service deployment to find the services and methods run behind this endpoint. Restate keeps track of which services run where (including of the method signatures). Restate also keeps track of multiple revisions as your APIs evolve, and routes requests appropriately. :::tip @@ -2607,36 +2579,18 @@ docker run -d --name jaeger \ ``` Then restart the runtime with the tracing endpoint defined as an environment variable: - - ```shell docker stop restate_dev && \ -docker run --name restate_dev --rm -d -e RESTATE_OBSERVABILITY__TRACING__ENDPOINT=http://localhost:4317 --network=host docker.io/restatedev/restate:VAR::RESTATE_VERSION +docker run --name restate_dev --rm -e RESTATE_OBSERVABILITY__TRACING__ENDPOINT=http://localhost:4317 -p 8080:8080 -p 9070:9070 -p 9071:9071 --add-host=host.docker.internal:host-gateway docker.io/restatedev/restate:VAR::RESTATE_VERSION ``` Register the services again (required because the state got wiped when the runtime was restarted with the `--rm` flag): -```shell -curl localhost:9070/deployments -H 'content-type: application/json' -d '{"uri": "http://localhost:9080"}' -``` - - - -```shell -docker stop restate_dev && \ -docker run --name restate_dev --rm -d -e RESTATE_OBSERVABILITY__TRACING__ENDPOINT=http://host.docker.internal:4317 -p 8080:8080 -p 9070-9071:9070-9071 docker.io/restatedev/restate:VAR::RESTATE_VERSION -``` - -Register the services again (required because the state got wiped when the runtime was restarted with the `--rm` flag): ```shell curl localhost:9070/deployments -H 'content-type: application/json' -d '{"uri": "http://host.docker.internal:9080"}' ``` - - - - Go to the Jaeger UI at http://localhost:16686. Send requests to the runtime by adding tickets and checking out.