Last active
December 23, 2015 16:39
-
-
Save tsnow/6663240 to your computer and use it in GitHub Desktop.
Fixing Pim Firmware issues at the Varnish / Relayd level
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
| # Test https://rips.ridecharge.com/firmware_resources/global/miamiyellow/rc_pulsar_a/Pos at all endpoints in our architecture | |
| # ssh coruscant.dca1.rws | |
| export webpath="/firmware_resources/global/miamiyellow/rc_pulsar_a/Pos"; | |
| for j in `for i in 192.168.1.203 192.168.1.204 192.168.1.206 192.168.1.207 192.168.1.208 192.168.1.209; do echo "unicorn:http://$i:51010"; done | xargs` relayd_load_balancer:http://127.0.0.1:11010 lhttp_relayd_rips.prod.rws:http://192.168.1.227:50080 lhttps_relayd_rips.prod.rws:https://192.168.1.227:50443 varnish:http://0.0.0.0:6081 https_relayd_rips.prod.rws:https://192.168.1.227:443 public:https://rips.ridecharge.com; do | |
| export name=`echo "$j" | sed 's/https*:.*//'`; | |
| export endpoint=`echo "$j" | grep -o -e 'https*:.*'`; | |
| echo $name $endpoint; | |
| curl -w '%{http_code} %{size_download} \n' --insecure -H 'X-Forwarded-Proto: https' -H 'X-Forwarded-SSL: on' -H 'Host: rips.ridecharge.com' -H 'X-Forwarded-By: rips.ridecharge.com' -o /dev/null "$endpoint""$webpath" 2>/dev/null; | |
| done | |
| echo "Disk Space:"; | |
| df -h | |
| echo "Load:"; | |
| uptime |
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
| [tsnowhite@coruscant ~]$ tail -n 50 /usr/local/etc/relayd.d/rips_* | |
| ==> /usr/local/etc/relayd.d/rips_app_ridecharge.com.conf <== | |
| ### Chef Managed for rips_app_ridecharge_com ### | |
| rips_app_ridecharge_com_addr="127.0.0.1" | |
| rips_app_ridecharge_com_port="11010" | |
| rips_app_ridecharge_com_backend_port="51010" | |
| table <rips_app_ridecharge_com_backend_hosts> { 192.168.1.203, 192.168.1.204, 192.168.1.206, 192.168.1.207, 192.168.1.208, 192.168.1.209 } | |
| http protocol "rips_app_ridecharge_com_filter" { | |
| tcp { backlog 100, nodelay, sack, socket buffer 65536 } | |
| return error | |
| header append "$REMOTE_ADDR" to "X-Forwarded-For" | |
| header append "$SERVER_ADDR:$SERVER_PORT" to "X-Forwarded-By" | |
| header change "Connection" to "close" | |
| } | |
| relay rips_app_ridecharge_com_relay { | |
| listen on $rips_app_ridecharge_com_addr port $rips_app_ridecharge_com_port | |
| protocol "rips_app_ridecharge_com_filter" | |
| forward to <rips_app_ridecharge_com_backend_hosts> port $rips_app_ridecharge_com_backend_port mode roundrobin check http "/health" host rips.ridecharge.com code 200 timeout 5000 | |
| } | |
| #unicorns work fine | |
| rips_app_ridecharge_com_backend_port="51010" | |
| table <rips_app_ridecharge_com_backend_hosts> { 192.168.1.203, 192.168.1.204, 192.168.1.206, 192.168.1.207, 192.168.1.208, 192.168.1.209 } | |
| (specifically tatooine) | |
| [tsnowhite@coruscant ~]$ for i in 192.168.1.203 192.168.1.204 192.168.1.206 192.168.1.207 192.168.1.208 192.168.1.209; do curl -w '%{http_code} %{size_download}' -o afile http://$i:51010/firmware_resources/global/miamiyellow/rc_pulsar_a/Pos ; done | |
| % Total % Received % Xferd Average Speed Time Time Time Current | |
| Dload Upload Total Spent Left Speed | |
| 100 3773k 100 3773k 0 0 75.7M 0 --:--:-- --:--:-- --:--:-- 76.7M | |
| 200 3864388 % Total % Received % Xferd Average Speed Time Time Time Current | |
| Dload Upload Total Spent Left Speed | |
| 100 3773k 100 3773k 0 0 31.2M 0 --:--:-- --:--:-- --:--:-- 31.4M | |
| 200 3864388 % Total % Received % Xferd Average Speed Time Time Time Current | |
| Dload Upload Total Spent Left Speed | |
| 100 3773k 100 3773k 0 0 90.9M 0 --:--:-- --:--:-- --:--:-- 92.1M | |
| 200 3864388 % Total % Received % Xferd Average Speed Time Time Time Current | |
| Dload Upload Total Spent Left Speed | |
| 100 3773k 100 3773k 0 0 31.4M 0 --:--:-- --:--:-- --:--:-- 31.7M | |
| 200 3864388 % Total % Received % Xferd Average Speed Time Time Time Current | |
| Dload Upload Total Spent Left Speed | |
| 100 3773k 100 3773k 0 0 23.2M 0 --:--:-- --:--:-- --:--:-- 23.1M | |
| 200 3864388 % Total % Received % Xferd Average Speed Time Time Time Current | |
| Dload Upload Total Spent Left Speed | |
| 100 3773k 100 3773k 0 0 31.8M 0 --:--:-- --:--:-- --:--:-- 32.0M | |
| 200 3864388[tsnowhite@coruscant ~]$ | |
| # relayd loadbalancer works fine | |
| rips_app_ridecharge_com_addr="127.0.0.1" | |
| rips_app_ridecharge_com_port="11010" | |
| [tsnowhite@coruscant ~]$ curl -w '%{http_code} %{size_download}' -o /dev/null 127.0.0.1:11010/firmware_resources/global/miamiyellow/rc_pulsar_a/Pos | |
| % Total % Received % Xferd Average Speed Time Time Time Current | |
| Dload Upload Total Spent Left Speed | |
| 100 3773k 100 3773k 0 0 85.0M 0 --:--:-- --:--:-- --:--:-- 85.7M | |
| 200 3864388[tsnowhite@coruscant ~]$ | |
| ==> /usr/local/etc/relayd.d/rips_http_prod.rws.conf <== | |
| ### Chef Managed for rips_http_prod_rws ### | |
| rips_http_prod_rws_addr="192.168.1.227" | |
| rips_http_prod_rws_port="80" | |
| rips_http_prod_rws_backend_port="6081" | |
| table <rips_http_prod_rws_backend_hosts> { 0.0.0.0 } | |
| http protocol "rips_http_prod_rws_filter" { | |
| tcp { backlog 100, nodelay, sack, socket buffer 65536 } | |
| return error | |
| header append "$REMOTE_ADDR" to "X-Forwarded-For" | |
| header append "$SERVER_ADDR:$SERVER_PORT" to "X-Forwarded-By" | |
| header change "Connection" to "close" | |
| } | |
| relay rips_http_prod_rws_relay { | |
| listen on $rips_http_prod_rws_addr port $rips_http_prod_rws_port | |
| protocol "rips_http_prod_rws_filter" | |
| forward to <rips_http_prod_rws_backend_hosts> port $rips_http_prod_rws_backend_port mode roundrobin check http "/health" host rips.ridecharge.com code 301 timeout 5000 | |
| } | |
| # redirect expected | |
| for i in {1..100}; do curl -w '%{http_code} %{size_download} \n' --insecure -H 'Host: rips.ridecharge.com' -H 'X-Forwarded-By: rips.ridecharge.com' -o /dev/null http://192.168.1.227:80/firmware_resources/global/miamiyellow/rc_pulsar_a/Pos 2>/dev/null; done | uniq -c | |
| 100 301 0 | |
| for i in {1..100}; do curl -w '%{http_code} %{size_download} \n' --insecure -H 'X-Forwarded-Proto: https' -H 'X-Forwarded-SSL: on' -H 'Host: rips.ridecharge.com' -H 'X-Forwarded-By: rips.ridecharge.com' -o /dev/null http://0.0.0.0:6081/firmware_resources/global/miamiyellow/rc_pulsar_a/Pos 2>/dev/null; done | uniq -c | |
| 100 200 3864388 | |
| ==> /usr/local/etc/relayd.d/rips_https_prod.rws.conf <== | |
| ### Chef Managed for rips_https_prod_rws ### | |
| rips_https_prod_rws_addr="192.168.1.227" | |
| rips_https_prod_rws_port="443" | |
| rips_https_prod_rws_backend_port="6081" | |
| table <rips_https_prod_rws_backend_hosts> { 0.0.0.0 } | |
| http protocol "rips_https_prod_rws_filter" { | |
| tcp { backlog 100, nodelay, sack, socket buffer 65536 } | |
| return error | |
| header append "$REMOTE_ADDR" to "X-Forwarded-For" | |
| header append "$SERVER_ADDR:$SERVER_PORT" to "X-Forwarded-By" | |
| header change "Connection" to "close" | |
| header change "X-Forwarded-Proto" to "https" | |
| header change "X-Forwarded-SSL" to "on" | |
| ssl { sslv3, tlsv1, ciphers "HIGH:!ADH", no sslv2 } | |
| } | |
| relay rips_https_prod_rws_relay { | |
| listen on $rips_https_prod_rws_addr port $rips_https_prod_rws_port ssl | |
| protocol "rips_https_prod_rws_filter" | |
| forward to <rips_https_prod_rws_backend_hosts> port $rips_https_prod_rws_backend_port mode roundrobin check http "/health" host rips.ridecharge.com code 301 timeout 5000 | |
| } | |
| for i in {1..100}; do curl -w '%{http_code} %{size_download} \n' --insecure -H 'Host: rips.ridecharge.com' -H 'X-Forwarded-By: rips.ridecharge.com' -o /dev/null https://192.168.1.227:443/firmware_resources/global/miamiyellow/rc_pulsar_a/Pos 2>/dev/null; done | uniq -c | |
| 100 200 3864388 | |
| ==> /usr/local/etc/relayd.d/rips_lhttp_prod.rws.conf <== | |
| ### Chef Managed for rips_lhttp_prod_rws ### | |
| rips_lhttp_prod_rws_addr="192.168.1.227" | |
| rips_lhttp_prod_rws_port="50080" | |
| rips_lhttp_prod_rws_backend_port="6081" | |
| table <rips_lhttp_prod_rws_backend_hosts> { 0.0.0.0 } | |
| http protocol "rips_lhttp_prod_rws_filter" { | |
| tcp { backlog 100, nodelay, sack, socket buffer 65536 } | |
| return error | |
| header append "$REMOTE_ADDR" to "X-Forwarded-For" | |
| header append "$SERVER_ADDR:$SERVER_PORT" to "X-Forwarded-By" | |
| header change "Connection" to "close" | |
| } | |
| relay rips_lhttp_prod_rws_relay { | |
| listen on $rips_lhttp_prod_rws_addr port $rips_lhttp_prod_rws_port | |
| protocol "rips_lhttp_prod_rws_filter" | |
| forward to <rips_lhttp_prod_rws_backend_hosts> port $rips_lhttp_prod_rws_backend_port mode roundrobin check http "/health" host rips.ridecharge.com code 301 timeout 5000 | |
| } | |
| for i in {1..100}; do curl -w '%{http_code} %{size_download} \n' --insecure -H 'X-Forwarded-Proto: https' -H 'X-Forwarded-SSL: on' -H 'Host: rips.ridecharge.com' -H 'X-Forwarded-By: rips.ridecharge.com' -o /dev/null http://192.168.1.227:50080/firmware_resources/global/miamiyellow/rc_pulsar_a/Pos 2>/dev/null; done | uniq -c | |
| 100 200 3864388 | |
| ==> /usr/local/etc/relayd.d/rips_lhttps_prod.rws.conf <== | |
| ### Chef Managed for rips_lhttps_prod_rws ### | |
| rips_lhttps_prod_rws_addr="192.168.1.227" | |
| rips_lhttps_prod_rws_port="50443" | |
| rips_lhttps_prod_rws_backend_port="6081" | |
| table <rips_lhttps_prod_rws_backend_hosts> { 0.0.0.0 } | |
| http protocol "rips_lhttps_prod_rws_filter" { | |
| tcp { backlog 100, nodelay, sack, socket buffer 65536 } | |
| return error | |
| header append "$REMOTE_ADDR" to "X-Forwarded-For" | |
| header append "$SERVER_ADDR:$SERVER_PORT" to "X-Forwarded-By" | |
| header change "Connection" to "close" | |
| header change "X-Forwarded-Proto" to "https" | |
| header change "X-Forwarded-SSL" to "on" | |
| ssl { sslv3, tlsv1, ciphers "HIGH:!ADH", no sslv2 } | |
| } | |
| relay rips_lhttps_prod_rws_relay { | |
| listen on $rips_lhttps_prod_rws_addr port $rips_lhttps_prod_rws_port ssl | |
| protocol "rips_lhttps_prod_rws_filter" | |
| forward to <rips_lhttps_prod_rws_backend_hosts> port $rips_lhttps_prod_rws_backend_port mode roundrobin check http "/health" host rips.ridecharge.com code 301 timeout 5000 | |
| } | |
| [tsnowhite@coruscant ~]$ for i in {1..100}; do curl -w '%{http_code} %{size_download} \n' --insecure -H 'X-Forwarded-Proto: https' -H 'X-Forwarded-SSL: on' -H 'Host: rips.ridecharge.com' -H 'X-Forwarded-By: rips.ridecharge.com' -o /dev/null https://192.168.1.227:50443/firmware_resources/global/miamiyellow/rc_pulsar_a/Pos 2>/dev/null; done | uniq -c | |
| 100 200 3864388 |
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
| [tsnowhite@coruscant ~]$ tail -n 50 /usr/local/etc/relayd.d/rips_* | |
| ==> /usr/local/etc/relayd.d/rips_app_ridecharge.com.conf <== | |
| ### Chef Managed for rips_app_ridecharge_com ### | |
| rips_app_ridecharge_com_addr="127.0.0.1" | |
| rips_app_ridecharge_com_port="11010" | |
| rips_app_ridecharge_com_backend_port="51010" | |
| table <rips_app_ridecharge_com_backend_hosts> { 192.168.1.203, 192.168.1.204, 192.168.1.206, 192.168.1.207, 192.168.1.208, 192.168.1.209 } | |
| http protocol "rips_app_ridecharge_com_filter" { | |
| tcp { backlog 100, nodelay, sack, socket buffer 65536 } | |
| return error | |
| header append "$REMOTE_ADDR" to "X-Forwarded-For" | |
| header append "$SERVER_ADDR:$SERVER_PORT" to "X-Forwarded-By" | |
| header change "Connection" to "close" | |
| } | |
| relay rips_app_ridecharge_com_relay { | |
| listen on $rips_app_ridecharge_com_addr port $rips_app_ridecharge_com_port | |
| protocol "rips_app_ridecharge_com_filter" | |
| forward to <rips_app_ridecharge_com_backend_hosts> port $rips_app_ridecharge_com_backend_port mode roundrobin check http "/health" host rips.ridecharge.com code 200 timeout 5000 | |
| } | |
| ==> /usr/local/etc/relayd.d/rips_http_prod.rws.conf <== | |
| ### Chef Managed for rips_http_prod_rws ### | |
| rips_http_prod_rws_addr="192.168.1.227" | |
| rips_http_prod_rws_port="80" | |
| rips_http_prod_rws_backend_port="6081" | |
| table <rips_http_prod_rws_backend_hosts> { 0.0.0.0 } | |
| http protocol "rips_http_prod_rws_filter" { | |
| tcp { backlog 100, nodelay, sack, socket buffer 65536 } | |
| return error | |
| header append "$REMOTE_ADDR" to "X-Forwarded-For" | |
| header append "$SERVER_ADDR:$SERVER_PORT" to "X-Forwarded-By" | |
| header change "Connection" to "close" | |
| } | |
| relay rips_http_prod_rws_relay { | |
| listen on $rips_http_prod_rws_addr port $rips_http_prod_rws_port | |
| protocol "rips_http_prod_rws_filter" | |
| forward to <rips_http_prod_rws_backend_hosts> port $rips_http_prod_rws_backend_port mode roundrobin check http "/health" host rips.ridecharge.com code 301 timeout 5000 | |
| } | |
| ==> /usr/local/etc/relayd.d/rips_https_prod.rws.conf <== | |
| ### Chef Managed for rips_https_prod_rws ### | |
| rips_https_prod_rws_addr="192.168.1.227" | |
| rips_https_prod_rws_port="443" | |
| rips_https_prod_rws_backend_port="6081" | |
| table <rips_https_prod_rws_backend_hosts> { 0.0.0.0 } | |
| http protocol "rips_https_prod_rws_filter" { | |
| tcp { backlog 100, nodelay, sack, socket buffer 65536 } | |
| return error | |
| header append "$REMOTE_ADDR" to "X-Forwarded-For" | |
| header append "$SERVER_ADDR:$SERVER_PORT" to "X-Forwarded-By" | |
| header change "Connection" to "close" | |
| header change "X-Forwarded-Proto" to "https" | |
| header change "X-Forwarded-SSL" to "on" | |
| ssl { sslv3, tlsv1, ciphers "HIGH:!ADH", no sslv2 } | |
| } | |
| relay rips_https_prod_rws_relay { | |
| listen on $rips_https_prod_rws_addr port $rips_https_prod_rws_port ssl | |
| protocol "rips_https_prod_rws_filter" | |
| forward to <rips_https_prod_rws_backend_hosts> port $rips_https_prod_rws_backend_port mode roundrobin check http "/health" host rips.ridecharge.com code 301 timeout 5000 | |
| } | |
| ==> /usr/local/etc/relayd.d/rips_lhttp_prod.rws.conf <== | |
| ### Chef Managed for rips_lhttp_prod_rws ### | |
| rips_lhttp_prod_rws_addr="192.168.1.227" | |
| rips_lhttp_prod_rws_port="50080" | |
| rips_lhttp_prod_rws_backend_port="6081" | |
| table <rips_lhttp_prod_rws_backend_hosts> { 0.0.0.0 } | |
| http protocol "rips_lhttp_prod_rws_filter" { | |
| tcp { backlog 100, nodelay, sack, socket buffer 65536 } | |
| return error | |
| header append "$REMOTE_ADDR" to "X-Forwarded-For" | |
| header append "$SERVER_ADDR:$SERVER_PORT" to "X-Forwarded-By" | |
| header change "Connection" to "close" | |
| } | |
| relay rips_lhttp_prod_rws_relay { | |
| listen on $rips_lhttp_prod_rws_addr port $rips_lhttp_prod_rws_port | |
| protocol "rips_lhttp_prod_rws_filter" | |
| forward to <rips_lhttp_prod_rws_backend_hosts> port $rips_lhttp_prod_rws_backend_port mode roundrobin check http "/health" host rips.ridecharge.com code 301 timeout 5000 | |
| } | |
| ==> /usr/local/etc/relayd.d/rips_lhttps_prod.rws.conf <== | |
| ### Chef Managed for rips_lhttps_prod_rws ### | |
| rips_lhttps_prod_rws_addr="192.168.1.227" | |
| rips_lhttps_prod_rws_port="50443" | |
| rips_lhttps_prod_rws_backend_port="6081" | |
| table <rips_lhttps_prod_rws_backend_hosts> { 0.0.0.0 } | |
| http protocol "rips_lhttps_prod_rws_filter" { | |
| tcp { backlog 100, nodelay, sack, socket buffer 65536 } | |
| return error | |
| header append "$REMOTE_ADDR" to "X-Forwarded-For" | |
| header append "$SERVER_ADDR:$SERVER_PORT" to "X-Forwarded-By" | |
| header change "Connection" to "close" | |
| header change "X-Forwarded-Proto" to "https" | |
| header change "X-Forwarded-SSL" to "on" | |
| ssl { sslv3, tlsv1, ciphers "HIGH:!ADH", no sslv2 } | |
| } | |
| relay rips_lhttps_prod_rws_relay { | |
| listen on $rips_lhttps_prod_rws_addr port $rips_lhttps_prod_rws_port ssl | |
| protocol "rips_lhttps_prod_rws_filter" | |
| forward to <rips_lhttps_prod_rws_backend_hosts> port $rips_lhttps_prod_rws_backend_port mode roundrobin check http "/health" host rips.ridecharge.com code 301 timeout 5000 | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment