This file contains 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
# config/initializers/arel.rb | |
module Arel | |
class Table | |
@@show_table_logger = Logger.new('log/show_tables.log') | |
def table_exists? | |
@table_exists ||= tables.key?(@name) || engine.connection.table_exists?(name) | |
@@show_table_logger.info "#{Time.now} - #{@name}" unless @table_exists | |
@table_exists | |
end |
This file contains 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
108.170.80.50 | |
108.201.18.75 | |
109.124.204.23 | |
109.165.25.183 | |
109.184.54.17 | |
118.173.47.113 | |
120.28.231.177 | |
14.140.116.135 | |
178.140.244.3 | |
178.165.54.48 |
This file contains 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
# /etc/monit.d/emproxy.monitrc | |
check process emproxy_ngin | |
with pidfile /var/run/emproxy_ngin.pid | |
start program = "/data/ngin/shared/bin/emproxy ngin start" with timeout 30 seconds | |
stop program = "/data/ngin/shared/bin/emproxy ngin stop" with timeout 30 seconds | |
group emproxy_ngin |
This file contains 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
# /data/ngin/shared/bin/emproxy/emproxy.sh | |
#!/bin/sh | |
# This script starts and stops the em-proxy | |
# This script belongs in /data/ngin/shared/bin | |
############################################################################### | |
export PATH=/usr/local/bin:/usr/bin:/bin:/opt/bin:/usr/x86_64-pc-linux-gnu/gcc-bin/4.1.2 | |
############################################################################### | |
usage() { | |
echo "Usage: $0 <appname> {start, stop} [ssl]" |
This file contains 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
# haproxy_remove | |
#!/bin/sh | |
# Remove this instance from haproxy on the app_master | |
ssh -o StrictHostKeyChecking=no -i /home/deploy/.ssh/internal deploy@APP_MASTER "sudo sed -i -r 's/(.*HOSTNAME)/#&/g' /etc/haproxy.cfg; sudo /etc/init.d/haproxy reload" |
This file contains 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
# haproxy_add | |
#!/bin/sh | |
# Add this instance back into haproxy on the app_master | |
ssh -o StrictHostKeyChecking=no -i /home/deploy/.ssh/internal deploy@APP_MASTER "sudo sed -i -r 's/^#*\s\sserver/ server/g' /etc/haproxy.cfg; sudo /etc/init.d/haproxy reload" |
This file contains 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
# proxy_down.sh | |
#!/bin/bash | |
echo 'Reloading haproxy...' | |
/data/ngin/shared/bin/haproxy_remove | |
ssh -o StrictHostKeyChecking=no -i /home/deploy/.ssh/internal deploy@APP_MASTER "sudo sed -i -r 's/(HOSTNAME:8080)/HOSTNAME:81/g' /etc/haproxy.cfg" | |
/data/ngin/shared/bin/haproxy_add | |
echo 'Sleeping for 5s before stopping emproxy...' | |
sleep 5 | |
echo 'Stopping emproxy...' | |
sudo monit stop all -g emproxy_ngin |
This file contains 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
# proxy_up.sh | |
#!/bin/bash | |
echo 'Starting emproxy...' | |
sudo monit start all -g emproxy_ngin | |
echo 'Sleeping for 5s before reloading haproxy...' | |
sleep 5 | |
echo 'Reloading haproxy...' | |
/data/ngin/shared/bin/haproxy_remove | |
ssh -o StrictHostKeyChecking=no -i /home/deploy/.ssh/internal deploy@APP_MASTER "sudo sed -i -r 's/(HOSTNAME:81)/HOSTNAME:8080/g' /etc/haproxy.cfg" | |
/data/ngin/shared/bin/haproxy_add |
This file contains 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
###################### | |
# proxy_up.sh.erb | |
#!/bin/bash | |
echo 'Starting emproxy...' | |
sudo monit start all -g emproxy_ngin | |
echo 'Sleeping for 5s before reloading haproxy...' | |
sleep 5 | |
echo 'Reloading haproxy...' | |
/data/ngin/shared/bin/haproxy_remove |
This file contains 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
# /data/ngin/shared/proxy/proxy.rb | |
require 'em-proxy' | |
Proxy.start(:host => "0.0.0.0", :port => EMPROXY_PORT) do |conn| | |
conn.server :self, :host => '127.0.0.1', :port => NGINX_PORT | |
conn.server :proxy, :host => PROXY_IP, :port => PROXY_PORT | |
conn.on_data do |data| | |
data | |
end | |
conn.on_response do |server, resp| |