shuttle-runtime 0.12.0-rc1

Runtime to start and manage any service that runs on shuttle
docs.rs failed to build shuttle-runtime-0.12.0-rc1
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build: shuttle-runtime-0.57.0

How to run

The easy way

Both the legacy and next examples can be run using the local client:

cd path/to/example
cargo run --manifest-path ../../../Cargo.toml --bin cargo-shuttle -- run

When a more fine controlled testing is needed, use the instructions below.

axum-wasm

Compile the wasm axum router:

make axum

Run the test:

cargo test --features next axum -- --nocapture

# or, run tests
make test

Load and run:

cargo run --features next --bin next -- --port 6001

In another terminal:

# load
grpcurl -plaintext -import-path ../proto -proto runtime.proto -d '{"service_name": "Tonic", "path": "/home/<path to shuttle>/runtime/axum.wasm"}' localhost:6001 runtime.Runtime/Load

# start
grpcurl -plaintext -import-path ../proto -proto runtime.proto -d '{"deployment_id": "MDAwMDAwMDAtMDAwMC0wMDAwLTAwMDAtMDAwMDAwMDAwMDAw", "ip": "127.0.0.1:8000"}' localhost:6001 runtime.Runtime/Start

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

# stop
grpcurl -plaintext -import-path ../proto -proto runtime.proto -d '{}' localhost:6001 runtime.Runtime/Stop

Curl the service:

curl  localhost:8000/hello

curl  localhost:8000/goodbye

shuttle-legacy

This will no longer load a .so file, the code to start the runtime will be codegened for all services.

An example can be found in src/bin/rocket.rs which contains the secrets rocket example at the bottom and the codegen at the top.

To test, first start a provisioner from the root directory using:

docker-compose -f docker-compose.rendered.yml up provisioner

Then in another shell, start the wrapped runtime using the clap CLI:

cargo run --bin rocket -- --port 6001 --storage-manager-type working-dir --storage-manager-path ./

Or directly (this is the path hardcoded in deployer::start):

# first, make sure the shuttle-runtime binary is built
cargo build
# then
/home/<path to shuttle repo>/target/debug/shuttle-runtime --port 6001 --storage-manager-type working-dir --storage-manager-path ./

Then in another shell, load the service and start it up:

# load
grpcurl -plaintext -import-path ../proto -proto runtime.proto -d '{"service_name": "Tonic", "path": "/home/<path to shuttle>/examples/rocket/hello-world/target/debug/libhello_world.so", "secrets": {"MY_API_KEY": "test"}}' localhost:6001 runtime.Runtime/Load

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

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

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

Running the tests

$ cd ..; make test