Answer the question
In order to leave comments, you need to log in
The web application has been written. What's next?
Written something like cms in Flask. There are several customers, there are also several "sites".
I can not understand how to deploy this business to its full height on one VPS.
For the most part, nginx is recommended, which looks to the outside, and further passes requests to individual application instances that are running in their virtual environments, or rather not to the instances themselves, but to instances of the web server, for example gunicorn or uwsgi, which already passes the request further to the application .
Why is it so complicated? Or is there some rationale for this?
Indeed, for such a bundle, you need to edit the configs of all programs in the bundle (nginx + one for each instance of the web server, and the configs of each application). Or are there any tools to automate this disgrace? This is the first.
Another duplication of the application and its environment on disk and in memory for each instance. Second.
When you update an application, you must update each instance. Third.
Etc. etc.
Or are there simply no alternatives?
PS Do not kick hard, I'm doing this for the first time.
Answer the question
In order to leave comments, you need to log in
.
_______ ________
| | | |
| n | -> site1.com ->| |-->| uwsgi1 |-->| |--> app1 for site1
| g | | | |________| | |
-->| i | -> site2.com ->|->| ________ |-->|--> app2 for site2
| n | | | | | | |
| x | -> site3.com ->| |-->| uwsgi2 |-->| |--> app3 for site3
|_______| |________|
# Конфиг supervisor:
[program:uwsgi]
numprocs = 3 (для 4-х ядерного серва)
command = uwsgi --emperor /path/to/conf/dir --socket /tmp/uwsgi/uwsgi-%(process_num).sock
# Конфиг uwsgi: /path/to/conf/default.ini
[uwsgi]
socket = /tmp/sockets/uwsgi-%(vassal_name).sock
# Конфиг супервизора
[program:uwsgi]
command = uwsgi --emperor /path/to/conf/dir ----vassals-include path/to/conf/default.ini
upstream backend {
server localhost:8001; #для tcp-сокетов
server localhost:8002;
server unix:/tmp/uwsgi/uwsgi-1.sock; # для unix-сокетов
server unix:/tmp/uwsgi/uwsgi-2.sock;
}
# А потом просто проксируешь на эту штуку:
server {
location / {
listen 80;
server_name site1.com;
proxy_pass http://backend;
}
}
server {
location / {
listen 80;
server_name site2.com;
proxy_pass http://backend;
}
}
In short, you can do without it and expose your application directly to the outside. But there are indeed reasons for such an architecture, it allows you to serve a larger number of requests and, oddly enough, reduces memory consumption. I'm too lazy to write more, there is a lot of information on this topic.
When updating the application, you only need to restart uswgi (or gunicorn) and that's it.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question