This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
accounts: { | |
$elemMatch: { | |
account: ObjectId("abc123") | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
haproxy -f /etc/haproxy.cfg -p /var/run/haproxy.pid -sf $(cat /var/run/haproxy.pid) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
PORT=443 | |
iptables -I INPUT -p tcp --dport $PORT --syn -j DROP | |
sleep 1 | |
service haproxy restart | |
iptables -D INPUT -p tcp --dport $PORT --syn -j DROP |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# enable epel repo | |
# install couchdb | |
sudo yum install couchdb | |
# create the ini file | |
echo "[httpd] | |
bind_address = 0.0.0.0 | |
[couch_httpd_auth] |