代码拉取完成,页面将自动刷新
同步操作将从 周晶/vanilla 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
#!/bin/sh
### BEGIN ###
# Author: idevz
# Since: 2016/04/09
# Description: Setup Vanilla DemoApp named vademo
### END ###
VANILLA_VERSION=0.1.0.rc5
VANILLA_VERSION_DIR_STR=0_1_0_rc
VANILLA_APP_ROOT=/data/vanilla/vademo
VANILLA_APP_USER=idevz
VANILLA_APP_GROUP=sina
VANILLA_RUNNING_ENV='' #default '' is for production environment
TIME_MARK=`date "+%Y_%m_%d_%H_%M_%S"`
PLATFORM=`uname`
ECHO_E=" -e "
[ $PLATFORM = "Darwin" ] && ECHO_E=""
alert()
{
MSG=$1
echo $ECHO_E"\033[31m$MSG \033[0m\n"
}
init_vanilla_app()
{
VANILLA_APP_ROOT=$1
echo $ECHO_E"\033[40mBegin init Vanilla App: $VANILLA_APP_ROOT \033[0m\n"
[ -n $2 ] && VANILLA_APP_USER=$2
[ -n $3 ] && VANILLA_APP_GROUP=$3
[ -n $4 ] && APP_NAME=$4
[ -n $5 ] && VANILLA_RUNNING_ENV=$5
SERVICE_SH=$VANILLA_APP_ROOT/va-$APP_NAME-service
VANILLA_BIN=/usr/local/bin/vanilla-$VANILLA_VERSION
[ -d $VANILLA_APP_ROOT ] && mv -f $VANILLA_APP_ROOT $VANILLA_APP_ROOT".old_"$TIME_MARK
[ -x $VANILLA_BIN ] && $VANILLA_BIN new $VANILLA_APP_ROOT
if [[ $? -ne 0 ]];then
alert $VANILLA_BIN" is not exist, You shoud install vanilla first, to see './setup-framework -h' for more info."
exit 1
fi
sed "s/#user zhoujing staff/user $VANILLA_APP_USER $VANILLA_APP_GROUP/" $VANILLA_APP_ROOT/nginx_conf/va-nginx-development.conf>$VANILLA_APP_ROOT/nginx_conf/va-nginx-development.conf.tmp
sed "s/#user zhoujing staff/user $VANILLA_APP_USER $VANILLA_APP_GROUP/" $VANILLA_APP_ROOT/nginx_conf/va-nginx.conf>$VANILLA_APP_ROOT/nginx_conf/va-nginx.conf.tmp
mv -f $VANILLA_APP_ROOT/nginx_conf/va-nginx-development.conf.tmp $VANILLA_APP_ROOT/nginx_conf/va-nginx-development.conf
mv -f $VANILLA_APP_ROOT/nginx_conf/va-nginx.conf.tmp $VANILLA_APP_ROOT/nginx_conf/va-nginx.conf
chmod +x $SERVICE_SH
sudo $SERVICE_SH initconf $VANILLA_RUNNING_ENV
sudo $SERVICE_SH start $VANILLA_RUNNING_ENV
sudo $SERVICE_SH restart $VANILLA_RUNNING_ENV
echo $ECHO_E"\033[40mVanilla App: $APP_NAME is running \033[0m\n"
}
show_usage()
{
echo $ECHO_E"`printf %-16s "Usage: $0"` -h show this help info"
echo $ECHO_E"`printf %-16s ` -a VANILLA_APP_ROOT, app absolute path(which path to init app)"
echo $ECHO_E"`printf %-16s ` -u VANILLA_APP_USER, user to run app"
echo $ECHO_E"`printf %-16s ` -g VANILLA_APP_GROUP, user group to run app"
echo $ECHO_E"`printf %-16s ` -e VANILLA_RUNNING_ENV, app running environment"
}
while getopts a:u:g:e:h OPT; do
case "$OPT" in
a )
VANILLA_APP_ROOT=$OPTARG
;;
u )
VANILLA_APP_USER=$OPTARG
;;
g )
VANILLA_APP_GROUP=$OPTARG
;;
e )
VANILLA_RUNNING_ENV=$OPTARG
;;
h )
show_usage && exit 0
;;
-- )
shift break
;;
? )
alert "ERROR: unknown argument!" && show_usage && exit 1
;;
esac
done
APP_NAME=`basename $VANILLA_APP_ROOT`
init_vanilla_app $VANILLA_APP_ROOT $VANILLA_APP_USER $VANILLA_APP_GROUP $APP_NAME $VANILLA_RUNNING_ENV
echo
echo $ECHO_E"You are setup $APP_NAME and using:"
echo $ECHO_E"`printf %-36s "\"$VANILLA_APP_ROOT\""` ---- as vanilla app root"
echo $ECHO_E"`printf %-36s "\"$VANILLA_RUNNING_ENV\""` ---- as running environment"
echo $ECHO_E"`printf %-36s "\"$VANILLA_APP_USER\""` ---- as vanilla app nginx user"
echo $ECHO_E"`printf %-36s "\"$VANILLA_APP_GROUP\""` ---- as vanilla app nginx group"
echo
exit 0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。