This chapter covers
- Introduction to production deployment of Rust servers and apps
- Writing the first Docker container
- Building the database container
- Packaging the web service with Docker
- Orchestrating Docker containers with Docker Compose
In the previous sections of this book, we learned how to build a web service and a web application using Rust. We also looked closer into async programming and even addressed P2P architecture. We tested out developments in a local development environment. This is only the first step. The ultimate goal is usually to deploy in a production environment. Production deployment involves many aspects that are outside of the scope of this book, such as selection of an infrastructure provider, packaging the software, configuring secrets, adding configurable logs for monitoring and debugging, adding application-level security to the web service API endpoints, adding server-level security (with TLS, CORS), protecting secrets such as access credentials and keys, configuring monitoring tools and alerts, adding database backups. and a lot more. It is not the intent of this book to provide an exhaustive guide to all the considerations in preparing and deploying an application or service into production, or to enumerate the best practices in this regard. This is because this is not a Rust-specific topic, and also because there is a lot of publicly available material (and other books) that cover this topic very well.