Red Hat Bugzilla – Bug 1013166
[RFE] Add the ability to adjust when haproxy shutsdown the app cart in the lead gear
Last modified: 2014-04-28 02:49:42 EDT
Description of problem:
Currently, haproxy, when scaled to 3 or more gears, will shutdown the application cartridge (i.e. ruby, python, php, etc) in the gear that also houses haproxy so that haproxy has access to the entire gear's resources. It is requested that the number of gears required to shutdown the application cartridge be adjustable.
The goal of this is to allow the application creator to have one haproxy gear and just one application gear or , if load permits, have 3 total gears and still have the application cartridge running on the haproxy gear.
Current upstream/1.2/2.0 code:
122 # Disable the local endpoint if one of the remote gears is available and it
123 # isn't already disabled
124 if [ $(grep -E "server\s*gear" $HAPROXY_CONFIG | wc -l) -ge 2 ]; then
125 if grep "local-gear" $HAPROXY_CONFIG | grep "weight 0" &>/dev/null; then
126 echo "Local gear already disabled in config. "
128 echo "Disabling local gear in the config. "
129 nohup $OPENSHIFT_HAPROXY_DIR/usr/bin/fix_local.sh &
If we change "2" to an adjustable environment variable in line 124, this should achieve the goal. I am unsure if this is the method development would like to take.
Adding a new OPENSHIFT_HAPROXY_GEAR_RATIO env var that can be used to override the default of "3". This will need to be documented.
Checked on devenv_4547, issue has been fixed.
The new env has been introduced. And works well.
After set the OPENSHIFT_HAPROXY_GEAR_RATIO to 4, the head gear will not DOWN when there are 3 gears. And will DOWN when there are 4 gears.
Move bug to verified.