Skip to content

Commit cb5cdd4

Browse files
Add docker example setup
1 parent 0d1f995 commit cb5cdd4

File tree

4 files changed

+109
-26
lines changed

4 files changed

+109
-26
lines changed

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.gitignore

Dockerfile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
FROM node:22-alpine
2+
3+
WORKDIR /usr/src/app
4+
5+
# Install pnpm
6+
ENV PNPM_HOME="/pnpm"
7+
ENV PATH="$PNPM_HOME:$PATH"
8+
RUN corepack enable pnpm && corepack prepare [email protected] --activate
9+
10+
COPY . .
11+
RUN pnpm install && pnpm build
12+
13+
EXPOSE 9080
14+
ENTRYPOINT ["pnpm", "backend:run"]

README.md

Lines changed: 68 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,84 @@
1-
# Vercel Restate World
1+
# Restate + useworkflow.dev
22

3-
A TypeScript monorepo demonstrating Restate integration with Vercel Workflow. See [DEVELOPMENT.md](./DEVELOPMENT.md) for comprehensive monorepo documentation.
3+
Use Restate with [useworkflow.dev](http://useworkflow.dev).
44

5-
# Warning
5+
> [!IMPORTANT]
6+
> This integration is a proof of concept.
67
7-
This integration is currently under construction.
8+
## How to use it
89

9-
## Packages
10+
To run this integration, you'll need:
1011

11-
- **`@restatedev/world`**: Package using typed client to implement World by talking to Restate virtual objects/services
12-
- **`@restatedev/backend`**: Collection of Restate virtual objects and services
13-
- **`@restatedev/common`**: Common types package (private, not publishable)
14-
- **`@restatedev/workflow`**: Example package built using `workflow` package
12+
* The `@restatedev/world` package
13+
* Restate + Restate `World` backend
14+
* An example workflow from Vercel `workflow-examples` repo.
1515

16-
## Quick Start
16+
### Prepare the `@restatedev/world` package
1717

18-
```bash
19-
# Install dependencies
18+
1. Clone this repo
19+
```shell
20+
git clone https://github.com/restatedev/vercel-workflow.git
21+
cd vercel-workflow
22+
```
23+
24+
2. Build it
25+
```shell
2026
pnpm install
27+
pnpm build
28+
pnpm package
29+
```
2130

22-
# Start dev mode (type checking)
23-
pnpm dev
31+
### Run Restate and the Restate `world` backend
2432

25-
# Run workflow example
26-
pnpm examples:dev
33+
Run in the root of this repo:
2734

28-
# Build and run backend service
29-
pnpm build
30-
pnpm backend:run
35+
```shell
36+
docker compose up
37+
```
3138

32-
# Inspect workflows
33-
pnpm inspect
39+
To start Restate, together with the service implementing the `World` backend.
3440

35-
# Run all checks (before committing)
36-
pnpm verify
41+
### Run a Workflow example
42+
43+
Grab any of the Vercel workflow examples, e.g., the Flight booking example, cloning it in a new directory:
44+
45+
```shell
46+
git clone https://github.com/vercel/workflow-examples
47+
cd workflow-examples/flight-booking-app
48+
```
49+
50+
Each example might require additional setup, e.g. the flight booking app requires a Vercel API Gateway key in the `.env.local` file:
51+
52+
```shell
53+
touch .env.local
54+
echo "API_GATEWAY_KEY=<YOUR_KEY>" >> .env.local
3755
```
3856

39-
## Documentation
57+
Then install `@restatedev/world`:
58+
59+
```shell
60+
pnpm add <DIR_WHERE_YOU_CLONED_THIS_REPO>/restatedev-vercel-world-0.0.0.tgz
61+
```
62+
63+
Now setup Vercel to use `@restatedev/world`:
64+
65+
```shell
66+
export WORKFLOW_TARGET_WORLD=@restatedev/vercel-world
67+
```
68+
69+
And you're ready to run the example:
70+
71+
```shell
72+
pnpm dev
73+
```
74+
75+
Head over to http://localhost:3000 and you're ready to use the example.
76+
You can access the Restate UI at http://localhost:9070.
77+
78+
You can also use the Vercel inspection UI with:
79+
80+
```shell
81+
npx workflow inspect run --web
82+
```
4083

41-
- **[DEVELOPMENT.md](./DEVELOPMENT.md)** - Complete monorepo guide (PNPM, Turbo, tsdown, Vitest, Changesets)
42-
- **[AGENTS.md](./AGENTS.md)** - Guide for AI coding assistants with commands, code style, and best practices
84+
Enjoy!

docker-compose.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
services:
2+
world-backend:
3+
network_mode: host
4+
build:
5+
context: .
6+
dockerfile: Dockerfile
7+
8+
runtime:
9+
image: docker.io/restatedev/restate:1.5.3
10+
network_mode: host
11+
environment:
12+
- "RESTATE_DEFAULT_RETRY_POLICY__ON_MAX_ATTEMPTS=pause"
13+
14+
runtimesetup:
15+
image: docker.io/restatedev/restate
16+
network_mode: host
17+
depends_on:
18+
- runtime
19+
- world-backend
20+
restart: "no"
21+
entrypoint: [
22+
"sh",
23+
"-c",
24+
'sleep 5 &&
25+
restate dp register -y http://localhost:9080',
26+
]

0 commit comments

Comments
 (0)