12 Deploying web services with Docker

 

This chapter covers

  • Introducing production deployment of Rust servers and apps
  • Writing a first Docker container
  • Building a database container
  • Packaging a web service with Docker
  • Orchestrating Docker containers with Docker Compose

In the previous chapters, you learned how to build a web service and a web application using Rust. We also looked into async programming and even addressed the P2P architecture. We tested our applications in a local development environment. But these are only the first steps. The ultimate goal is usually to deploy in a production environment.

In this last chapter, we will focus on packaging the software using a popular method of production deployment called containerization. It involves packaging the application’s components and its dependencies in a container. This container can then be deployed on multiple environments, including the cloud. One of the advantages of using containers is that the application remains cleanly separated from other containers, avoiding the risks of incompatible libraries.

We’ll take a detailed look at the steps needed to containerize our Rust web service. Once the web service is available as a Docker container, it is no different from any web service or application written in any other programming language from a production deployment standpoint. All the standard guidelines and options for deploying Docker containers will apply.

12.1 Introducing production deployment of servers and apps

12.1.1 Software deployment cycle

12.1.2 Docker container basics

12.2 Writing the Docker container

12.2.1 Checking the Docker installation

12.2.2 Writing a simple Docker container

12.2.3 Multistage 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

sitemap