DEV Community

Ayomide
Ayomide

Posted on

How to Deploy a Three tier web application in 2 different ways

A three-tier web application is one that has a frontend user interface, a backend interface, and a database layer. It is a very common practice to host applications as three-tier applications. A three-tier web application leverages the use of microservices. Microservices are abstractions of your project into different layers. They are smaller pieces of the big puzzle that is your application.

An advantage of microservices that makes them a crowd favorite is that it helps keeps the different parts of your application isolated from each other. This means that a problem with your frontend interface will not affect the backend interface and vice versa.

One of the ways we will be exploring to deploy our application is the use of a deploy script, a virtual machine, an SSL certificate, and domain name routing.

First, we would need to create and virtual machine and connect to it. In the machine, we would clone the GitHub repository for the project and we would be installing Nginx in the VM.

Image description
Image description
We would need to edit our Nginx configuration file to allow our application to be served by our domain name. Don't forget to make sure your webserver can send HTTP and HTTPS traffic in your security group rules

Image description

Go to your domain name registrar and route your domain name to point to the IP address of your web server.

Image description
Install an SSL certificate for your domain name.

Image description
Run the deploy script. Your application should be running and accessible through your domain name

Image description

Alternatively, we can also deploy our application with the use of a virtual machine, docker images, and domain name routing

First, we would create a virtual machine and connect to it.
We would first install docker in the virtual machine(VM).

Image description

We would clone our Github repository into our VM.
Image description
As the dockerfiles and the docker-compose file for the applications are already in the repository, all we have to do is run docker compose up
Image description
Next, we would point our domain name to route to the IP address of our web server and install our SSL certificate. This will automatically update our nginx configuration file
Image description

Check your domain name to confirm that the SSL certificate is properly installed
Image description

Lastly, don't forget to delete and clean up all the resources you created using any of the methods to avoid unnecessary charges

Top comments (0)