leafsummer
7/15/2015 - 8:49 AM

static web deploy shell

static web deploy shell

#!/bin/bash
#celery web deploy

NGINX_CONF=/opt/disk2/var/serverconfig/www-nginx.conf
SVN_USERNAME=""
SVN_PASSWORD=""
CELERY_WEB_SVN=""

WEB_PROJECT_DIR=/opt/disk2/var/www

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\s\+\/media/i location ^~ /choi_wan_api/ {\n      proxy_pass http://$1: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

rm -r $WEB_PROJECT_DIR/*

svn co $CELERY_WEB_SVN $WEB_PROJECT_DIR --username $SVN_USERNAME --password $SVN_PASSWORD -q --no-auth-cache 2>&1 <<EOF
t
EOF

cd WEB_PROJECT_DIR

sed -i -e ""

/etc/init.d/nginx restart