Configuration

Configuration files

Internal configuration

JLupin Edge Balancer internal configuration consists of the following files:

  • NGINX configuration file nginx.conf located in $JLUPIN_HOME/platform/technical/nginx/<os_type>/conf which only includes edge.conf - the main JLupin Edge Balancer user's configuration file.
  • Virtual servers definition: data, admin and discovery located in $JLUPIN_HOME/platform/technical/nginx/<os_type>/conf/servers
  • Services definitions that are individually included by virtual server and are located in $JLUPIN_HOME/platform/technical/nginx/<os_type>/conf/services.

The list of available service is as follows:

  • common - basic parameters that are common for all types of virtual servers.
  • proxy - dynamic proxy for HTTP request to microserivces with healthchecking included.
  • discovery - discovery services that is used for intra-zone routing
  • ssl - SSL support, it can be applied to any virtual server except discovery one (that provides /_discovery URI).
  • status - information about node, microserivces and edge balancer itself.
  • debug - specific set of entry points that shows the internal state of balancer, if you know the internal architecture of JLupin Edge Balancer it could be useful in troubleshooting (before going in to debug mode).
  • addons - additional services that could be useful in development and/or maintenance (for example: swaggerUI).

Each virtual server type includes specific list of services:

data

  • common
  • proxy

admin

  • common
  • proxy
  • ssl
  • debug
  • discovery
  • status
  • addons

discovery

  • common
  • discovery

NOTE: These files SHOULD NOT be edited by the user unless JLupin support allows it (for example, while providing appropriate fix for the bug). If some of the parameters provided by above files should be changed, it should be overwritten in user's configuration.

User's configuration

The main JLupin Edge Balancer user's configuration file is called edge.conf and is located in $JLUPIN_HOME/platform/start/configuration. It contains:

  • Basic configuration of NGINX server (generic parameters)
  • JLupin LUA module configuration and initialization commands
  • 'admin' and 'discovery' virtual servers.

It also refers to additional configuration files / directories:

  • $JLUPIN_HOME/platform/start/configuration/edge_servers directory, where definitions of 'data' virtual servers are located. This is the place, where you can add / modify configuration of access points for your services provided by microservices.
  • $JLUPIN_HOME/platform/start/configuration/edge_custom directory, where additional configuration files are located, including external microservices.

Parameters

Common parameters

