Best practice to deploy a web application

Viewed 838

I'm building a full-stack web-application. I'm using Vue.js for the frontend, Spring Boot for the back-end, and PostgreSQL docker container for the database. However, I am very curious about once I finish developing my web-application where and how should I deploy it.

I listed my questions below:

  • where should I deploy my full-stack app, like AWS, GCP, Hiroku, or any other platform.
  • what is the best practice for deploying my frontend, backend, and database? Like, should I deploy my frontend on one server and the backend on another server? If I deployed in different servers for frontend and backend, how would they communicate to each other? Or should I deploy in the same server?
  • Where should I deploy my Postgres Docker container? I know in AWS there is a service called RDS but how would I use it with my Postgres Docker container or is there a better way?

Thank you!

2 Answers

1.Before deploying a web application besides cost, these are the following things you should consider

  • For application development, choose PaaS. The infrastructure is managed by a vendor, which gives you more time to focus on your application code.
  • For application development, choose a platform enabled for both manual and automatic horizontal scaling of your application.
  • For green-field applications, design apps that are stateless.
  • For legacy or existing applications, choose a PaaS provider that supports both stateful and stateless applications.
  • Choose a database that is scalable and located on a separate server or container from your application code. Then you can scale the database independently.
  • Choose a cloud provider that enables you to both deploy and scale your application infrastructure across multiple geographies throughout the world.
  • Develop using REST-based web services.
  • Choose a cloud provider that meets all of the previous requirements with the added feature of integrated continuous integrations and continuous delivery tools in the platform.
  • Avoid being locked in by a vendor.

2.One of the questions that arise when we talk about the web development process is, whether it is useful to keep the frontend-backend together or they should be kept separate.

Personally speaking, You don’t have to use different servers for different components. It will work very efficiently even if you've only a single combined server.

If your single combined server is incapable of handling a large number of database requests and web server requests from your visitors, Optimize your back-end and front-end codes and normalize the database, Even after doing this, if there are no efficiency increases as you expected, then only you need to use two servers for both to increase your efficiency.

The problem with different servers for different uses is cost and management. You've to pay as double ( in most cases ) as you’re paying for a single server for two servers. The managing of both servers is quite difficult, if your application is large enough, you may have to appoint more than one server manager.

I prefer to use a single combined server and for large-scale use, I prefer to use just a database on different servers and both front-end and back-end servers on a single server.

  1. Choosing a cloud provider may be based on many factors: price, what services do they offer, familiarity and more.

  2. The question should not be "should I deploy FE and BE separately" but rather: "what is the trade-off, for my app, to deploy them separately vs. together". When the code grows and gets more mature and different people/teams work on it - it makes sense to decouple BE from FE, but if it's a pet project of a single person, then deploying them together is simpler operation-wise (you don't have to coordinate deploys for example).

  3. RDS supports postgres, you don't "deploy your postgres docker on RDS" but rather spin an RDS instance with postgres on it

Related