发布来源
pre环境发布
#!/bin/bash
cd `dirname $0`
currentPath=`pwd`
cd /home/www/biglove-workerman
git fetch --all
git pull
cd /home/www/dajx-api
git fetch --all
git checkout sprint8
git pull
cd /home/www/biglove-cms
git fetch --all
git checkout sprint8
git pull
cd /home/www/dajx-staff-api
git fetch --all
git pull
git checkout sprint8
cd /home/www/biglove-home
git fetch --all
git pull
git checkout master
mysql -u root -proot <<ENDTAG
use dajx-api;
source /home/www/dajx-api/documents/hcg_update.sql;
source /home/www/dajx-api/documents/lex_update.sql;
use biglove;
source /home/www/biglove-cms/sql/hcg-update.sql;
use dajx-ow;
source /home/www/biglove-home/home/data/sql/update.sql;
ENDTAG
mysql -uroot -proot -e 'use biglove;INSERT INTO `access` (`pid`, `title`, `urls`) VALUES ('0', '推荐套餐开关', '/admin/combo/recommend.html');INSERT INTO `access` (`pid`, `title`, `urls`) VALUES ('0', '套餐排序', '/admin/combo/sort.html');'
cd $currentPath
tar xf letsencrypt.pre.tar.gz -C /etc/
dajx_api_host=pre.api.dajxyl.com
dajx_staff_api_host=pre.staffapi.dajxyl.com
dajx_cms_host=pre.admin.dajxyl.com
dajx_www_host=pre.www.dajxyl.com
front_host=$dajx_api_host
gt_api=dajx_api_pre_
gt_staffapi=dajx_staff_api_pre_
sed -i "s#https://staffapi.dajxyl.com#https://$dajx_staff_api_host#" /home/www/additional_item/logviewer/logs.php
sed -i "s#https://api.dajxyl.com#https://$dajx_api_host#" /home/www/additional_item/logviewer/logs.php
sed -i "s#https://api.dajxyl.com#https://$dajx_api_host#g" /home/www/biglove-cms/cms/config/__params.php
sed -i "s#https://staffapi.dajxyl.com#https://$dajx_staff_api_host#g" /home/www/biglove-cms/cms/config/__params.php
sed -i "s#dajx_api_#$gt_api#g" /home/www/biglove-cms/cms/config/__params.php
sed -i "s#dajx_staff_#$gt_staffapi#g" /home/www/biglove-cms/cms/config/__params.php
sed -i "s#/live/admin.dajxyl.com#/live/$dajx_cms_host#" /home/www/biglove-workerman/Config/__config.php
sed -i "s#dajx_staff_api_#$gt_staffapi#" /home/www/biglove-workerman/Config/__config.php
sed -i "s#dajx_api_#$gt_api#" /home/www/biglove-workerman/Config/__config.php
sed -i "s#staffapi.dajxyl.com#$dajx_staff_api_host#g" /home/www/dajx-staff-api/config/__params.php
sed -i "s#dajx_staff_api_#$gt_staffapi#g" /home/www/dajx-staff-api/config/__params.php
sed -i "s#dajx_api_#$gt_api#g" /home/www/dajx-staff-api/config/__params.php
sed -i "s#https://www.dajxyl.com/#https://$dajx_www_host/#" /home/www/dajx-api/config/__params.php
sed -i "s#dajx_staff_api_#$gt_staffapi#g" /home/www/dajx-api/config/__params.php
sed -i "s#dajx_staff_#$gt_staffapi#g" /home/www/dajx-api/config/__params.php
sed -i "s#https://api.dajxyl.com#https://$dajx_api_host#g" /home/www/dajx-api/config/__params.php
sed -i "s#live/api.dajxyl.com#live/$dajx_api_host#g" /usr/local/nginx/conf/vhost/dajx_api_ssl.conf
sed -i "s#server_name api.dajxyl.com#server_name $dajx_api_host#g" /usr/local/nginx/conf/vhost/dajx_api_ssl.conf
sed -i "s#server_name admin.dajxyl.com#server_name $dajx_cms_host#g" /usr/local/nginx/conf/vhost/dajx_cms_ssl.conf
sed -i "s#live/admin.dajxyl.com#live/$dajx_cms_host#g" /usr/local/nginx/conf/vhost/dajx_cms_ssl.conf
sed -i "s#server_name staffapi.dajxyl.com#server_name $dajx_staff_api_host#g" /usr/local/nginx/conf/vhost/dajx_staff_api_ssl.conf
sed -i "s#live/staffapi.dajxyl.com#live/$dajx_staff_api_host#g" /usr/local/nginx/conf/vhost/dajx_staff_api_ssl.conf
sed -i "s#server_name www.dajxyl.com#server_name $dajx_www_host#g" /usr/local/nginx/conf/vhost/dajx_www_ssl.conf
sed -i "s#live/www.dajxyl.com#live/$dajx_www_host#g" /usr/local/nginx/conf/vhost/dajx_www_ssl.conf
sed -i "s#https://www.dajxyl.com#https://$dajx_www_host#g" /usr/local/nginx/conf/vhost/dajx_www_ssl.conf
nginx -s reload
# test2 config dump to git
[ ! -d /server/scripts ] && mkdir -p /server/scripts
cd /server/scripts && rm -rf ./*
git clone git@git.dajxyl.com:dajx/prj-utils.git . && rm -rf .git
bash dumpconfig.sh pre root
pre回滚测试
cd /home/www/dajx-api ; git reset --hard c2aca9f2ad0241b3bbf8937a9f9475b713b6aecc
cd /home/www/dajx-staff-api ; git reset --hard 02de41a84e44eb2401a023d0e9f67e19c59b640c
cd /home/www/biglove-cms ; git reset --hard ecaed8c17f6081fd359a15156167803eed9d44cc
use dajx-api; update service set recommend=0;
use dajx-api; update menu set status=0 where id=1100;
online环境发布
#!/bin/bash
cd `dirname $0`
currentPath=`pwd`
cd /home/www/dajx-api
git fetch --all
git checkout sprint8
git pull
cd /home/www/biglove-cms
git fetch --all
git checkout sprint8
git pull
cd /home/www/dajx-staff-api
git fetch --all
git pull
git checkout sprint8
mysql -u root -proot <<ENDTAG
use dajx-api;
source /home/www/dajx-api/documents/hcg_update.sql;
source /home/www/dajx-api/documents/lex_update.sql;
use biglove;
source /home/www/biglove-cms/sql/hcg-update.sql;
ENDTAG
mysql -uroot -proot -e 'use biglove;INSERT INTO `access` (`pid`, `title`, `urls`) VALUES ('0', \'推荐套餐开关\', \'/admin/combo/recommend.html\');INSERT INTO `access` (`pid`, `title`, `urls`) VALUES (\'0\', \'套餐排序\', \'/admin/combo/sort.html\');'
# 配置文件导出
[ ! -d /server/scripts ] && mkdir -p /server/scripts
cd /server/scripts && rm -rf ./*
git clone git@git.dajxyl.com:dajx/prj-utils.git . && rm -rf .git
bash dumpconfig.sh online root
cd /home/www;for i in `ls |grep "dajx-api dajx-staff-api biglove-cms`;do echo -e "\033[031m$i\033[0m";cd $i ;git log -1 ; git status; cd ..;done
#
# 导入修改后的配置文件
bash importconfig.sh online onlie root
-
上传apk到正式环境
-
上传apk到三方平台审核
-
更新后检查
-
1.4.2优化
cd /home/www/dajx-api
git pull
php yii user-invite/reset-share-qrcode
mysql -uroot -p
use dajx-api;
UPDATE `sys_config` SET `value`='https://api.dajxyl.com/share/' WHERE (`id`='10') LIMIT 1;