Simulating a Web cluster
Back-end Web clusters 192.168.1.231:8080 and 192.168.1.232:8080.web backend can be increased as needed, different directories start different ports, by using 192.168.1.231:80 as load balancer access.
upstream www.front.com{ server 192.168.1.232:8080; server 192.168.1.231:8080;}server{ listen 80; server_name 192.168.1.231; location / { proxy_pass http://www.front.com; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; }}
SVN Auto Release
When using SVN commit, enter "Auto_deploy" in the comment and automatically publish to 231,232 of the project test server. SVN hook file Post-commit
#!/bin/bashREPOS="$1"REV="$2"if ( svnlook log -r $REV /data/www/svn/gtl/ |grep "auto_deploy" )then echo "`date` auto_deploy">> /tmp/testsvn.log#front1 ssh [email protected] ‘svn update /data/wwwroot/gtl/ --username "sylar" --password "gtl1023"‘ ssh [email protected] ‘chown www.www -R /data/wwwroot/gtl‘#front2 ssh [email protected] ‘svn update /data/wwwroot/gtl/ --username "sylar" --password "gtl1023"‘ ssh [email protected] ‘chown www.www -R /data/wwwroot/gtl‘#admin ssh [email protected] ‘svn update /data/wwwroot/admin/ --username "sylar" --password "gtl1023"‘ ssh [email protected] ‘chown www.www -R /data/wwwroot/admin‘fi
Another SVN hook, forcing SVN to enter a comment when committing
#!/bin/shREPOS="$1"TXN="$2"SVNLOOK=/usr/bin/svnlookLOGMSG=$($SVNLOOK log -t "$TXN" "$REPOS" | grep "[a-zA-Z0-9]" | wc -c)if [ "$LOGMSG" -lt 10 ]; thenecho -e "\n 提交文件时必须添加注释,提交中止."1>&2exit 1fi
Quickly build intranet test network, simple simulation of Web cluster