Docker architecture for a website.

Hello to all,

I appeal to your lights concerning docker.

I developed a marketplace for linking individuals. This marketplace is divided into 3 parts:

A backend part (nodejs + mongodb).

And 2 web applications to deploy: frontend (react) and administration site.

Having very little knowledge of architecture and wishing to dockerize the marketplace to facilitate deployment and development, what would be the best docker architecture for this kind of project in your opinion? Should I dock the whole application in the same docker or create several dockers separately? What should I dockerize? Finally here, I ask myself a lot of questions and I seek your expertise.

I thank you in advance.

Hard to say anything without knowing more about the project, but the I can tell you one thing. Usually only one process (and its forks) are running in a container. There is no systemd inside. Although you could install something like s6-overlay or Supervisor, mongodb and nodejs would run in separate containers in most of the cases.

The admin site could be in the same container as the public site (this is how WordPress or other opens ource portal engines work), or if you developed the admin site as a different application, it could be a good idea to put it in a different container. That way you can easily update only one site or stop it, for example when you still want to use the admin site to investigate an attack, but you temporarily want to stop the piblic site. The other advantage is that you could run the admin site without publishing its port and use SSH tunnel to access that locally from the server. IT depends on your usecase.

The title is “Docker achitecture for a website”, but since you have a “marketplace”, I guess you want to work mor eon security and isolate the different parts of the application.

If you are trying to create microservices, then you could have much more compontents, therefore also more containers.

So you can choose a solution depending on your audience and how secure, complex and flexible you want it to be.