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

Migrate RPC to ConnectRPC #698

Merged
merged 21 commits into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
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
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ $ npm run build:proto
> Primary "source of truth" location of protobuf message is
> in [yorkie](https://github.com/yorkie-team/yorkie/tree/main/api). We manage the messages in the repository.

### Testing yorkie-js-sdk with Envoy, Yorkie and MongoDB.
### Testing yorkie-js-sdk with Yorkie and MongoDB.

Start MongoDB, Yorkie and Envoy proxy in a terminal session.
Start MongoDB, Yorkie in a terminal session.

```bash
$ docker-compose -f docker/docker-compose.yml up --build -d
Expand All @@ -84,7 +84,7 @@ $ docker-compose -f docker/docker-compose.yml up --build -d

### Starting co-editing example with CodeMirror

Start MongoDB, Yorkie and Envoy proxy in a terminal session.
Start MongoDB and Yorkie in a terminal session.

```bash
$ docker-compose -f docker/docker-compose.yml up --build -d
Expand Down
14 changes: 0 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,6 @@ The Yorkie JavaScript SDK implements the client-side libraries.

To get started using Yorkie JavaScript SDK, see: https://yorkie.dev/docs/js-sdk

## How yorkie-js-sdk works

yorkie-js-sdk uses gRPC-web for communicating with Yorkie Server built on gRPC.

```
+--Browser--+ +--Envoy---------+ +--Yorkie-----+
| | | | | |
| gRPC-web <- HTTP1.1 -> gRPC-web proxy <- HTTP2 -> gRPC server |
| | | | | |
+-----------+ +----------------+ +-------------+
```

For more details: https://grpc.io/blog/state-of-grpc-web/

## Contributing

See [CONTRIBUTING](CONTRIBUTING.md) for details on submitting patches and the contribution workflow.
Expand Down
12 changes: 12 additions & 0 deletions buf.gen.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: v1
plugins:
- plugin: es
out: .
opt:
- target=js+dts
- js_import_style=legacy_commonjs
- plugin: connect-es
out: .
opt:
- target=js+dts
- js_import_style=legacy_commonjs
23 changes: 3 additions & 20 deletions docker/docker-compose-ci.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,14 @@
version: '3.3'

services:
envoy:
build:
context: ./
dockerfile: ./envoy.Dockerfile
image: 'grpcweb:envoy'
container_name: 'envoy'
restart: always
ports:
- '8080:8080'
- '9901:9901'
command: ['/etc/envoy/envoy-ci.yaml']
depends_on:
- yorkie
yorkie:
image: 'yorkieteam/yorkie:latest'
container_name: 'yorkie'
command: [
'server',
'--mongo-connection-uri',
'mongodb://mongo:27017',
]
command: ['server', '--mongo-connection-uri', 'mongodb://mongo:27017']
restart: always
ports:
- '11101:11101'
- '11102:11102'
- '8080:8080'
- '8081:8081'
depends_on:
- mongo
mongo:
Expand Down
24 changes: 2 additions & 22 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,11 @@
version: '3.3'

services:
envoy:
build:
context: ./
dockerfile: ./envoy.Dockerfile
image: 'grpcweb:envoy'
container_name: 'envoy'
restart: always
ports:
- '8080:8080'
- '9901:9901'
command: ['/etc/envoy/envoy.yaml']
depends_on:
- yorkie
# If you're using Mac or Windows, this special domain name("host.docker.internal" which makes containers able to connect to the host)
# is supported by default.
# But if you're using Linux and want an envoy container to communicate with the host,
# it may help to define "host.docker.internal" in extra_hosts.
# (Actually, other hostnames are available, but in that case you should update clusters[].host configurations of envoy.yaml)
extra_hosts:
- 'host.docker.internal:host-gateway'
yorkie:
image: 'yorkieteam/yorkie:latest'
container_name: 'yorkie'
command: ['server', '--enable-pprof']
restart: always
ports:
- '11101:11101'
- '11102:11102'
- '8080:8080'
- '8081:8081'
54 changes: 0 additions & 54 deletions docker/envoy-ci.yaml

This file was deleted.

8 changes: 0 additions & 8 deletions docker/envoy.Dockerfile

This file was deleted.

59 changes: 0 additions & 59 deletions docker/envoy.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion examples/nextjs-scheduler/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

## How to run demo

At project root, run below command to start Yorkie server and Envoy proxy.
At project root, run below command to start Yorkie server.

```bash
$ docker-compose -f docker/docker-compose.yml up --build -d
Expand Down
2 changes: 1 addition & 1 deletion examples/profile-stack/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

## How to run demo

At project root, run below command to start Yorkie and Envoy proxy.
At project root, run below command to start Yorkie.

```bash
$ docker-compose -f docker/docker-compose.yml up --build -d
Expand Down
2 changes: 1 addition & 1 deletion examples/react-tldraw/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

## How to run demo

At project root, run below command to start Yorkie server and Envoy proxy.
At project root, run below command to start Yorkie server.

```bash
$ docker-compose -f docker/docker-compose.yml up --build -d
Expand Down
2 changes: 1 addition & 1 deletion examples/react-tldraw/src/hooks/useMultiplayerState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ export function useMultiplayerState(roomId: string) {
// Setup the document's storage and subscriptions
async function setupDocument() {
try {
// 01. Create client with RPCAddr(envoy) and options with apiKey if provided.
// 01. Create client with RPCAddr and options with apiKey if provided.
// Then activate client.
const options: Options = {
apiKey: import.meta.env.VITE_YORKIE_API_KEY,
Expand Down
2 changes: 1 addition & 1 deletion examples/react-todomvc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

## How to run demo

At project root, run below command to start Yorkie server and Envoy proxy.
At project root, run below command to start Yorkie server.

```bash
$ docker-compose -f docker/docker-compose.yml up --build -d
Expand Down
2 changes: 1 addition & 1 deletion examples/react-todomvc/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ export default function App() {
doc: Document<{ todos: JSONArray<Todo> }>,
callback: (todos: any) => void,
) {
// 01. create client with RPCAddr(envoy) then activate it.
// 01. create client with RPCAddr then activate it.
await client.activate();

// 02. attach the document into the client.
Expand Down
2 changes: 1 addition & 1 deletion examples/simultaneous-cursors/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Install dependencies
$ npm install
```

At project root, run below command to start Yorkie and Envoy proxy.
At project root, run below command to start Yorkie server.

```bash
$ docker-compose -f docker/docker-compose.yml up --build -d
Expand Down
2 changes: 1 addition & 1 deletion examples/vanilla-codemirror6/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

## How to run demo

At project root, run below command to start Yorkie and Envoy proxy.
At project root, run below command to start Yorkie.

```bash
$ docker-compose -f docker/docker-compose.yml up --build -d
Expand Down
2 changes: 1 addition & 1 deletion examples/vanilla-codemirror6/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const documentTextElem = document.getElementById('document-text')!;
const networkStatusElem = document.getElementById('network-status')!;

async function main() {
// 01. create client with RPCAddr(envoy) then activate it.
// 01. create client with RPCAddr then activate it.
const client = new yorkie.Client(import.meta.env.VITE_YORKIE_API_ADDR, {
apiKey: import.meta.env.VITE_YORKIE_API_KEY,
});
Expand Down
2 changes: 1 addition & 1 deletion examples/vanilla-quill/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Install dependencies
$ npm install
```

At project root, run below command to start Yorkie and Envoy proxy.
At project root, run below command to start Yorkie.

```bash
$ docker-compose -f docker/docker-compose.yml up --build -d
Expand Down
2 changes: 1 addition & 1 deletion examples/vanilla-quill/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function toDeltaOperation<T extends TextValueType>(
}

async function main() {
// 01-1. create client with RPCAddr(envoy) then activate it.
// 01-1. create client with RPCAddr then activate it.
const client = new yorkie.Client(import.meta.env.VITE_YORKIE_API_ADDR, {
apiKey: import.meta.env.VITE_YORKIE_API_KEY,
});
Expand Down
2 changes: 1 addition & 1 deletion examples/vuejs-kanban/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

## How to run demo

At project root, run below command to start Yorkie and Envoy proxy.
At project root, run below command to start Yorkie server.

```bash
$ docker-compose -f docker/docker-compose.yml up --build -d
Expand Down
Loading
Loading