Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

 

Using noVNC in the current version of Abiquo

...

Replacing TightVNC applet with noVNC in the client-premium webapp

Download the noVNC distribution package from: http://kanaka.github.com/noVNC 

Note that this is the same package we used for the websockify

...

You can run multple websockify proxies to spread load and achieve high availability of the remote console viewers. Follow the instructions above on "Replacing TightVNC with noVNC in Abiquo" to get several proxies running. For the sake of simplicity this document refers to 2 backend servers running the websockify proxy and one load balancer using HAProxy.

Tip

Note that if you use a balancer for your websockify proxies, you need to edit the tightvnc.html file in client-premium webapp to point to the IP and port of the balancer.

Installing HAProxy

You will need the gcc compiler and make to compile HAProxy.

...

Once haproxy is installed, create its config file, /etc/haproxy.cfg a directory for haproxy under /etc:

Code Block
# mkdir /etc/haproxy

And create its config file, /etc/haproxy/haproxy.conf with the following contents:

Code Block
global
 log 127.0.0.1 local0

frontend public
 bind *:41338
 timeout client 3600s
 default_backend ws


backend ws
 balance source
 timeout queue 3600s
 timeout server 3600s
 timeout connect 3600s
 server websockify1 192.168.2.218:41337 weight 1 maxconn 1024 check
 server websockify2 192.168.2.219:41337 weight 1 maxconn 1024 check


listen stats
 bind *:80
 mode http
 stats enable
 stats uri /admin?stats
 stats refresh 5s
 stats auth admin:xabiquo
 timeout client 3600s
 timeout server 3600s
 timeout connect 3600s

Make sure you change IP addresses in each server line to match the IP addresses of your websockify proxies. To activate logging, create /etc/rsyslog.d/20-you need rsyslog package installed:

Code Block
# yum -y install rsyslog

Then create /etc/rsyslog.d/20-haproxy.conf file with the following content:

...

To run haproxy as a daemon, download the attached create an haproxy script and copy it to under /etc/init.d/ directory. Change permissions to 755, and you can

Code Block
# vi /etc/init.d/haproxy

And add the following content:

Code Block
#!/bin/sh
#
# custom haproxy init.d script, by Mattias Geniar <mattias@nucleus.be>
#
# haproxy         starting and stopping the haproxy load balancer
#
# chkconfig: 345 55 45
# description: haproxy is a TCP loadbalancer
# probe: true
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0
[ -f /usr/local/sbin/haproxy ] || exit 0
[ -f /etc/haproxy/haproxy.conf ] || exit 0
# Define our actions
checkconfig() {
	# Check the config file for errors
	/usr/local/sbin/haproxy -c -q -f /etc/haproxy/haproxy.conf
	if [ $? -ne 0 ]; then
    		echo "Errors found in configuration file."
    		return 1
  	fi
	# We're OK!
	return 0
}
start() {
	# Check config
	/usr/local/sbin/haproxy -c -q -f /etc/haproxy/haproxy.conf
        if [ $? -ne 0 ]; then
                echo "Errors found in configuration file."
                return 1
        fi
	echo -n "Starting HAProxy: "
	daemon /usr/local/sbin/haproxy -D -f /etc/haproxy/haproxy.conf -p /var/run/haproxy.pid
	RETVAL=$?
	echo
  	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/haproxy
  	return $RETVAL
}
stop() {
	echo -n "Shutting down HAProxy: "
  	killproc haproxy -USR1
  	RETVAL=$?
  	echo
  	[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/haproxy
  	[ $RETVAL -eq 0 ] && rm -f /var/run/haproxy.pid
  	return $RETVAL
}
restart() {
	/usr/local/sbin/haproxy -c -q -f /etc/haproxy/haproxy.conf
        if [ $? -ne 0 ]; then
                echo "Errors found in configuration file."
                return 1
        fi
	stop
  	start
}
check() {
  	/usr/local/sbin/haproxy -c -q -V -f /etc/haproxy/haproxy.conf
}
rhstatus() {
  	status haproxy
}
reload() {
	/usr/local/sbin/haproxy -c -q -f /etc/haproxy/haproxy.conf
        if [ $? -ne 0 ]; then
                echo "Errors found in configuration file."
                return 1
        fi
	echo -n "Reloading HAProxy config: "
	/usr/local/sbin/haproxy -f /etc/haproxy/haproxy.conf -p /var/run/haproxy.pid -sf $(cat /var/run/haproxy.pid)
	success $"Reloading HAProxy config: "
	echo
}

# Possible parameters
case "$1" in
  start)
        start
	;;
  stop)
	stop
        ;;
  status)
        rhstatus
        ;;
  restart)
	restart
        ;;
  reload)
        reload
        ;;
  checkconfig)
	check
	;;
  *)
        echo "Usage: haproxy {start|stop|status|restart|reload|checkconfig}"
        exit 1
esac
exit 0

Give the script execution permissions:

Code Block
# chmod u+x /etc/init.d/haproxy

And you will be able to perform the following commands:

Code Block
# service haproxy {start|stop|restart|reload|condrestart|status|check}

...