Author Topic: CWP Load Balanced  (Read 5896 times)

0 Members and 1 Guest are viewing this topic.

Offline
*
CWP Load Balanced
« on: February 20, 2021, 03:53:22 AM »
I am not going to get into the exact details on how to do this, but here is how we load balance shared hosting with webpanel for free:

1. Decide on how you will load balance with Haproxy. Round robin, tcp only etc.  I also suggest using something with a gui such as pfsense.  Pfsense gives me both an internal server farm ( internal ip's) and it has a haproxy addon.  If you are using the application layer,  layer 7, http, it is easiest to use something with haproxy built in because SSL's become a nightmare on raw haproxy and offloading SSL's on the load balancer is one of favorite parts of haproxy.

2. Install webpanel on all the servers in your server farm.  If you virtualize, make a template, especially because of the custom mysql in the next step. We went with proxmox and virtualized it.  Use the internal IP's pfsense assigns. Make sure NAT etc is configured in webpanel.  Try to make sure php extensions etc match on all servers.

3. Configure webpanel to use a remote database.  We have 1 remote database load balanced between 3 others that are syncing real time.  You can get super creative here.

4. Use rysnc etc.  We use SyncThing on the /home directory.  *do not sync the databases, this will result in a nightmare.

5. When you create a new user account, create it on all webpanel servers.  I am sure there is way to sync accounts but I am not feeling risky this week.

6. A user has no idea what IP address their website is on because they only know the public IP of the loadbalancer and they do not have access to internal IP's. So the customer logs into a random server, uploads their web-files, which is synced to the other servers in the farm and then they create a database, which is remote and managed differently.

I do not host email so I did not include that. 

I wanted to give a big thank you to cwp control panel.  Without them this would not be possible.  cPanel does not support NAT and cPanel costs a fortune, to load balance cpanel might cost thousands a month in licenses.  I did order cwp pro and will continue to support cwp the best I can. 

If anyone has questions, I will be more then happy to answer them

Jay
SharkBackup
« Last Edit: February 20, 2021, 03:57:17 AM by difumetti »
Jay
SharkBackup

Offline
*
Re: CWP Load Balanced Email Server
« Reply #1 on: December 04, 2021, 08:56:03 PM »
Hi Difumetti,

I'm very interested in what you have posted and it would be great if you can elaborate a little more on the procedure.
I would like to test a dual CWP email server in load balancing having separate public IPs.

Having Sync users and database so in case one PIP is down the other server to serve the clients.

It is a nice project, yet I was looking at HAproxy and that seem to do the job for internal servers with LAN IPs, but not for external IPs.

We have to have a script to sync the users and the emails so to always have all emails and folders replicated to both servers.

Looking forward to hearing from you.

Regards Steve.

Offline
*
Re: CWP Load Balanced
« Reply #2 on: April 29, 2022, 10:10:59 PM »
Maybe they can use the API and a python or php script to synchronize the accounts.