Process - Setup Load Balancer 1.0

1 Process

DescriptionThe process setup_load_balancer installs a new load balancer for a distributed IOM installation. It works on servers assigned to group load_balancer. Also see Concept - Ansible4IOM. The load balancer, installed this way, is an Apache HTTP-server, configured to work as load balancer for IOM.
Example: setup load-balancer
ANSIBLE_LIBRARY=<path to Ansible4IOM>/modules/ \
ANSIBLE_ROLES_PATH=<path to Ansible4IOM>/roles/ \
ansible-playbook -i <path to inventory file>/inventory \
<path to Ansible4IOM>/processes/setup_load_balancer.yml

1.1 Steps

The process consists of the following steps:

  1. osuser_install
    1. Create group of Apache user.
    2. Create user to run Apache.
  2. Apache_install
    1. Stop Apache service.
    2. Download Apache package.
    3. Prepare filesystem, install Apache package.
    4. Enable/start Apache service.
  3. Apache_configure
    1. Create OMS specific configuration file.
    2. Update httpd.conf.
    3. Execute post_apache_configuration_hook.
    4. Restart Apache service.

1.2 Background Information

The load balancer, installed this way, is an Apache HTTP-server, configured to work as load balancer for IOM. It fulfills all preconditions listed in Guide - Intershop Order Management - Technical Overview:

  • Sessions stickiness,
  • Session fail-over for undertow subsystem of Wildfly application-server,
  • Health check requests.

1.2.1 Configuration Values at roles/apache_config/defaults

The Configuration of the Apache httpd-server to be used as a load balancer is controlled by variables defined in roles/apache_config/defaults. Please have a look at this file to get first hand information about configuration settings.

To setup a working Apache httpd-server, the following variables have to be overwritten:

  • APACHE_VERSION - Please use the newest Apache version available at repository.
  • APACHE_REPO_URL - URL of maven repository to download Apache package from
  • APACHE_REPO_USER - Name of repository user
  • APACHE_REPO_PASSWD - Password of repository user
  • APACHE_SERVER_ADMIN - Email address to be rendered into error pages
  • APACHE_LB_OMSSERVER_LIST - List of IOM application severs to be served by load-balancer

APACHE_LB_OMSSERVER_LIST is the most important variable in the list above. Every IOM application server to be served by the load balancer has to be listed there. Every entry of the list consists of a hash, holding all required information of one application server.

  • host - Hostname or IP of the frontend application server.
  • port - Port of the frontend application server. According to Guide - Intershop Order Management - Technical Overview, frontend application servers use a port-offset of 100. If no further changes applied, the default value of 8180 can be used.
  • server_id - For session-stickiness and session-failover to work, it is essential that server_id is identical to expanded value of $SERVER_ID from installation.properties of according frontend application-server (see Guide - Intershop Order Management - Technical Overview).
  • healthcheck_url - The url to make healthchecks on frontend application-server. Default value can be used.

1.2.2 Extended Configuration of Apache Httpd-Server

The variables defined in roles/apache_config/defaults cover basic configuration settings only. To make further configuration changes, implement the post_apache_configuration_hook (see section Examples below).

2 Examples

2.1 Minimum Configuration of Load Balancer in Front of Two IOM Azure Nodes

Precondition for setting up an Apache httpd-server as a load balancer for two IOM Azure nodes is the installation of these two nodes (see Process - Setup OMS node). According to the section Background Information above, the group_vars/load_balancer file has to have the content shown in box below. APACHE_LB_OMSSERVER_LIST is a list of hashes, which cannot be defined in the inventory file directly. File group_vars/load_balancer is able to define complex variables. To hold all load balancer specific settings at a single place, it is a good idea to define any other load balancer specific settings within the same file.

group_vars/load_balancer file
# information required to access repo to download apache package
APACHE_VERSION: 2.4.27.0
APACHE_REPO_URL: https://repository.intershop.de/releases/
APACHE_REPO_USER: MyRepoAccount
APACHE_REPO_PASSWD: MySecretPassword
 
APACHE_SERVER_ADMIN: "admin@yoursite.com"
 
APACHE_LB_OMSSERVER_LIST: [
 {
   host: "node1",
   port: "8180",
   server_id: "node1_frontend",
   healthcheck_url: "/monitoring/services/health/status"
 },
 {
   host: "node2",
   port: "8180",
   server_id: "node2_frontend",
   healthcheck_url: "/monitoring/services/health/status"
 }
]

Keep in mind that the machine where the load balancer should be installed, has to be able to resolve hostnames of node1 and node2 correctly. Assuming the default value of SERVER_ID at installation.properties, which is $(hostname)_$OMS_SERVER_TYPE, the values for server_is were set to node1_frontend and node2_frontend. This assumption is valid only, if the shell command hostname expands on host node1 to node1 and on host node2 to node2.

Now the process setup_load_balancer can be executed.

Example: setup load-balancer
ANSIBLE_LIBRARY=<path to Ansible4IOM>/modules/ \
ANSIBLE_ROLES_PATH=<path to Ansible4IOM>/roles/ \
ansible-playbook -i <path to inventory file> \
<path to Ansible4IOM>/processes/setup_load_balancer.yml

2.2 Changing Listening Port of Apache Httpd-Server to 81

The listening port of the Apache httpd-server is not reflected by a configuration variable defined in roles/apache_config/defaults. To change the listing port, adapt httpd.conf directly. To make this change of the configuration a part of the configuration repository and to automate this configuration change, implement post_apache_configuration_hook. This hook is a snippet of Ansible code, stored in the configuration repository, which is executed during installation (see section Steps above).

Create a file post_apache_configuration_hook.yml in your configuration repository within the directory global_hooks or installation_hooks, depending on the scope of the configuration change. Also see Concept - Ansible4IOM Server Configuration Management 1.0 - 1.1.

post_apache_configuration_hook.yml
- name: update httpd.conf
  lineinfile:
    dest: "{{APACHE_INSTALL_DIR}}/conf/httpd.conf"
    regexp: "{{item.regexp}}"
    line: "{{item.line}}"
    state: present
  with_items:
    - { regexp: "^[ \t]*Listen[ \t]", line: "Listen 81" }
  become: true

Now process setup_load_balancer can be executed.

Example: setup load-balancer
ANSIBLE_LIBRARY=<path to Ansible4IOM>/modules/ \
ANSIBLE_ROLES_PATH=<path to Ansible4IOM>/roles/ \
ansible-playbook -i <path to inventory file> \
<path to Ansible4IOM>/processes/setup_load_balancer.yml

2.3 Provide your own apache package

You may required an Apache package version which is not available within your repository:

Store your apache package in your configFolder/installation_files

Create/edit a file post_apache_configuration_hook.yml in your configuration repository within the directory global_hooks or installation_hooks.
E.g.:

post_apache_configuration_hook.yml
- name: copy apache pkg
  copy:
    src: "{{item.src}}"
    dest: "{{item.dest}}"
  with_items:
    - { src: "{{hook_file_dir}}/apache_httpd-2.4.33.0.tar.gz", dest: "{{ApachePkgDir}}/" }
  become: true


Disclaimer

The information provided in the Knowledge Base may not be applicable to all systems and situations. Intershop Communications will not be liable to any party for any direct or indirect damages resulting from the use of the Customer Support section of the Intershop Corporate Web site, including, without limitation, any lost profits, business interruption, loss of programs or other data on your information handling system.

Customer Support
Knowledge Base
Product Resources
Support Tickets