Deploying our application on a server
Considering that we are now pulling images from docker hub, and that we have got our application running with NGINX and a database locally on our computer with docker-compose
, it should not come as a surprise that deploying on a server merely refers to orchestrating Docker containers on a server.
As we mentioned earlier, putting our image on docker hub has enabled us to use a range of container orchestration tools such as Kubernetes and terraform. However, considering this is a simple application and the book is focused on getting a Rust web application up and running as opposed to a DevOps book, we will be using docker-compose
to manage our images and containers on the server. In order to achieve this, we need to follow these steps:
- Create an EC2 instance on AWS.
- Configure traffic rules for the AWS server.
- Write a bash script that SSHs into the server, deploys, and then starts the application.
- Configure
docker-compose
for...