Quickstart
This guide takes you through your first steps with Restate.
- TypeScript
- Java
- Kotlin
- Go
- Python
- Rust
Install Restate Server & CLI
Restate is a single self-contained binary. No external dependencies needed.
- Homebrew
- Download binaries
- npm
- Docker
Install Restate Server and CLI via:
brew install restatedev/tap/restate-server &&brew install restatedev/tap/restate
Then run the Restate Server with:
restate-server
Install the Restate Server and CLI by downloading the binaries with curl
from the releases page, and make them executable:
- Linux-x64
- Linux-arm64
- MacOS-x64
- MacOS-arm64
BIN=$HOME/.local/bin && RESTATE_PLATFORM=x86_64-unknown-linux-musl && \curl -LO https://github.com/restatedev/restate/releases/latest/download/restate.$RESTATE_PLATFORM.tar.gz && \tar -xvf restate.$RESTATE_PLATFORM.tar.gz && \chmod +x restate restate-server && \# Move the binaries to a directory in your PATH, for example ~/.local/bin:mv restate $BIN && \mv restate-server $BIN
BIN=$HOME/.local/bin && RESTATE_PLATFORM=aarch64-unknown-linux-musl && \curl -LO https://github.com/restatedev/restate/releases/latest/download/restate.$RESTATE_PLATFORM.tar.gz && \tar -xvf restate.$RESTATE_PLATFORM.tar.gz && \chmod +x restate restate-server && \# Move the binaries to a directory in your PATH, for example ~/.local/bin:mv restate $BIN && \mv restate-server $BIN
BIN=/usr/local/bin && RESTATE_PLATFORM=x86_64-apple-darwin && \curl -LO https://github.com/restatedev/restate/releases/latest/download/restate.$RESTATE_PLATFORM.tar.gz && \tar -xvf restate.$RESTATE_PLATFORM.tar.gz && \chmod +x restate restate-server && \# Move the binaries to a directory in your PATH, for example /usr/local/bin (needs sudo):sudo mv restate $BIN && \sudo mv restate-server $BIN
BIN=/usr/local/bin && RESTATE_PLATFORM=aarch64-apple-darwin && \curl -LO https://github.com/restatedev/restate/releases/latest/download/restate.$RESTATE_PLATFORM.tar.gz && \tar -xvf restate.$RESTATE_PLATFORM.tar.gz && \chmod +x restate restate-server && \# Move the binaries to a directory in your PATH, for example /usr/local/bin (needs sudo):sudo mv restate $BIN && \sudo mv restate-server $BIN
Then run the Restate Server with:
restate-server
Install Restate Server and CLI via:
npm install --global @restatedev/restate-server@latest &&npm install --global @restatedev/restate@latest
Then run the Restate Server with:
restate-server
To run the Restate Server:
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:1.1
To run commands with the Restate CLI, use the following command:
docker run -it --network=host docker.io/restatedev/restate-cli:1.1 invocations ls
Replace invocations ls
by the CLI command you want to run.
Get the Greeter service template
Select your favorite runtime:
- CLI
- npx
restate example typescript-hello-world &&cd typescript-hello-world &&npm install
npx -y @restatedev/create-app@latest && cd restate-node-template &&npm install
restate example typescript-bun-hello-world &&cd typescript-bun-hello-world &&npm install
restate example typescript-deno-hello-world &&cd typescript-deno-hello-world &&npm install
restate example typescript-cloudflare-worker-hello-world &&cd typescript-cloudflare-worker-hello-world &&npm install
Run the Greeter service
Now, start developing your service in src/app.ts
. Run it with ts-node-dev
, and let it listen on port 9080
for requests:
npm run app-dev
Register the service
Tell Restate where the service is running, so Restate can discover and register the services and handlers behind this endpoint:
- CLI
- curl
restate deployments register http://localhost:9080
curl localhost:9070/deployments -H 'content-type: application/json' \-d '{"uri": "http://localhost:9080"}'
Output
โฏ SERVICES THAT WILL BE ADDED:- GreeterType: ServiceHANDLER INPUT OUTPUTgreet value of content-type 'application/json' value of content-type 'application/json'โ Are you sure you want to apply those changes? ยท yesโ DEPLOYMENT:SERVICE REVGreeter 1
If you run Restate with Docker, use http://host.docker.internal:9080
instead of http://localhost:9080
.
Send a request to the Greeter service
curl localhost:8080/Greeter/greet -H 'content-type: application/json' -d '"Hi"'
You should now see printed as response: Hi!
Congratulations, you managed to run your first Restate service!
Next: Build and run the app
Once you have implemented your service, build the app and run it with:
npm run buildnpm run app
- Java: JDK >= 11
Install Restate Server & CLI
Restate is a single self-contained binary. No external dependencies needed.
- Homebrew
- Download binaries
- Docker
Install Restate Server and CLI via:
brew install restatedev/tap/restate-server &&brew install restatedev/tap/restate
Then run the Restate Server with:
restate-server
Install the Restate Server and CLI by downloading the binaries with curl
from the releases page, and make them executable:
- Linux-x64
- Linux-arm64
- MacOS-x64
- MacOS-arm64
BIN=$HOME/.local/bin && RESTATE_PLATFORM=x86_64-unknown-linux-musl && \curl -LO https://github.com/restatedev/restate/releases/latest/download/restate.$RESTATE_PLATFORM.tar.gz && \tar -xvf restate.$RESTATE_PLATFORM.tar.gz && \chmod +x restate restate-server && \# Move the binaries to a directory in your PATH, for example ~/.local/bin:mv restate $BIN && \mv restate-server $BIN
BIN=$HOME/.local/bin && RESTATE_PLATFORM=aarch64-unknown-linux-musl && \curl -LO https://github.com/restatedev/restate/releases/latest/download/restate.$RESTATE_PLATFORM.tar.gz && \tar -xvf restate.$RESTATE_PLATFORM.tar.gz && \chmod +x restate restate-server && \# Move the binaries to a directory in your PATH, for example ~/.local/bin:mv restate $BIN && \mv restate-server $BIN
BIN=/usr/local/bin && RESTATE_PLATFORM=x86_64-apple-darwin && \curl -LO https://github.com/restatedev/restate/releases/latest/download/restate.$RESTATE_PLATFORM.tar.gz && \tar -xvf restate.$RESTATE_PLATFORM.tar.gz && \chmod +x restate restate-server && \# Move the binaries to a directory in your PATH, for example /usr/local/bin (needs sudo):sudo mv restate $BIN && \sudo mv restate-server $BIN
BIN=/usr/local/bin && RESTATE_PLATFORM=aarch64-apple-darwin && \curl -LO https://github.com/restatedev/restate/releases/latest/download/restate.$RESTATE_PLATFORM.tar.gz && \tar -xvf restate.$RESTATE_PLATFORM.tar.gz && \chmod +x restate restate-server && \# Move the binaries to a directory in your PATH, for example /usr/local/bin (needs sudo):sudo mv restate $BIN && \sudo mv restate-server $BIN
Then run the Restate Server with:
restate-server
To run the Restate Server:
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:1.1
To run commands with the Restate CLI, use the following command:
docker run -it --network=host docker.io/restatedev/restate-cli:1.1 invocations ls
Replace invocations ls
by the CLI command you want to run.
Get the Greeter service template
Build tool:
Architecture:
- CLI
- wget
restate example java-hello-world-maven-spring-boot &&cd java-hello-world-maven-spring-boot
wget https://github.com/restatedev/examples/releases/latest/download/java-hello-world-maven-spring-boot.zip &&unzip java-hello-world-maven-spring-boot.zip -d java-hello-world-maven-spring-boot &&rm java-hello-world-maven-spring-boot.zip && cd java-hello-world-maven-spring-boot
- CLI
- wget
restate example java-hello-world-maven-quarkus &&cd java-hello-world-maven-quarkus
wget https://github.com/restatedev/examples/releases/latest/download/java-hello-world-maven-quarkus.zip &&unzip java-hello-world-maven-quarkus.zip -d java-hello-world-maven-quarkus &&rm java-hello-world-maven-quarkus.zip && cd java-hello-world-maven-quarkus
- CLI
- wget
restate example java-hello-world-maven &&cd java-hello-world-maven
wget https://github.com/restatedev/examples/releases/latest/download/java-hello-world-maven.zip &&unzip java-hello-world-maven.zip -d java-hello-world-maven &&rm java-hello-world-maven.zip && cd java-hello-world-maven
Architecture:
- CLI
- wget
restate example java-hello-world-gradle &&cd java-hello-world-gradle
wget https://github.com/restatedev/examples/releases/latest/download/java-hello-world-gradle.zip &&unzip java-hello-world-gradle.zip -d java-hello-world-gradle &&rm java-hello-world-gradle.zip && cd java-hello-world-gradle
Run the Greeter service
You are all set to start developing your service.
Open the project in an IDE and configure it to build with Gradle.
Run your service and let it listen on port 9080
for requests:
./gradlew run
Register the service
Tell Restate where the service is running, so Restate can discover and register the services and handlers behind this endpoint:
- CLI
- curl
restate deployments register http://localhost:9080
curl localhost:9070/deployments -H 'content-type: application/json' \-d '{"uri": "http://localhost:9080"}'
Output
โฏ SERVICES THAT WILL BE ADDED:- GreeterType: ServiceHANDLER INPUT OUTPUTgreet value of content-type 'application/json' value of content-type 'application/json'โ Are you sure you want to apply those changes? ยท yesโ DEPLOYMENT:SERVICE REVGreeter 1
If you run Restate with Docker, use http://host.docker.internal:9080
instead of http://localhost:9080
.
Send a request to the Greeter service
curl localhost:8080/Greeter/greet -H 'content-type: application/json' -d '"Hi!"'
You should now see printed as response: Hi!
Congratulations, you managed to run your first Restate service!
Next: Build the app
Once you have implemented your service, build the app with:
./gradlew build
- Java/Kotlin: JDK >= 11
Install Restate Server & CLI
Restate is a single self-contained binary. No external dependencies needed.
- Homebrew
- Download binaries
- Docker
Install Restate Server and CLI via:
brew install restatedev/tap/restate-server &&brew install restatedev/tap/restate
Then run the Restate Server with:
restate-server
Install the Restate Server and CLI by downloading the binaries with curl
from the releases page, and make them executable:
- Linux-x64
- Linux-arm64
- MacOS-x64
- MacOS-arm64
BIN=$HOME/.local/bin && RESTATE_PLATFORM=x86_64-unknown-linux-musl && \curl -LO https://github.com/restatedev/restate/releases/latest/download/restate.$RESTATE_PLATFORM.tar.gz && \tar -xvf restate.$RESTATE_PLATFORM.tar.gz && \chmod +x restate restate-server && \# Move the binaries to a directory in your PATH, for example ~/.local/bin:mv restate $BIN && \mv restate-server $BIN
BIN=$HOME/.local/bin && RESTATE_PLATFORM=aarch64-unknown-linux-musl && \curl -LO https://github.com/restatedev/restate/releases/latest/download/restate.$RESTATE_PLATFORM.tar.gz && \tar -xvf restate.$RESTATE_PLATFORM.tar.gz && \chmod +x restate restate-server && \# Move the binaries to a directory in your PATH, for example ~/.local/bin:mv restate $BIN && \mv restate-server $BIN
BIN=/usr/local/bin && RESTATE_PLATFORM=x86_64-apple-darwin && \curl -LO https://github.com/restatedev/restate/releases/latest/download/restate.$RESTATE_PLATFORM.tar.gz && \tar -xvf restate.$RESTATE_PLATFORM.tar.gz && \chmod +x restate restate-server && \# Move the binaries to a directory in your PATH, for example /usr/local/bin (needs sudo):sudo mv restate $BIN && \sudo mv restate-server $BIN
BIN=/usr/local/bin && RESTATE_PLATFORM=aarch64-apple-darwin && \curl -LO https://github.com/restatedev/restate/releases/latest/download/restate.$RESTATE_PLATFORM.tar.gz && \tar -xvf restate.$RESTATE_PLATFORM.tar.gz && \chmod +x restate restate-server && \# Move the binaries to a directory in your PATH, for example /usr/local/bin (needs sudo):sudo mv restate $BIN && \sudo mv restate-server $BIN
Then run the Restate Server with:
restate-server
To run the Restate Server:
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:1.1
To run commands with the Restate CLI, use the following command:
docker run -it --network=host docker.io/restatedev/restate-cli:1.1 invocations ls
Replace invocations ls
by the CLI command you want to run.
Get the Greeter service template
- CLI
- wget
restate example kotlin-hello-world-gradle &&cd kotlin-hello-world-gradle
wget https://github.com/restatedev/examples/releases/latest/download/kotlin-hello-world-gradle.zip &&unzip kotlin-hello-world-gradle.zip -d kotlin-hello-world-gradle &&rm kotlin-hello-world-gradle.zip && cd kotlin-hello-world-gradle
Run the Greeter service
You are all set to start developing your service.
Open the project in an IDE and configure it to build with Gradle.
Run your service and let it listen on port 9080
for requests:
./gradlew run
Register the service
Tell Restate where the service is running, so Restate can discover and register the services and handlers behind this endpoint:
- CLI
- curl
restate deployments register http://localhost:9080
curl localhost:9070/deployments -H 'content-type: application/json' \-d '{"uri": "http://localhost:9080"}'
Output
โฏ SERVICES THAT WILL BE ADDED:- GreeterType: ServiceHANDLER INPUT OUTPUTgreet value of content-type 'application/json' value of content-type 'application/json'โ Are you sure you want to apply those changes? ยท yesโ DEPLOYMENT:SERVICE REVGreeter 1
If you run Restate with Docker, use http://host.docker.internal:9080
instead of http://localhost:9080
.
Send a request to the Greeter service
curl localhost:8080/Greeter/greet -H 'content-type: application/json' -d '"Hi"'
You should now see printed as response: Hi!
Congratulations, you managed to run your first Restate service!
Next: Build the app
Once you have implemented your service, build the app with:
./gradlew build
- Go: >= 1.21.0
Install Restate Server & CLI
Restate is a single self-contained binary. No external dependencies needed.
- Homebrew
- Download binaries
- Docker
Install Restate Server and CLI via:
brew install restatedev/tap/restate-server &&brew install restatedev/tap/restate
Then run the Restate Server with:
restate-server
Install the Restate Server and CLI by downloading the binaries with curl
from the releases page, and make them executable:
- Linux-x64
- Linux-arm64
- MacOS-x64
- MacOS-arm64
BIN=$HOME/.local/bin && RESTATE_PLATFORM=x86_64-unknown-linux-musl && \curl -LO https://github.com/restatedev/restate/releases/latest/download/restate.$RESTATE_PLATFORM.tar.gz && \tar -xvf restate.$RESTATE_PLATFORM.tar.gz && \chmod +x restate restate-server && \# Move the binaries to a directory in your PATH, for example ~/.local/bin:mv restate $BIN && \mv restate-server $BIN
BIN=$HOME/.local/bin && RESTATE_PLATFORM=aarch64-unknown-linux-musl && \curl -LO https://github.com/restatedev/restate/releases/latest/download/restate.$RESTATE_PLATFORM.tar.gz && \tar -xvf restate.$RESTATE_PLATFORM.tar.gz && \chmod +x restate restate-server && \# Move the binaries to a directory in your PATH, for example ~/.local/bin:mv restate $BIN && \mv restate-server $BIN
BIN=/usr/local/bin && RESTATE_PLATFORM=x86_64-apple-darwin && \curl -LO https://github.com/restatedev/restate/releases/latest/download/restate.$RESTATE_PLATFORM.tar.gz && \tar -xvf restate.$RESTATE_PLATFORM.tar.gz && \chmod +x restate restate-server && \# Move the binaries to a directory in your PATH, for example /usr/local/bin (needs sudo):sudo mv restate $BIN && \sudo mv restate-server $BIN
BIN=/usr/local/bin && RESTATE_PLATFORM=aarch64-apple-darwin && \curl -LO https://github.com/restatedev/restate/releases/latest/download/restate.$RESTATE_PLATFORM.tar.gz && \tar -xvf restate.$RESTATE_PLATFORM.tar.gz && \chmod +x restate restate-server && \# Move the binaries to a directory in your PATH, for example /usr/local/bin (needs sudo):sudo mv restate $BIN && \sudo mv restate-server $BIN
Then run the Restate Server with:
restate-server
To run the Restate Server:
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:1.1
To run commands with the Restate CLI, use the following command:
docker run -it --network=host docker.io/restatedev/restate-cli:1.1 invocations ls
Replace invocations ls
by the CLI command you want to run.
Get the Greeter service template
- CLI
- wget
restate example go-hello-world &&cd go-hello-world
wget https://github.com/restatedev/examples/releases/latest/download/go-hello-world.zip &&unzip go-hello-world.zip -d go-hello-world &&rm go-hello-world.zip && cd go-hello-world
Run the Greeter service
Now, start developing your service in greeter.go
. Run it with:
go run .
it will listen on port 9080 for requests.
Register the service
Tell Restate where the service is running, so Restate can discover and register the services and handlers behind this endpoint:
- CLI
- curl
restate deployments register http://localhost:9080
curl localhost:9070/deployments -H 'content-type: application/json' \-d '{"uri": "http://localhost:9080"}'
Output
โฏ SERVICES THAT WILL BE ADDED:- GreeterType: ServiceHANDLER INPUT OUTPUTGreet value of content-type 'application/json' value of content-type 'application/json'โ Are you sure you want to apply those changes? ยท yesโ DEPLOYMENT:SERVICE REVGreeter 1
If you run Restate with Docker, use http://host.docker.internal:9080
instead of http://localhost:9080
.
Send a request to the Greeter service
curl localhost:8080/Greeter/Greet -H 'content-type: application/json' -d '"Hi"'
You should now see printed as response: Hi!
Congratulations, you managed to run your first Restate service!
Next: Build and run the app
Once you have implemented your service, build the app with:
go build .
- Python >= v3.11
Install Restate Server & CLI
Restate is a single self-contained binary. No external dependencies needed.
- Homebrew
- Download binaries
- Docker
Install Restate Server and CLI via:
brew install restatedev/tap/restate-server &&brew install restatedev/tap/restate
Then run the Restate Server with:
restate-server
Install the Restate Server and CLI by downloading the binaries with curl
from the releases page, and make them executable:
- Linux-x64
- Linux-arm64
- MacOS-x64
- MacOS-arm64
BIN=$HOME/.local/bin && RESTATE_PLATFORM=x86_64-unknown-linux-musl && \curl -LO https://github.com/restatedev/restate/releases/latest/download/restate.$RESTATE_PLATFORM.tar.gz && \tar -xvf restate.$RESTATE_PLATFORM.tar.gz && \chmod +x restate restate-server && \# Move the binaries to a directory in your PATH, for example ~/.local/bin:mv restate $BIN && \mv restate-server $BIN
BIN=$HOME/.local/bin && RESTATE_PLATFORM=aarch64-unknown-linux-musl && \curl -LO https://github.com/restatedev/restate/releases/latest/download/restate.$RESTATE_PLATFORM.tar.gz && \tar -xvf restate.$RESTATE_PLATFORM.tar.gz && \chmod +x restate restate-server && \# Move the binaries to a directory in your PATH, for example ~/.local/bin:mv restate $BIN && \mv restate-server $BIN
BIN=/usr/local/bin && RESTATE_PLATFORM=x86_64-apple-darwin && \curl -LO https://github.com/restatedev/restate/releases/latest/download/restate.$RESTATE_PLATFORM.tar.gz && \tar -xvf restate.$RESTATE_PLATFORM.tar.gz && \chmod +x restate restate-server && \# Move the binaries to a directory in your PATH, for example /usr/local/bin (needs sudo):sudo mv restate $BIN && \sudo mv restate-server $BIN
BIN=/usr/local/bin && RESTATE_PLATFORM=aarch64-apple-darwin && \curl -LO https://github.com/restatedev/restate/releases/latest/download/restate.$RESTATE_PLATFORM.tar.gz && \tar -xvf restate.$RESTATE_PLATFORM.tar.gz && \chmod +x restate restate-server && \# Move the binaries to a directory in your PATH, for example /usr/local/bin (needs sudo):sudo mv restate $BIN && \sudo mv restate-server $BIN
Then run the Restate Server with:
restate-server
To run the Restate Server:
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:1.1
To run commands with the Restate CLI, use the following command:
docker run -it --network=host docker.io/restatedev/restate-cli:1.1 invocations ls
Replace invocations ls
by the CLI command you want to run.
Get the Greeter service template
- CLI
- wget
restate example python-hello-world &&cd python-hello-world
wget https://github.com/restatedev/examples/releases/latest/download/python-hello-world.zip &&unzip python-hello-world.zip -d python-hello-world &&rm python-hello-world.zip && cd python-hello-world
Run the Greeter service
Create a venv
and install the requirements:
python3 -m venv .venvsource .venv/bin/activatepip install -r requirements.txt
Now, start developing your service in example.py
. Run it with a Hypercorn server, and let it listen on port 9080
for requests:
python -m hypercorn --config hypercorn-config.toml example:app
Register the service
Tell Restate where the service is running, so Restate can discover and register the services and handlers behind this endpoint:
- CLI
- curl
restate deployments register http://localhost:9080
curl localhost:9070/deployments -H 'content-type: application/json' \-d '{"uri": "http://localhost:9080"}'
If you run Restate with Docker, use http://host.docker.internal:9080
instead of http://localhost:9080
.
Output
โฏ SERVICES THAT WILL BE ADDED:- GreeterType: ServiceHANDLER INPUT OUTPUTgreet value of content-type 'application/json' value of content-type 'application/json'โ Are you sure you want to apply those changes? ยท yesโ DEPLOYMENT:SERVICE REVGreeter 1
Send a request to the Greeter service
curl localhost:8080/Greeter/greet -H 'content-type: application/json' -d '"Hi"'
You should now see printed as response: Hi!
Congratulations, you managed to run your first Restate service!
Install Restate Server & CLI
Restate is a single self-contained binary. No external dependencies needed.
- Homebrew
- Download binaries
- Docker
Install Restate Server and CLI via:
brew install restatedev/tap/restate-server &&brew install restatedev/tap/restate
Then run the Restate Server with:
restate-server
Install the Restate Server and CLI by downloading the binaries with curl
from the releases page, and make them executable:
- Linux-x64
- Linux-arm64
- MacOS-x64
- MacOS-arm64
BIN=$HOME/.local/bin && RESTATE_PLATFORM=x86_64-unknown-linux-musl && \curl -LO https://github.com/restatedev/restate/releases/latest/download/restate.$RESTATE_PLATFORM.tar.gz && \tar -xvf restate.$RESTATE_PLATFORM.tar.gz && \chmod +x restate restate-server && \# Move the binaries to a directory in your PATH, for example ~/.local/bin:mv restate $BIN && \mv restate-server $BIN
BIN=$HOME/.local/bin && RESTATE_PLATFORM=aarch64-unknown-linux-musl && \curl -LO https://github.com/restatedev/restate/releases/latest/download/restate.$RESTATE_PLATFORM.tar.gz && \tar -xvf restate.$RESTATE_PLATFORM.tar.gz && \chmod +x restate restate-server && \# Move the binaries to a directory in your PATH, for example ~/.local/bin:mv restate $BIN && \mv restate-server $BIN
BIN=/usr/local/bin && RESTATE_PLATFORM=x86_64-apple-darwin && \curl -LO https://github.com/restatedev/restate/releases/latest/download/restate.$RESTATE_PLATFORM.tar.gz && \tar -xvf restate.$RESTATE_PLATFORM.tar.gz && \chmod +x restate restate-server && \# Move the binaries to a directory in your PATH, for example /usr/local/bin (needs sudo):sudo mv restate $BIN && \sudo mv restate-server $BIN
BIN=/usr/local/bin && RESTATE_PLATFORM=aarch64-apple-darwin && \curl -LO https://github.com/restatedev/restate/releases/latest/download/restate.$RESTATE_PLATFORM.tar.gz && \tar -xvf restate.$RESTATE_PLATFORM.tar.gz && \chmod +x restate restate-server && \# Move the binaries to a directory in your PATH, for example /usr/local/bin (needs sudo):sudo mv restate $BIN && \sudo mv restate-server $BIN
Then run the Restate Server with:
restate-server
To run the Restate Server:
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:1.1
To run commands with the Restate CLI, use the following command:
docker run -it --network=host docker.io/restatedev/restate-cli:1.1 invocations ls
Replace invocations ls
by the CLI command you want to run.
Get the Greeter service template
Select your favorite runtime:
- CLI
- wget
restate example rust-hello-world &&cd rust-hello-world
wget https://github.com/restatedev/examples/releases/latest/download/rust-hello-world.zip &&unzip rust-hello-world.zip -d rust-hello-world &&rm rust-hello-world.zip && cd rust-hello-world
- CLI
- wget
restate example rust-shuttle-hello-world &&cd rust-shuttle-hello-world
wget https://github.com/restatedev/examples/releases/latest/download/rust-shuttle-hello-world.zip &&unzip rust-shuttle-hello-world.zip -d rust-shuttle-hello-world &&rm rust-shuttle-hello-world.zip && cd rust-shuttle-hello-world
Run the Greeter service
Use cargo run
to build and run the example:
cargo run
Register the service
Tell Restate where the service is running, so Restate can discover and register the services and handlers behind this endpoint:
- CLI
- curl
restate deployments register http://localhost:9080
curl localhost:9070/deployments -H 'content-type: application/json' \-d '{"uri": "http://localhost:9080"}'
Output
โฏ SERVICES THAT WILL BE ADDED:- GreeterType: ServiceHANDLER INPUT OUTPUTgreet value of content-type 'application/json' value of content-type 'application/json'โ Are you sure you want to apply those changes? ยท yesโ DEPLOYMENT:SERVICE REVGreeter 1
If you run Restate with Docker, use http://host.docker.internal:9080
instead of http://localhost:9080
.
Send a request to the Greeter service
curl localhost:8080/Greeter/greet -H 'content-type: application/json' -d '"Francesco"'
You should now see printed as response: "Greetings Francesco"
Congratulations, you managed to run your first Restate service!
Next steps
- Read the Concepts
- Discover the key features of Restate in the Tour of Restate
- Run the examples