Docker for traditional web application with load balancing?
This is rather a concept question than a technical question.
My question is: if I am going to
- Setup a wordpress eshop (woocommerce) , using Apache
- using Docker,
- with load balancing, using HAProxy
- implement the Micro Service Architecture
How should I implement it?
Here is what I came up with:
- 1 Container: Apache + PHP
- 1 Container: MySQL
But I don’t know how to integrate HAProxy into the architecure.
Can anyone please give me an idea of it?
Also how to do load-balancing if all containers are in a single machine?
Thank you in advance for helping.
One Solution collect form web for “Docker for traditional web application with load balancing?”
I have done a similar thing and that too over multiple machines.
Firstly, unless you have multiple instances of Apache+PHP, haproxy doesnt come into the picture at all.
Otherwise: An ideal setup would be:
request from user–>haproxy–>multiple (Apache + PHP) –>MySQL.
Here Haproxy would give you a common public IP(of the host machine) and port for your app to be accessed. Whenever anyone accesses this IP and port, request would be forwarded to one of your Apache+PHP containers. You will have to edit your haproxy.cfg file and list the IP and port of the containers.
This link might help you:
Please note that here Haproxy is running on your machine and not as a Docker container.