shell脚本svn项目分支自动化部署

本文介绍了如何使用Shell脚本实现SVN项目分支的自动化部署,包括创建项目分支和配置部署分支环境的详细步骤。

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值