Skip to content

Instantly share code, notes, and snippets.

@james-huston
james-huston / haproxy.sh
Last active August 29, 2015 14:04
HAProxy init.d script for compiled install in /usr/local for CentOS/AWS
#!/bin/sh
#
# haproxy
#
# chkconfig: - 85 15
# description: HAProxy is a free, very fast and reliable solution \
# offering high availability, load balancing, and \
# proxying for TCP and HTTP-based applications
# processname: haproxy
# config: /usr/local/etc/haproxy/haproxy.cfg
@james-huston
james-huston / haproxy.sh
Created August 2, 2014 17:11
HAProxy init script for AWS CentOS from yum install
#!/bin/sh
#
# haproxy
#
# chkconfig: - 85 15
# description: HAProxy is a free, very fast and reliable solution \
# offering high availability, load balancing, and \
# proxying for TCP and HTTP-based applications
# processname: haproxy
# config: /etc/haproxy/haproxy.cfg
@james-huston
james-huston / proxyrestart.sh
Created August 1, 2014 21:04
Restart haproxy without killing it
#!/bin/bash
haproxy -f /etc/haproxy.cfg -p /var/run/haproxy.pid -sf $(cat /var/run/haproxy.pid)
@james-huston
james-huston / hastats.sh
Last active February 7, 2018 13:21
HAProxy stats to StackDriver using a shell script
# run this every minute from cron as a quick and dirty solution to get some
# haproxy stats on each of your listeners over to stackdriver
instance=$(curl -s "http://169.254.169.254/latest/meta-data/instance-id")
# while [ 1 ]; do
cp /dev/null /tmp/hastats.json
echo 'show stat' | socat - UNIX-CLIENT:/tmp/haproxy.sock \
|while IFS=',' read pxname svname qcur qmax scur smax slim stot bin bout dreq \
dresp ereq econ eresp wretr wredis status weight act bck chkfail chdown lastchg \
@james-huston
james-huston / haproxy_install
Last active August 29, 2015 14:04
Install haproxy on ec2 instance
sudo yum install gcc make openssl openssl-devel pcre-devel
cd /opt
sudo wget http://www.haproxy.org/download/1.5/src/haproxy-1.5.3.tar.gz
sudo tar -xzvf haproxy-1.5.3.tar.gz
cd haproxy-1.5.3
sudo make CPU="native" TARGET="linux2628" USE_PCRE=1 USE_OPENSSL=1 USE_ZLIB=1 USE_REGPARM=1
sudo make install
@james-huston
james-huston / haproxy.engineio.conf
Last active January 26, 2016 21:07
Basic HAProxy config that supports Engine.io 1.x and Socket.io 1.x using both polling and websockets and sticky sessions based on session cookie.
global
maxconn 32768
quiet
# Performance turning
tune.maxaccept -1
stats socket /tmp/haproxy.sock mode 0600 level admin
log 127.0.0.1 local0 notice
log 127.0.0.1 local0 debug
{
accounts: {
$elemMatch: {
account: ObjectId("abc123")
}
}
}
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<style>
.block_test {
position: absolute;
top: 0;
left: 0;
background-color: silver;
}
{
"esnext": true,
"node": true,
"laxcomma": true,
"laxbreak": true,
"camelcase": false,
"indent": 2,
"newcap": true,
"quotmark": "single",
"unused": "vars",
{
"esnext": true,
"node": true,
"laxcomma": true,
"laxbreak": true,
"camelcase": false,
"indent": 2,
"newcap": true,
"quotmark": "single",
"unused": "vars",