This is a template supposed to be used for rust microservices.
It contains an example implementation of a production user service. Anything related to specific uses may be removed, but the general template should remain the same.
- Clone it
git clone https://github.com/exapsy/rust-microservice.git
- Make sure you acquire the required dependencies
- Change the configuration to your liking
- Change the CHANGELOG.md every time there is a new version.
- Run
cargo run
:)
rustup
rust 1.66.0-nightly
Rocket.toml
is a configuration file that contains the configuration for Rocket http server library.
For more information take guidance from the v0.5-rc documentation.
GRPC_HOST
: the address to listen to for GRPC requestsDB_NAME
: is the name of the database that will be used for this service.MONGO_URI
: used to specify the mongodb database URI. If not used then no MongoDB connection is set.ROCKET_CONFIG
: Rocket is the HTTP handler. This value is used to specify the path for the rocket configuration. If not found, rocket will use the default values.
- Graceful shutdown doesn't work properly. Either kill it with
kill -9
(SIGKILL) or kill it twice so both HTTP and GRPC threads get killed.