This repo serves as an example of how to use cargo workspaces with docker to run microservices. The intended workflow is to spin up all services within docker except one which will be run in watch mode locally.
GraphQL Services can each be run directly / standalone from their subdirectories provided they supply a top-level query, mutation, or subscription.
- Docker
- Rust
- This installs the toolchain manager,
rustup
, which managerustc
,cargo
, and itselfrustup
.
- This installs the toolchain manager,
- Cargo Watch
- The standard approach is:
cargo install cargo-watch
once you've installed Rust.
- The standard approach is:
You can run all services at once using docker compose. Once all of the services are running, you can stop whichever you want from the Docker Desktop in favor of running it locally for a better developer experience.
- Run all microservices:
docker compose up -d;
- Stop a service
<service_name>
of your choice, for exampleuser_service
cd
into the service directory<service_name>
from the repo's root- Run
cargo watch -x run
- Postgres
- Rust
- async_graphl (graphql server)
- poem (http server)
- diesel (ORM)
- GraphQL (Apollo Federation)
- Docker
- Optimized Dockerfile
- Run all services with one command
- Run a specific project with
cargo watch -x run
to leverage that dev experience. - Apollo federation / graphql
- Logging / tracing
- CI / CD
- Testing
- Seeding