Packing Servers to Containers

Microservices created with Rust are pretty simple to deploy: it's sufficient to build a binary for your server, upload that binary to your server, and start it. But that's not a flexible approach for real applications. Firstly, your microservice may need files, templates, and configuration. On the other hand, you may want to use servers with different operating systems. In that case, you would have to build a binary for every system. To reduce the amount of issues with deployment, modern microservices are packed to containers and use virtualization to launch. Virtualization helps to simplify the deployment of a set of microservices. Also, it can help to scale a microservice, because to run an extra instance of a microservice you should only start another copy of the container.

This chapter will immerse you in building Docker images with Rust microservices. We will look at the following:

  • Compiling microservices with Docker.
  • Preparing a necessary Rust version in a container.
  • Reducing time spent building images with a Rust microservice. After we have prepared an image, we will create images for multiple microservices.
  • Creating a compose file for the Docker Compose utility to bootstrap a set of microservices to show how to run a complex project consisting of multiple microservices that interact with each other.
  • Configuring a set of microservices and adding a database instance to let those microservices store persistent state to a database.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.220.124.177