Name Description
error_log Generic NGiNX parameter which configures logging (offical documentation). You can change the log path (default is: $JLUPIN_HOME/server/logs/technical/nginx), but remember to ensure its availability before Edge Balancer starting. You can also change the log severity to debug but only in case of troubleshooting (it shouldn't be set to 'debug' on production during normal system operation)
worker_processes Generic NGiNX parameter that configures the number of processes (workers) that handle requests (offical documentation). The default value (2) is suitable for most use cases. You can change to higher value in case of heavy network load, where number of JLupin nodes are limited.
worker_connections Generic NGiNX parameter that configures the maximum number of simultaneous connections that can be opened by a worker process. (offical documentation). The default value (1024) is suitable for most use cases. You can change to higher value in case of heavy network load, where number of JLupin nodes are limited. Remember that the number of open file in the operating system should be increased accordingly.
proxy_connect_timeout Generic NGiNX parameter that defines a timeout for establishing a connection with a proxied server - a servlet microservice on JLupin (offical documentation). You can set custom values suitable for specific virtual servers of servlet microservices inside the server directive.
proxy_send_timeout Generic NGiNX parameter that sets a timeout for transmitting a request to the proxied server - a servlet microservice on JLupin (offical documentation).You can set custom values suitable for specific virtual servers of servlet microservices inside the server directive.
proxy_read_timeout Generic NGiNX parameter that defines a timeout for reading a response from the proxied server - a servlet microservice on JLupin (offical documentation).You can set custom values suitable for specific virtual servers of servlet microservices inside the server directive.
log_format Generic NGiNX parameter that specifies log format (offical documentation). Adjust it to your preferences.
discoveryHost JLupin LUA module parameter that defines the IP address of Main Server that is integrated with the given Edge Balancer and discovery process establishes the connection. In the default deployment pattern Edge Balancer and Main Server are located on the same OS that why the default value is 127.0.0.1.
discoveryPort JLupin LUA module parameter that defines the port number of Main Server's HTTP INFORMATION PORT that is integrated with the given Edge Balancer and discovery process establishes the connection. In the default deployment pattern there are one Edge Balancer and one Main Server per OS that why the default value is 9098.
discoveryConnectionTimeout JLupin LUA module parameter that defines a timeout for establishing a connection with Main Server HTTP INFORMATION PORT.
discoverySendTimeout JLupin LUA module parameter that sets a timeout for transmitting a request to Main Server HTTP INFORMATION PORT.
discoveryReadTimeout JLupin LUA module parameter that defines a timeout for reading a response from Main Server HTTP INFORMATION PORT.
discoveryPeriod JLupin LUA module parameter that defines how often Edge Balancer performs the discovery process of the node and running microservices. CAUTION Changes in this file should be consulted with JLupin's support.
nginxDiscoveryPeriod JLupin LUA module parameter that defines how often Edge Balancer performs the discovery process NGINX configuration and checks its health (master). CAUTION Changes in this file should be consulted with JLupin's support.
discoveryAdminContext JLupin LUA module parameter that defines the context name of JLupin Local Web Console. CAUTION Changes in this file should be consulted with JLupin's support.
discoveryDefaultExternalPort JLupin LUA module parameter that sets the default port for those serlvet microserivces which externalPort parameter is set to ''. See the next chapters to get to know more.
discoveryPeersSource JLupin LUA module parameter that determines how JLupin Edge Balancer discovers other node in the scope of services that are provided. Definitely you should leave this parameter set as 'auto' to avoid manual reconfiguration where additional nodes are created in the autoscalling process.
discoveryPeers JLupin LUA module parameter that is the list of peers for discover process, applicable if 'discoveryPeersSource' = 'manual'.
discoveryPeersDefaultAdminPort JLupin LUA module parameter that defines the default discovery port, applicable if 'discoveryPeersSource' = 'auto'.
discoveryPeersDefaultProtocol JLupin LUA module parameter that defines the default discovery protocol, applicable if 'discoveryPeersSource' = 'auto'.
balancerSwitchPeriod JLupin LUA module parameter that defines the switching time of the balancer. We strongly advice to change it carefully along with out consulting.
balancerHttp504Failover The switch that determines if failover is performed in case of HTTP 504 error (Gateway timeout).
balancerHttp504FailoverRetries The number of attempts of connection to available microservice in HTTP 504 failover handling.
balancerHttp504FailoverCheckProcess The switch that determines whether microservice's process is checked for availability in the operating system, in HTTP 504 failover handling. If it's set to 1 (turned on), the failover is not performed if the process exists.
balancerHttp502Failover The switch that determines if failover is performed in case of HTTP 502 error (Bad gateway).
balancerHttp502FailoverRetries The number of attempts of connection to available microservice in HTTP 502 failover handling.
balancerHttp502FailoverCheckProcess The switch that determines whether microservice's process is checked for availability in the operating system, in HTTP 502 failover handling. If it's set to 1 (turned on), the failover is not performed if the process exists.
balancerCookieOptions JLupin LUA module parameter that defines the default additional parameters for the cookie used when 'httpStickySession' = 'true' is set for the microservice. It's used when 'httpStickySessionCookieOptions' microservice parameter is set to null.
healthcheckSwitch JLupin LUA module parameter that determines if external service healthchecking is performed. If healthcheckSwitch is set to '1' the 'isExternalHealthcheck' microservice parameter is considered in the next step.
healthcheckPeriod JLupin LUA module parameter that defines how often Edge Balancer performs the service healthchecking process. CAUTION Changes in this file should be consulted with JLupin's support.
healthcheckDefaultURI JLupin LUA module parameter that defines the default healthcheck URI that is used in service healthchecking process. It's used when 'externalHealthcheckURI' microservice parameter is set to null.
healthcheckOKlimit JLupin LUA module parameter that defines the number of successful healthcheck requests (following one after the other) after witch the AVAIABLE state of the microservice is set.
healthcheckFAILEDlimit JLupin LUA module parameter that defines the number of unsuccessful healthcheck requests (following one after the other) after witch the UNAVAIABLE state of the microservice is set.
healthcheckConnectionTimeout JLupin LUA module parameter that defines a timeout for establishing a connection in the service healthchecking process.
healthcheckSendTimeout JLupin LUA module parameter that sets a timeout for transmitting a request to the microservice in the process of service healthchecking.
healthcheckReadTimeout JLupin LUA module parameter that defines a timeout for reading a response from he microservice in the process of service healthchecking.
customConfigDir Location of custom configuration files (additional user's configuration, written in LUA). By default it's edge_custom in main configuration directory.
customConfigList The list of additional, custom configuration files, located in customConfigDir. By default there is a external microservice configuration.

Virtual servers parameters

Each virtual server that provides services from servlet microserivces is defined through server directive and configured by the following parameters

Name Description
listen Generic NGiNX parameter that sets the port (optionally - the IP address also) on which the server will accept requests (offical documentation)
server_name Generic NGiNX parameter that sets names of a virtual server (offical documentation)
server_type JLupin LUA module parameter that defines the type od the virtual server. The virtual server types are described in the overview section
include servers/.conf The server config file that should correspond with server_type paramter.

The additional generic NGINX parameters can be provided by the user to adjust Edge Balancer actions to services' specifics (offical documentation).

External microservices parameters

External microservices' configuration is a part of custom configuration and is defined in $customConfigDir/external_microservices.lua file. It contains the list of microservices that are managed outside JLupin Platform, but they should be provided and load balanced by JLupin Edge Balancer. There is only one requiremet towards external microservice - its services should be provided by HTTP protocol on the port available to JLupin Edge Balancer (from network perspective).

The list is a LUA table definition, each entry is a external microservice definition, as show on the below example:

externalMicroservices = {
  {
    isActive = false,
    name = "tomcat9",
    contextName = "/docs",
    directPort = 8080,
    externalPort = 8000,
    externalHealthcheckURI = "/isAlive",
    isExternalHealthcheck = false,
    httpStickySession = false,
    httpStickySessionCookieOptions = ""
    -- host = "127.0.0.1" -- If not set it is equal to discoveryHost defined in edge.conf
  }
}

Parameters description:

Name Description
isActive The switch specifying whether the external microservices is active and analyzed by the balancer.
name Name of the microservice (it should be unique in the scope of all microservices including those managed by the platform).
contextName Context name, under which the service will be available on the balancer.
directPort The port on which the service is available. The basic availability of the microservice is based on TCP healthcheck of this port.
externalPort The meaning and usage is the same as externalPort parameter defined in SERVLET microservice configuration (servlet_configuration.yml).
externalHealthcheckURI The meaning and usage is the same as externalHealthcheckURI parameter defined in SERVLET microservice configuration (servlet_configuration.yml).
isExternalHealthcheck The meaning and usage is the same as externalHealthcheckURI parameter defined in SERVLET microservice configuration (servlet_configuration.yml).
httpStickySession The meaning and usage is the same as httpStickySession parameter defined in SERVLET microservice configuration (servlet_configuration.yml).
httpStickySessionCookieOptions The meaning and usage is the same as httpStickySessionCookieOptions parameter defined in SERVLET microservice configuration (servlet_configuration.yml).
host The IP or FQDN address at which the external microservice is available. If not defined, localhost is assumed.

Failover

By default Edge Balancer performs full failover for HTTP 504 and 502 errors, which means that there is possibility that some requests which were processed during the failure would be processed again. To prevent such case the proper mechanism protecting system against request duplication should be provided on the application level OR the following configuration should be provided:

on Windows:

balancerHttp504Failover = 1
balancerHttp504FailoverRetries = 3
balancerHttp504FailoverCheckProcess = 0
balancerHttp502Failover = 0
balancerHttp502FailoverRetries = 3
balancerHttp502FailoverCheckProcess = 1

on Linux:

balancerHttp504Failover = 1
balancerHttp504FailoverRetries = 3
balancerHttp504FailoverCheckProcess = 0
balancerHttp502Failover = 0
balancerHttp502FailoverRetries = 3
balancerHttp502FailoverCheckProcess = 1

and additionally the following rules should be applied to the iptables configuration:

iptables -A OUTPUT -p tcp --sport 30001:40000 --tcp-flags RST RST -j DROP

where 30001:40000 reflects the scope of available ports for SERVLET microservices defined in main.yml file. It should be changes accordingly to your configuration (if it has been changed).