Answer the question
In order to leave comments, you need to log in
Correctly create architecture?
I have never done serious scalable programs before, just roughly speaking, I wrote a file in notepad, saved it, launched it, so now I have questions.
My photo description project grew and I decided to redo it, completely rewrite it from scratch.
There such components
1. Mysql (or other) database;
2. Python Flask + Nginx, http JSON API, DLib, TensorFlow and other libraries will probably be used (the basis of everything);
3. Python Flask + Nginx, website/web interface, specific domain, port 80, port 443 SSL certificate;
4. Python Telegram bot (one file, long poll) tg_bot.py;
5. Python bot VK (one file, long poll) vk_bot.py;
6. Python Discord bot (one file, long poll) discord_bot.py;
7. Other bots will be possible.
Now these are just files that are in the same folder and run through Supervisor.
Now I have everything dumped into one folder, functions.py lies on the surface and in all components (from 3 to 7) I import itimport functions
and use common functions likefunctions.recognize("file.jpg")
.
Answer the question
In order to leave comments, you need to log in
1 service = 1 container (docker). When you change one service, you do not need to recreate the rest.
You don’t need a database in docker, ideally on a separate VPS and forget it.
Nginx does not matter where and how it will be - the config is what, so what, it connects in advance written for the necessary services. In general, the situation is similar with the database - once installed / configured and forgotten.
You need to think about which services it makes sense to use in your own container, and which services make sense to group. For example, a database and nginx have nothing to do with each other. If you suddenly need to scale the base, and you put it in the same container with nginx, then adding a new container will simultaneously add you both a new base and nginx.
In order to configure the interaction of containers (services) with each other, use docker compose.
In general, now is the time for clouds. Just use AWS and don't worry. There, they will make a base for you with replication and backups, and you can get rid of Nginx, and in general, absolutely everything is there. Take the time to learn AWS and then you can focus on the code, instead of all the troubles with deployment and support.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question