GOLF(2gg)

πŸ“¦ version 601.4.41, in ubuntu questing

✨ NAME ✨

service β€” Golf documentation (running-application) πŸŒοΈβ™€οΈ


πŸ’… DESCRIPTION πŸ’…

okay so bestie, here's the tea: you can run a Golf application as a service by using the mgrg program manager. and once you do that, your app can hook itself up to all the commonly used web servers or load balancers (we're talking Apache, Nginx or HAProxy) so it literally becomes available on the web. main character energy fr fr 🌐✨

so like, how do you actually reach your server application? three ways, bestie, and they're all valid:

  • A web server (which is probably the most common way). You need to setup a reverse proxy, i.e. a web server that will forward requests and send replies back to clients; see below. πŸ‘€
  • The command line, in which case you can use gg (see -r option). πŸ–₯️
  • Client-API, which allows any application in any programming language to access your server, as long as it has C linkage (by far most do). This method allows for MT (multithreaded) access to your application, where many client requests can be made in parallel. Golf server runs as a number of (zero or more) background processes in parallel, processing requests simultaneously. πŸ”₯

🌈 SETTING UP REVERSE PROXY (WEB SERVER) 🌈

To access your application via a reverse proxy (i.e. web server), generally you need to add a proxy directive and restart the web server. that's it, that's the vibe πŸŽ€

If you use Apache, you need to connect it to your application, see connect-apache-tcp-socket (for using TCP sockets) and connect-apache-unix-socket (for using Unix sockets). If you use Nginx, you need to connect it to your application, see connect-nginx-tcp-socket (for using TCP sockets) and connect-nginx-unix-socket (for using Unix sockets). For HAProxy, see connect-haproxy-tcp-socket. Virtually all web servers/proxies support FastCGI protocol used by Golf; please see your server's documentation. πŸ“š

πŸ‘‘ STARTING GOLF SERVER PROCESSES πŸ‘‘

Use mgrg, for example:

mgrg <app name>

which in general will (based on the request load) start zero or more background resident process(es) (daemons) that process requests in parallel, or for instance:

mgrg -w 20 <app name>

which will start 20 processes. twenty. two-zero. we love a scalable queen πŸ’…βœ¨

πŸ¦‹ CONNECTION TIMEOUT πŸ¦‹

In a heavy-load environment, a client's connection may be rejected by the server. This may happen if the client runs very slowly due to swapping perhaps. Once a client establishes a connection, it has up to 5 seconds by default to send data; if it doesn't, the server will close the connection. Typically, clients send data right away, but due to a heavy load, this time may be longer. To set the connection timeout in milliseconds, set the following variable before starting the application server, for instance:

export "LIBFCGI_IS_AF_UNIX_KEEPER_POLL_TIMEOUT"="8000"
mgrg -w 1 <app name>

In this case, the timeout is set to 8 seconds. no cap, that env var name is a whole mouthful but it does the thing 🫢

heads up bestie: under heavy load a client connection can get rejected, and the default window for a client to send data after connecting is only 5 seconds. slow clients get the βœ‚οΈ.

πŸ’– SEE ALSO πŸ’–

  • Running application
  • application-setup
  • CGI
  • command-line
  • service
  • See all documentation

and that's the whole page, bestie!! this lil slice of the Golf manual (yes, the GOLF(2gg) one, section 2gg, Development) came to you courtesy of version <b>$VERSION</b>, dated <b>$DATE</b> β€” go forth and serve, you absolute icon πŸ‘‘πŸ’–βœ¨

πŸ“¦ where this page comes from