Last active
August 29, 2015 14:27
-
-
Save leafsummer/d0c2378b96aa052fd327 to your computer and use it in GitHub Desktop.
front web deploy script
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 | |
#celery web deploy | |
####################错误敏感#################### | |
set -e | |
####################参数个数校验、获取入参#################### | |
if [ $# != 1 ] ; then | |
echo -e "arguments number error" | |
exit 1; | |
fi | |
API_ADDRESS=$1 | |
####################svn操作#################### | |
NGINX_CONF=/opt/disk2/var/serverconfig/www-nginx.conf | |
SVN_USERNAME="" | |
SVN_PASSWORD="" | |
CELERY_WEB_SVN=https://192.168.5.246/svn/cloud/trunk/html/management_web | |
WEB_PROJECT_DIR=/opt/disk2/var/www | |
####################配置文件修改,使用sed操作#################### | |
sed -i -e "/uwsgi_pass\s\+127.0.0.1:9001;/d" $NGINX_CONF | |
sed -i -e "/include\s\+uwsgi_params;/d" $NGINX_CONF | |
sed -i -e "/location ^~ \/choi_wan_api\//,+6d" $NGINX_CONF | |
sed -i -e "/location\s\+\/media/i location ^~ /choi_wan_api/ {\n proxy_pass http://$API_ADDRESS:80;\n proxy_set_header Host \$host;\n proxy_set_header X-Real-IP \$remote_addr;\n proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;\n proxy_redirect off;\n}" $NGINX_CONF | |
echo "change config successfully" | |
rm -rf $WEB_PROJECT_DIR | |
svn co $CELERY_WEB_SVN $WEB_PROJECT_DIR --username $SVN_USERNAME --password $SVN_PASSWORD --no-auth-cache --quiet <<EOF | |
t | |
EOF | |
####################启动服务#################### | |
/etc/init.d/nginx restart | |
echo "choi-wan web start successfully" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment