12 Deploying web services with Docker

 

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.

12.1 Introduction to production deployment of servers and apps

12.1.1 Software deployment cycle

12.1.2 Docker container basics

12.2 Writing the first Docker container

12.2.1 Check Docker installation

12.2.2 Writing a simple Docker container

12.2.3 Multi-stage Docker build

12.3 Building the database container

12.3.1 Packaging the Postgres database

12.3.2 Creating database tables

12.4 Packaging the web service with Docker

12.5 Orchestrating Docker containers with Docker Compose

12.6 Suggested exercises

12.7 Summary

sitemap