Provided by: golf_601.4.41-1_amd64 bug

NAME

       connect-haproxy-tcp-socket - Golf documentation (web-servers)

DESCRIPTION

       This  shows how to connect your application listening on TCP port <port number> (started with "-p" option
       in mgrg) to HAProxy load balancer.

       One use of HAProxy is to balance the load between different web servers, which in turn are  connected  to
       your  Golf  applications;  in this case HAProxy does not directly communicate with your Golf applications
       (which are behind other web servers).

       However, when you want HAProxy to directly communicate with your Golf application servers,  you  may  use
       configuration  similar  to  this  (shown  is  just  a bare-bone setup needed to accomplish the goal, note
       sections "frontend", "fcgi-app" and "backend" that are relevant to Golf). The HAProxy configuration  file
       is typically in "/etc/haproxy/haproxy.cfg":

           global
               user haproxy
               group haproxy
               daemon

           defaults
               mode    http
               timeout connect 5000
               timeout client  50000
               timeout server  50000
               errorfile 400 /etc/haproxy/errors/400.http
               errorfile 403 /etc/haproxy/errors/403.http
               errorfile 408 /etc/haproxy/errors/408.http
               errorfile 500 /etc/haproxy/errors/500.http
               errorfile 502 /etc/haproxy/errors/502.http
               errorfile 503 /etc/haproxy/errors/503.http
               errorfile 504 /etc/haproxy/errors/504.http

           frontend front_server
               mode http
               bind *:90
               use_backend backend_servers if { path_reg -i ^.*\/<your golf app name>\/.*$ }
               option forwardfor

           fcgi-app golf-fcgi
               log-stderr global
               docroot /var/lib/gg/<your golf app name>/app
               path-info ^.+(/<your golf app name>)(/.+)$

           backend backend_servers
               mode http
               filter fcgi-app golf-fcgi
               use-fcgi-app golf-fcgi
               server s1 127.0.0.1:3000 proto fcgi

       Restart HAProxy:

           sudo systemctl restart haproxy

       Note  that  Golf  application path is "/<your golf app name>" (and the application name may or may not be
       the same, see request). The TCP port of the application is "3000" (could be any port  number  you  choose
       that's greater than 1000 and lower than 65535).

       HAProxy  itself  is  bound  to  port  90  in  this example (see "frontend" section above), and "path_reg"
       specifies which URLs will be passed to your Golf application  (i.e.  they  must  have  "/<your  golf  app
       name>/"  in  the URL). "path-info" specifies SCRIPT_NAME and PATH_INFO (as "()" regular sub-expressions),
       which are as such passed to your Golf application. "docroot" is set to  the  application  home  directory
       (see  directories)  in  case you wish to serve HTML documents from it; however if you keep sensitive data
       there, specify another directory.

       A Golf application (named "<your  golf  app  name>")  would  have  been  started  with  (using  the  same
       application name "<your golf app name>" and TCP port "3000"):

           mgrg -p 3000 <your golf app name>

       Now  you  should  be able to connect and load-balance your Golf application servers directly from HAProxy
       (which in this example listens on port 90, so you'd refer  to  it  with  https://your-web-server:90/<your
       golf app name>/...).

SEE ALSO

        Web servers

       connect-apache-tcp-socket  connect-apache-unix-socket connect-haproxy-tcp-socket connect-nginx-tcp-socket
       connect-nginx-unix-socket See all documentation

$DATE                                               $VERSION                                           GOLF(2gg)