Answer the question
In order to leave comments, you need to log in
How to properly deploy an environment through Docker?
Good time of the day! Actually there was such a question. An application is being developed that has a Node.JS front and a PHP API backend to it. You need to place the front on the test-domain.com domain, and the API on api.test-domain.com.
PHP requires php-fpm. How to do it better? Run in nginx container with php-fpm and share container with node and php? Or is there a better option?
Answer the question
In order to leave comments, you need to log in
Everything is separate - Nginx, php-fpm, Node.js. Each container has its own public API, in this case the port it listens on. Then the containers communicate with each other, for example, Nginx redirects requests to php-fpm or Node.js if necessary.
The question arises, why such towns? Personally, I had problems with such a bunch, a container can only be linked once to another container, this is when I did the Nginx + PHP-FPM + MariaDB link, as a result, when I wanted to hang the container with Apache to the same Maria, I stepped on a rake, I didn’t link containers they wanted the storage, of course, they had a folder mapped, but a couple of new containers had to be lifted onto the new database that is visible through Apache, from here I ate more memory, taking into account VPS hosting, this is not economical on resources. As a result, everything was inclined to the fact that the docker was killed once and for all in the DEV environment, the only plus I see in it is when more than one developer is physically on the same DEV server and they have different projects, then it is more logical to drive the entire environment into one container for a specific developer ,
Put on a bare server without docker - and nginx and node and php-fpm - all on one server. Let nginx proxy either to php-fpm or to node.js depending on the hostname to which the request came.
If you really want docker - make one container and inside nginx + node + php-fpm (but with docker, it's fashionable!)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question