E
E
Evdokim2022-01-15 22:25:48
PostgreSQL
Evdokim, 2022-01-15 22:25:48

Will this organization of Docker containers be correct?

Hello! There was a question of publishing a web application (back + front) in production, but I'm not very familiar with Docker. Can you tell me how correct this configuration of containers is in the Docker network? Total 4 containers:

  • PostgreSQL (10.10.10.5:5432)
  • Node.js Application (10.10.10.4:3000)
  • Next.js (+ Next-Auth) (10.10.10.3:80)
  • Nginx (10.10.10.1:443)


Nginx is chosen as a front-end server to control traffic, enable SSL, and route all requests to the Next.js application. All web clients make a request to Nginx.

Next.js is chosen to provide different types of authorization (VK, FB, etc.) via Next-Auth. This is roughly speaking "backend" for the frontend. Next.js takes care of authorization and directs requests to the Node.js application.

The Node.js application already implements the core business logic. Database queries, data processing, etc. This application does not require tokens and authorization. Therefore, it is only open to Next.js.

PostgreSQL is the base itself. I think it's right to make it in a separate container.

Tell me, please, where can I read in detail in order to correctly and safely build such an infrastructure based on Docker? If you have any recommendations please share. Thank you!

Answer the question

In order to leave comments, you need to log in

3 answer(s)
K
ky0, 2022-01-15
@ky0

DBMS in production is better not in docker. Well, or at least set up a replica with an auto-failover.

R
rPman, 2022-01-15
@rPman

Why are you separating parts of the application by docker images?
a docker image is a minimal virtual machine, the state of which can (should) be reset, and which logically combines functionality that will work as is ... to make it stupidly convenient to deploy and update the application,
I will understand it to separate the database, although this is a separate philosophical conversation, is it necessary, in principle, to put it in the docker image, but everything else should be one whole
, so the answer is, one maximum of two images is enough

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question