Skip to content

Commit

Permalink
docs: update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
oddgrd committed Nov 21, 2022
1 parent 0a1b29c commit 4b3a5c1
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 9 deletions.
30 changes: 21 additions & 9 deletions runtime/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
## How to run
# How to run

## serenity-wasm

Build and run:

```bash
$ make wasm
Expand All @@ -8,10 +12,19 @@ $ DISCORD_TOKEN=xxx cargo run
In another terminal:

``` bash
grpcurl -plaintext -import-path ../proto -proto runtime.proto -d '{"service_name": "Tonic", "path": "runtime/bot.wasm"}' localhost:8000 runtime.Runtime/Load
grpcurl -plaintext -import-path ../proto -proto runtime.proto -d '{"service_name": "Tonic"}' localhost:8000 runtime.Runtime/Start
grpcurl -plaintext -import-path ../proto -proto runtime.proto localhost:8000 runtime.Runtime/SubscribeLogs
# load wasm module
grpcurl -plaintext -import-path ../proto -proto runtime.proto -d '{"service_name": "Tonic", "path": "runtime/bot.wasm"}' localhost:6001 runtime.Runtime/Load

# start bot (the deployment ID is needed in the StartRequest, but it isn't used by the serenity bot currently)
grpcurl -plaintext -import-path ../proto -proto runtime.proto -d '{"service_name": "Tonic", "deployment_id": "MDAwMDAwMDAtMDAwMC0wMDAwLTAwMDAtMDAwMDAwMDAwMDAw"}' localhost:6001 runtime.Runtime/Start

# subscribe to logs (unimplemented)
grpcurl -plaintext -import-path ../proto -proto runtime.proto localhost:6001 runtime.Runtime/SubscribeLogs

# stop (the deployment ID is needed in the StopRequest, but it isn't used by the serenity bot currently)
grpcurl -plaintext -import-path ../proto -proto runtime.proto -d '{"service_name": "Tonic", "deployment_id": "MDAwMDAwMDAtMDAwMC0wMDAwLTAwMDAtMDAwMDAwMDAwMDAw"}' localhost:6001 runtime.Runtime/Stop
```

## shuttle-legacy

Load and run an .so library that implements `shuttle_service::Service`.
Expand All @@ -25,15 +38,15 @@ docker-compose -f docker-compose.rendered.yml up provisioner
Then in another shell, start the runtime using the clap CLI:

```bash
cargo run -- --legacy --provisioner-address http://localhost:8000
cargo run -- --legacy --provisioner-address http://localhost:5000
```

Or directly (this is the path hardcoded in `deployer::start`):
```bash
# first, make sure the shuttle-runtime binary is built
cargo build
# then
/home/<path to shuttle repo>/target/debug/shuttle-runtime --legacy --provisioner-address http://localhost:8000
/home/<path to shuttle repo>/target/debug/shuttle-runtime --legacy --provisioner-address http://localhost:5000
```

Pass the path to `deployer::start`
Expand All @@ -44,13 +57,12 @@ Then in another shell, load a `.so` file and start it up:
grpcurl -plaintext -import-path ../proto -proto runtime.proto -d '{"service_name": "Tonic", "path": "examples/rocket/hello-world/target/debug/libhello_world.so"}' localhost:6001 runtime.Runtime/Load

# run (this deployment id is default uuid encoded as base64)
grpcurl -plaintext -import-path ../proto -proto runtime.proto -d '{"service_name": "Tonic", "deployment_id": "MDAwMDAwMDAtMDAwMC0wMDAwLTAwMDAtMDAwMDAwMDAwMDAw"}' localhost:6001 runti
me.Runtime/Start
grpcurl -plaintext -import-path ../proto -proto runtime.proto -d '{"service_name": "Tonic", "deployment_id": "MDAwMDAwMDAtMDAwMC0wMDAwLTAwMDAtMDAwMDAwMDAwMDAw"}' localhost:6001 runtime.Runtime/Start

# subscribe to logs
grpcurl -plaintext -import-path ../proto -proto runtime.proto localhost:6001 runtime.Runtime/SubscribeLogs

# stop
# stop (the service started in the legacy runtime can't currently be stopped)
grpcurl -plaintext -import-path ../proto -proto runtime.proto -d '{"service_name": "Tonic"}' localhost:6001 runtime.Runtime/Stop
```

Expand Down
2 changes: 2 additions & 0 deletions runtime/src/legacy/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@ impl Runtime for Legacy {
}
}

// todo: this doesn't currently stop the service, since we can't stop the tokio runtime it
// is started on.
async fn stop(&self, request: Request<StopRequest>) -> Result<Response<StopResponse>, Status> {
let request = request.into_inner();

Expand Down

0 comments on commit 4b3a5c1

Please sign in to comment.