1、创建项目分支
function create_branch
{
svn cp -m "create branch $SVN_BRANCH"项目svn地址/$SVN_BRANCH
}
2、部署分支环境
function up_file
{
cd /data/wwwroot/xiaoe_admin
svn checkout svn地址/$SVN_BRANCH
chown -R www:www $SVN_BRANCH
}
up_file
function config_nginx
{
if [ -f "/usr/local/nginx/conf/vhost/$SVN_BRANCH.conf" ];then
echo 'nginx conf file is exist '$SVN_BRANCH''
else
echo 'server {
listen '$PORT';
server_name localhost;
index index.html index.htm index.php;
set $rootdir 项目路径/'$SVN_BRANCH'/public;
include version_type/version_type.conf;
root $rootdir;
if ($server_port = 80)
{
return 301 https://$server_name$request_uri;
}
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ .*\.(php|php5)?$
{
fastcgi_pass unix:/dev/shm/php-cgi-h5.sock;
fastcgi_index index.php;
fastcgi_param APP_ENV development;
include fastcgi.conf;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|svg)$
{
#expires 30d;
access_log off;
}
location ~ .*\.(js|css)?$
{
#expires 10s;
access_log off;
}
access_log /data/wwwlogs/access.'$SVN_BRANCH'.log main;
error_log /data/wwwlogs/error.'$SVN_BRANCH'.log;
}' > /usr/local/nginx/conf/vhost/$SVN_BRANCH.conf
echo "done nginx conf"
/usr/local/nginx/sbin/nginx -s reload
fi
cat /usr/local/nginx/conf/vhost/$SVN_BRANCH.conf
job_success config_nginx
}
config_nginx