This is a very situation dependent question, and ultimately the answer is “it depends”. But let me try and share my own thoughts and maybe it can help with your decision.
what is the recommended way to go? do I use multiple application containers? one for the application and one for the server in python? or should I just go with implementing a server in C++?
So the choice of single or multiple containers, depends on how you want to architect this system. With a single container you have the following to consider:
- Everything will be in a single container, arguably easier to maintain
- Don’t have to worry about inter-container communications
- If you want to change only one part of the system (i.e application or webserver), then you have to change your single container which could affect both parts even though you’re only changing one part.
With a multi-container system you have this to consider:
- Multiple containers so possible more to manage, though the source code is effectively the same.
- Need to communicate between containers, though this isn’t terribly complex as I will show later
- With multi-containers you have the advantage of isolation between the various parts of your system. For example, if you only need to change the back-end application of your system, you can only change the respective container while keeping the web-server container up and running. This only isolates changes to certain parts of your stack instead of doing changes that could potentially affect the entire stack if everything was in a single container.
Now I’ve only skimmed the surface here with regards to single vs multi-container and some of this might not even apply to your case. There’s various blogs/articles out there going over in more detail this topic like this: Multi container apps | Docker Documentation
In the end I wouldn’t say there’s an absolute right or wrong approach as I said earlier, it depends.
As for what language you should do the webserver in, well this is kind of personal preference along with your own technical requirements.
If I go with multiple containers option, how do i establish communication between the two?
There are various ways to communication between containers, we have an article here that goes over some of them: Using Multiple Containers with TorizonCore | Toradex Developer Center
But in general between containers you can:
- Share directories
- Share linux sockets
- Share network ports
- Share network stacks
currently I am using vscode extension v1 experimental version. how can I transfer my signle container application to a multiple container application?
This is a bit inconvenient with our V1 extension. At the moment you’d have to develop each container in it’s own separate project. Then coordinate them outside of VSCode manually. Our new V2 extension does have the option to create multi-container projects in a single project for easier coordination.
This is probably a lot to digest, but I hope I helped clarify some of the options and choices you have available to you.