Skip to content
This repository has been archived by the owner on May 29, 2020. It is now read-only.

Tengine as load balancer with ability to dynamically configure Centrifuge backend servers

FZambia edited this page Oct 24, 2014 · 1 revision

This receipt came from this issue. Nginx or Haproxy are recommended load balancers to use with Centrifuge. This example shows how to configure Tengine with ability to dynamically configure Centrifuge backend servers.

#!/bin/bash
# Update base system and install needed software
apt-get update; apt-get -y upgrade;
apt-get -y install build-essential debhelper make autoconf automake patch module-assistant devscripts \
 dpkg-dev fakeroot pbuilder gnupg dh-make libssl-dev libpcre3-dev libpcre3 libssl-dev git curl \

# Download tengine and checkout last release
cd
git clone https://github.com/alibaba/tengine.git nginx-tengine-alibaba
cd nginx-tengine-alibaba
LASTRELEASETEN=$(git tag | sort -n | tail -1)
echo "Checkout last release: $LASTRELEASETEN"
git checkout $LASTRELEASETEN

# Download ngx_http_dyups_module and checkout last release
git clone git://github.com/yzprofile/ngx_http_dyups_module.git
LASTRELEASEDYNUP=$(git tag | sort -n | tail -1)
echo "Checkout last release: $LASTRELEASEDYNUP"
git checkout $LASTRELEASEDYNUP

# patch tengine upstream check
patch -p1 < ngx_http_dyups_module/upstream_check-tengine-2.0.3.patch

# Prepare & build debian package
mv packages/debian .
# Add custom module for compiling
sed -i -e "s|--group=nginx|--group=nginx --add-module=./ngx_http_dyups_module|" debian/rules
DEB_BUILD_OPTIONS=nocheck dpkg-buildpackage -rfakeroot -uc -b
cd

# install package
packageName=$(ls | grep tengine*.deb)
dpkg -i $packageName

Module ngx_http_dyups_module (https://github.com/yzprofile/ngx_http_dyups_module) allows to add/remove upstreams dynamically without restart/reload Nginx (Tengine in this case).

Clone this wiki locally