Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Advertise on LowEndTalk.com
WHMCS module to handle HAproxy entries
New on LowEndTalk? Please read our 'Community Rules' by clicking on it in the right menu!

WHMCS module to handle HAproxy entries

mikhomikho Member, Provider

Has anyone heard of such a module ? Or do someone have the interest to code in exchange for some money?

Basicly the user should be able to add/delete entries on a remote HAProxy installation.
The destination IP should be picked from another product.

Thanked by 1quadhost
Get a LES NAT VPS! (or 10) in United States (3), Germany, Bulgaria, France, Norway, Australia (2), Singapore. | -> 500gb NAT Storage

Comments

  • AnthonySmithAnthonySmith Top Provider

    Interesting idea, I will put up 50% to have this made.

  • quadhostquadhost Member, Provider

    Also interested.

    Get our US, UK or BG 512mb KVM VPS w/ 2 vCPU's, 512mb RAM, 20GB Storage, 750G bandwidth, 1 IPv4 & /64 IPv6 for only £2/m!
    Monthly payment cycle, discounted upto a year, savings applied at checkout stage. Additional IPv4's available for £0.50 per month!

  • PieHasBeenEatenPieHasBeenEaten Member, Moderator
    edited March 2017

    So we got 3, that will be 33% a piece for them. While I will cover the 1% percent left over. (Just joking)

  • KuJoeKuJoe Member, Provider

    Let me take a look at HAProxy and see what's needed to update it remotely.

    -Joe @ SecureDragon - LEB's Powered by Wyvern in FL, CO, CA, IL, NJ, GA, OR, TX, and AZ
    Need backup space? Check out BackupDragon
  • mikhomikho Member, Provider

    Thank you all for commenting (and the ones who sent pm).

    Looks like I need to write down in detail what I'm looking for.

    Perhaps crowdfunding the coding afterwards :).
    To me, as a non-coder, it looks simple. Pretty sure every coder will say it ain't!?

    Get a LES NAT VPS! (or 10) in United States (3), Germany, Bulgaria, France, Norway, Australia (2), Singapore. | -> 500gb NAT Storage
  • @AnthonySmith said:
    Interesting idea, I will put up 50% to have this made.

    Ant, you have something about HAProxy in solusVM right for LES where it adds domain for client to HAproxy and ip is picked from NAT products node ip

    And @mikho

    you wanna setup a HAproxy loadbalancer or reverse proxy thing

    where use can add / delete the domain and backend IP's for the given domain

    But the IP's should be from the products that the client has in their account

    Am I right or some thing more complicated

    Make your choice on your own But i can help you to make them right.

  • AnthonySmithAnthonySmith Top Provider

    Well it took Phill about 2 - 3 hours to write the haproxy updater with me doing real time testing that I have intergrated into solusvm and maybe an hour of tweaking, so I would say 6 hours for a whmcs module is reasonable @jh @joepie91 @kujoe might want to quote?

  • Wait, if it'd benefit everyone, why not just start an open source GH repository?

    That way, everyone can benefit and/or contribute.

    wget https://s.flamz.pw/dl/bench.sh && bash bench.sh

    curl https://s.flamz.pw/analytics/bench/stats.php

  • mikhomikho Member, Provider

    @FlamesRunner said:
    Wait, if it'd benefit everyone, why not just start an open source GH repository?

    That way, everyone can benefit and/or contribute.

    That's one way, only problem is that I'm no coder. I can read and understand code, in some cases use trial and error to fix minor things (done a few changes to the vestacp provisioning file in whmcs and a plugin for vanilla forums).

    I would'nt know where to start. I could create the repository but thats about it.

    It's not a magical thing that solves itself just because there is a github repository.
    Rant over.......

    -------------/

    I did say that I was to write down the goal of the project, it is on the way. Expect to have a finished draft that I could send out to people interested to code it.

    Get a LES NAT VPS! (or 10) in United States (3), Germany, Bulgaria, France, Norway, Australia (2), Singapore. | -> 500gb NAT Storage
  • I'd be happy to help @mikho, though it'd be nice to have a few other people writing it too.

    wget https://s.flamz.pw/dl/bench.sh && bash bench.sh

    curl https://s.flamz.pw/analytics/bench/stats.php

  • mikhomikho Member, Provider

    @FlamesRunner said:
    I'd be happy to help @mikho, though it'd be nice to have a few other people writing it too.

    Thanks.
    Need to set the project goals first. Otherwise it fails before it starts if no one knows what to do :)

    Get a LES NAT VPS! (or 10) in United States (3), Germany, Bulgaria, France, Norway, Australia (2), Singapore. | -> 500gb NAT Storage
  • mikhomikho Member, Provider
    edited March 2017

    Here are my initial thoughts, basic idea is have the same option that @AnthonySmith does, only this will be with Virtualizors WHMCS module.

    Basicly HAProxy is installed on the host node and the config is then updated with information from WHMCS.


    Dependencies: virtualizor WHMCS module .
    If not installed, haproxy details are hidden from client view.

    Client should be able to (from a dropdown box) select destination IP (only shows their own active products).

    Single line input box to add domain name and a button to save the entry.
    Client should also see a list of active records with the ability to edit/delete.

    SSL Certificate:
    Checkbox to enable HTTPS.
    If checked, enable three (3) text boxes:

    • Certificate
    • Key
    • Intermediate certificate (this field is optional)

    Client interface will on it's on page but preferably "added/injected" to an already existing page.`

    **Admin side in WHMCS: **
    Configuration of the communication between WHMCS and actual server, be it SSH, webservice or similar. Developer should recommend and argue why their solution is the recommended way.

    Should be able to handle multiple servers. (Possible to read the Hostnode IP using virtualizor code?).
    Security checks, api key etc.....


    **Host Node/ HAProxy side: **
    On the Haproxy server the service/script should be able to recieve request and reply back/return code if the record was successfully added or not. And an error code with reason why it wasn't added.

    • Domain already exist
    • Domain not formatted correct
    • Other errors?!

    Tests should be done that the record doesn't already exists.

    Tests if the config is "acceptable". HAProxy service should never be restarted if the configuration file is formatted wrong.


    Now that I've given more information, anyone interested with more questions? or interested without questions?

    Get a LES NAT VPS! (or 10) in United States (3), Germany, Bulgaria, France, Norway, Australia (2), Singapore. | -> 500gb NAT Storage
  • @mikho will it take more to develop this thing for both solusVM and Virtualizors WHMCS modules

    Make your choice on your own But i can help you to make them right.

  • mikhomikho Member, Provider

    @simonindia said:
    @mikho will it take more to develop this thing for both solusVM and Virtualizors WHMCS modules

    Virtualizor has every control for the VM inside the WHMCS module, the user never has to use Virtualizor client panel.
    Solus WHMCS module is only provisioning/suspension/deletion (iirc).
    If you want to control your vm from WHMCS you need the Modulesgarden module.

    Thanked by 1simonindia
    Get a LES NAT VPS! (or 10) in United States (3), Germany, Bulgaria, France, Norway, Australia (2), Singapore. | -> 500gb NAT Storage
  • KuJoeKuJoe Member, Provider

    I don't know if it's the lack of sleep or what, but the HAProxy is really confusing me. :(

    Thanked by 1HungryVM
    -Joe @ SecureDragon - LEB's Powered by Wyvern in FL, CO, CA, IL, NJ, GA, OR, TX, and AZ
    Need backup space? Check out BackupDragon
  • mikhomikho Member, Provider

    @KuJoe said:
    I don't know if it's the lack of sleep or what, but the HAProxy is really confusing me. :(

    Must be the lack of sleep :).
    It takes as long to install and configure (both http and https) as the waiting for the certificate to arrive :).

    At first it's confusing, after that it gets easier every time. Like most other things in life

    Get a LES NAT VPS! (or 10) in United States (3), Germany, Bulgaria, France, Norway, Australia (2), Singapore. | -> 500gb NAT Storage
  • KuJoeKuJoe Member, Provider

    @mikho said:

    @KuJoe said:
    I don't know if it's the lack of sleep or what, but the HAProxy is really confusing me. :(



    Must be the lack of sleep :).
    It takes as long to install and configure (both http and https) as the waiting for the certificate to arrive :).

    At first it's confusing, after that it gets easier every time. Like most other things in life

    The setup and configuring seems simple, I'm trying to find if there's a method to update the config without having to go in and edit the file manually. If there is they aren't making it easy to find. :(

    -Joe @ SecureDragon - LEB's Powered by Wyvern in FL, CO, CA, IL, NJ, GA, OR, TX, and AZ
    Need backup space? Check out BackupDragon
  • mikhomikho Member, Provider

    @KuJoe said:

    The setup and configuring seems simple, I'm trying to find if there's a method to update the config without having to go in and edit the file manually. If there is they aren't making it easy to find. :(

    unfortunatly there is no support for config files in a directory like nginx does it. You can have multiple config files by adding more -r parameters when starting the service.

    i'm leaning towards having all static settings in haproxy.conf and add a second file for the ruleset.

    something like this:
    https://gist.github.com/mikho/b3bd50ef18042855021de1bba1fb19c8

    Now all I need is some coding done :=)

    Get a LES NAT VPS! (or 10) in United States (3), Germany, Bulgaria, France, Norway, Australia (2), Singapore. | -> 500gb NAT Storage
  • AnthonySmithAnthonySmith Top Provider
    edited March 2017

    From a logic point of view the process works best like this.

    Store a file with the header, e.g.

    global
        log 127.0.0.1 local0
        log 127.0.0.1 local1 notice
        maxconn 4096
        user haproxy
        group haproxy
        daemon
    
    defaults
        log global
        mode http
        option httplog
        option dontlognull
        option httpclose
        retries 3
        option redispatch
        maxconn 2000
        contimeout 5000
        clitimeout 50000
        srvtimeout 50000
    
    frontend http-in
        bind external ip 1:80
        bind external ip 2:80
        bind external ip 3:80
    

    The store the $acl and $use_backend and $backend to an array, name the $backend after the local IP.

    e.g.

    acl

       acl is_172.16.0.33 hdr(host) -i domain1.com
       acl is_172.16.0.44 hdr(host) -i domain2.com
    

    use_backend

       use_backend 172.16.0.33 if is_172.16.0.33
       use_backend 172.16.0.44 if is_172.16.0.44
    

    backend

        backend 172.16.0.33
            mode http
            cookie SERVERID insert nocache indirect
            option httpchk HEAD /check.txt HTTP/1.0
            option httpclose
            option forwardfor
            server initial 172.16.0.33:80 cookie server1
    
        backend 172.16.0.60
            mode http
            cookie SERVERID insert nocache indirect
            option httpchk HEAD /check.txt HTTP/1.0
            option httpclose
            option forwardfor
            server initial 172.16.0.44:80 cookie server1
    

    Then when your ready to write the haproxy.cfg (cron every 15 minutes or so) just export all of the acl's, use_backend, backend to the header template, save the output as /etc/haproxy/cfg and tell haproxy to reload/read the new config file (no need to restart the service, that actually causes issues).

    service haproxy reload
    

    Then the new config is live.

    This was everything is kept easy and the variable is the IP and the domain, everything else is the same.

    If someone wants to add more than 1 domain you simply add them (space seperated) to the ACL line e.g.

    acl is_172.16.0.33 hdr(host) -i domain1.com domain3.com domain8.com pizza.net
    

    Not sure if that helps but that is the most simple method, obviously you can change your frontend ports etc if you want.

  • AnthonySmithAnthonySmith Top Provider

    @virtualizor you guys are working on haproxy integration anyway for load balancing etc I believe, is this not something that is already being worked on?

  • @AnthonySmith said:
    @virtualizor you guys are working on haproxy integration anyway for load balancing etc I believe, is this not something that is already being worked on?

    Yes, but not for load balancing as of now. Its simply to save on the IPs.
    So a VM can use the common Public IP and a seperate internal IP.
    The advantage is that, users can add their domains in Virtualizor and we will HAproxy it to the VMs.
    If enabled by the admin, users can also forward traffic on a free port of the public IP to a port on your internal IP.

    After we release this, we will add more features as suggestions come in.

    Thanked by 1AnthonySmith

    Virtualizor - VPS Control Panel for OpenVZ, XenServer, Xen, KVM

    Our other products : Softaculous Auto Installer, Webuzo and AMPPS

  • mikhomikho Member, Provider

    @virtualizor said:

    Yes, but not for load balancing as of now. Its simply to save on the IPs.
    So a VM can use the common Public IP and a seperate internal IP.
    The advantage is that, users can add their domains in Virtualizor and we will HAproxy it to the VMs.
    If enabled by the admin, users can also forward traffic on a free port of the public IP to a port on your internal IP.

    After we release this, we will add more features as suggestions come in.

    Do you have any estimated release date?

    Get a LES NAT VPS! (or 10) in United States (3), Germany, Bulgaria, France, Norway, Australia (2), Singapore. | -> 500gb NAT Storage
  • astrovpsastrovps Member

    any update for this WHMCS module? i'm interest to buy this module

  • umiumi Member
    edited June 15

    I guess the module still not written. When restarting haproxy, one needs to pay attention to the existing on-the-flight connections to not reset them and let them close naturally. I'm good at haproxy (have an ongoing development and support for quite loaded VPN in Europe where I made https control panel to add/del haproxies, PM me for my freelancer.com profile with reviews) but not know much about writing modules for WHMCS yet. I think I can do it. Usually I charge 50-100 Euros for a 3-5 days work which is 1-2hours hire rate for EU/US IT geek ;) If you have a WHMCS for tests it will speed up things greatly. What do you think?

Sign In or Register to comment.