参考发布文档
内测阶段-全新环境自动化部署
- 测试域名:test2.*.dajxyl.com
- https://test2.admin.dajxyl.com
- root/root123.
- https://test2.api.dajxyl.com
- https://test2.staffapi.dajxyl.com
- 测试环境信息
- centos6.9
- 1cpu、1Gmemory、40G
- 执行安装脚本main.sh
- 测试使用代码节点记录如下:
测试节点信息:
]# cd /home/www;for i in biglove-cms biglove-home biglove-workerman dajx-api dajx-staff-api;do cd $i;echo "################`pwd`#############";git status;git log -1;cd ->/dev/null;done
################/home/www/biglove-cms#############
# On branch sprint5
nothing to commit (working directory clean)
commit 3c4a2670f7dd1378bd726d9afa300f70c7527530
Author: zxd <214905904@qq.com>
Date: Wed Sep 16 11:48:28 2020 +0800
压缩包二维码下载
################/home/www/biglove-home#############
# On branch master
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# home/__localDb.php
# home/__localDb2.php
# home/__params.php
nothing added to commit but untracked files present (use "git add" to track)
commit 75269f0061b1d0d16b74eed828d3cebdf35a2685
Merge: 9d2e0ea 04a6c49
Author: hcg <532508307@qq.com>
Date: Fri Aug 14 18:48:43 2020 +0800
Merge branch 'hcg'
################/home/www/biglove-workerman#############
# On branch master
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# vendor/workerman/_home_www_biglove-workerman_start.php.pid
nothing added to commit but untracked files present (use "git add" to track)
commit b5214181c17235e48e04be686b3734156941f571
Author: hcg <532508307@qq.com>
Date: Mon Sep 14 18:37:51 2020 +0800
[提交任务]任务编号234:CMS系统提示信息进行优化
################/home/www/dajx-api#############
# On branch sprint5
# Changed but not updated:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: web/common.php
#
no changes added to commit (use "git add" and/or "git commit -a")
commit fbafab3783a00014d0a745ee92026302363b4b03
Author: hcg <532508307@qq.com>
Date: Wed Sep 16 10:23:32 2020 +0800
[SQL变更]
################/home/www/dajx-staff-api#############
# On branch master
nothing to commit (working directory clean)
commit 1532d3337a2ad8ca063a658766cc56c5fb1c9bb1
Merge: f60a9ce f7207a4
Author: hcg <532508307@qq.com>
Date: Sun Sep 13 16:42:19 2020 +0800
Merge remote-tracking branch 'origin/sprint5' into sprint5
Pre环境发布步骤
Pre环境基于线上环境的镜像增量更新,增量更新步骤如下:
更新脚本内容如下
- 增量更新步骤:
- 上传letsencrypt.pre.tar.gz(pre域名证书)
- vi preUpdateSprint5.sh #(添加如下内容)
- bash preUpdateSprint5.sh
#!/bin/bash
cd `dirname $0`
currentPath=`pwd`
#pull dajx-api and biglove-cms
cd /home/www/dajx-api
rm -f web/dayyl-staff.apk
rm -f web/download
rm -f web/staff_1.0.3.apk
git checkout sprint5
git pull
git checkout sprint5
#git status;git log -1
cd /home/www/biglove-cms
git checkout sprint5
git reset --hard origin/sprint5
#git status;git log -1
cd /home/www/biglove-workerman
php start.php stop
sleep 2
git checkout master
git pull
sleep 2
php start.php start -d
#git status;git log -1
cd /home/www/dajx-staff-api
git checkout sprint5
git pull
git checkout sprint5
#insert hcg_update_sql && zxd_update_sql
for i in /home/www/dajx-api/documents/hcg_update.sql /home/www/dajx-api/documents/zxd_update.sql /home/www/biglove-cms/sql/hcg-update.sql
do
[ ! -e $i ] && echo "ERROR: $i not exist."&&exit 2
done
mysql -u root -proot <<ENDTAG
use dajx-api;
source /home/www/dajx-api/documents/hcg_update.sql;
source /home/www/dajx-api/documents/zxd_update.sql;
use biglove;
source /home/www/biglove-cms/sql/hcg-update.sql;
ENDTAG
# execlude sql
mysql -uroot -proot -e "USE biglove;UPDATE admin SET password='203aeace9b9ed0b1a79ae1641d556b29' WHERE id=1;GRANT SELECT ON *.* TO reader@'%' IDENTIFIED BY 'reader.';use dajx-api;UPDATE \`sys_config\` SET \`value\`='https://pre.api.dajxyl.com/html/page?&view=coupon' where \`key\`='share_url';"
# add crond
echo -e '##Create by HCG for auto end Promotions##\n*/2 * * * * root curl https://pre.api.dajxyl.com/service/auto-end-service-promotion\n####'>>/etc/crontab
service crond restart
#create invtation code
cd /home/www/dajx-api
php yii user-invite/create-invite-code
#extra exclude
cd $currentPath
tar xf letsencrypt.pre.tar.gz -C /etc/
# é¨ç½²ç¯å¢å称
deployment=dajxdocs
# docs ç¸å³
front_host=docs.dajxyl.com
gogs_host=docs.dajxyl.com
es_host=es.uninote.com.cn
es_index=dajxdocs
# dajx ç¸å³
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
# pre 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
cd /home/www;for i in `ls |grep -Ev "additional_item|dajx-apibak|wwwlogs"`;do echo -e "\033[031m$i\033[0m";cd $i ;git log -1 --oneline; git status; cd ..;done
#
配置文件对比
pre环境回退
- sql回退
use dajx-api ;
delete from `menu where` `id` in(300,400,500,600,508,504,503,505,501,404,301);
delete from `sys_config` where `key`='share_url';
- 代码回退
biglove-cms
dbfc863 [修复BUG]BUG编号254: 点击导出按钮,报页面错误
# On branch sprint5
# Your branch and 'origin/sprint5' have diverged,
# and have 4 and 26 different commit(s) each, respectively.
#
nothing to commit (working directory clean)
biglove-workerman
dc5239e 【更新】- 用药提醒sql语句有问题 修复
# On branch master
# Your branch is behind 'origin/master' by 6 commits, and can be fast-forwarded.
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# vendor/workerman/_home_www_biglove-workerman_start.php.pid
nothing added to commit but untracked files present (use "git add" to track)
dajx-api
3e1714f [BUG修复]BUG编号255:优惠券使用说明 有错别字,‘权限’应改为’仅限‘
# On branch sprint5
# Your branch and 'origin/sprint5' have diverged,
# and have 1 and 41 different commit(s) each, respectively.
#
nothing to commit (working directory clean)
dajx-staff-api
dea29ac 【bug】- 修复订单状态 多人派单 一个人完成服务 一个人待接单 状态显示不正确的问题
# On branch sprint5
# Your branch is behind 'origin/sprint5' by 18 commits, and can be fast-forwarded.
#
nothing to commit (working directory clean)
- 恢复更新
msql -uroot -p
use dajx-api
INSERT INTO `dajx-api`.`menu` (`id`, `pid`, `title`, `icon`, `payload`, `time`, `update_time`, `type`, `status`, `sort`, `remarks`) VALUES ('300', '66', '随机免单', '', '/admin/free_order/index.html', '2020-08-27 14:08:59', '2020-08-28 14:50:07', '1', '1', '0', NULL);
INSERT INTO `dajx-api`.`menu` (`id`, `pid`, `title`, `icon`, `payload`, `time`, `update_time`, `type`, `status`, `sort`, `remarks`) VALUES ('400', '66', '开关日志', '', '/admin/free_order/freeOrderLog.html', '2020-08-28 14:49:27', '2020-08-28 14:54:58', '1', '1', '0', NULL);
INSERT INTO `dajx-api`.`menu` (`id`, `pid`, `title`, `icon`, `payload`, `time`, `update_time`, `type`, `status`, `sort`, `remarks`) VALUES ('500', '66', '促销活动', '', '/admin/service_promotion/index.html', '2020-08-28 14:49:27', '2020-08-28 14:54:58', '1', '1', '0', NULL);
INSERT INTO `dajx-api`.`menu` (`id`, `pid`, `title`, `icon`, `payload`, `time`, `update_time`, `type`, `status`, `sort`, `remarks`) VALUES ('600', '66', '免单日志', '', '/admin/free_order/orderFree.html', '2020-08-28 14:49:27', '2020-08-28 14:54:58', '1', '1', '0', NULL);
INSERT INTO `menu` VALUES (508, 504, '提现审核', '', '/admin/wallet/withdraw.html', '2020-06-10 10:54:16', '2020-06-19 15:42:08', 1, 1, 0, '');
INSERT INTO `menu` VALUES (505, 504, '钱包列表', '', '/admin/wallet/index.html', '2020-06-10 10:54:16', '2020-06-19 15:42:08', 1, 1, 0, '');
INSERT INTO `menu` VALUES (504, 0, '钱包管理', '', 'javascript:void(0)', '2020-06-10 10:54:16', '2020-06-19 15:42:08', 1, 1, 0, '');
INSERT INTO `menu` VALUES (503, 0, '邀请日志', '', '/admin/invite_logs/index.html', '2020-06-10 10:54:16', '2020-06-19 15:42:08', 1, 1, 0, '');
INSERT INTO `menu` VALUES (501, 0, '邀请赠送管理', '', '/admin/invite_reward_setting/index.html', '2020-06-10 10:54:16', '2020-06-19 15:42:08', 1, 1, 0, '');
INSERT INTO `menu` VALUES (404, 0, '返佣管理', '', '/admin/reward_setting/index.html', '2020-06-10 10:54:16', '2020-06-19 15:42:08', 1, 1, 0, '');
INSERT INTO `menu` VALUES (301, 0, '海报分享管理', '', '/admin/postershare/index.html', '2020-06-10 10:54:16', '2020-06-19 15:42:08', 1, 1, 0, '');
INSERT INTO `sys_config` (`id`, `key`, `value`, `time`, `status`) VALUES (NULL, 'share_url', 'https://dev.api.dajxyl.com/html/page?&view=coupon', CURRENT_TIMESTAMP, '1');
--
online环境发布
- 增量更新步骤:
- vi onlineUpdateSprint5.sh #(添加如下内容)
- bash onlineUpdateSprint5.sh
#!/bin/bash
cd `dirname $0`
currentPath=`pwd`
#pull dajx-api and biglove-cms
cd /home/www/dajx-api
rm -f web/dayyl-staff.apk
rm -f web/download
rm -f web/staff_1.0.3.apk
git checkout sprint5
git pull
git checkout sprint5
#git status;git log -1
cd /home/www/biglove-cms
git pull
git checkout sprint5
git reset --hard origin/sprint5
#git status;git log -1
cd /home/www/biglove-workerman
php start.php stop
sleep 2
git pull
git checkout master
sleep 2
php start.php start -d
#git status;git log -1
cd /home/www/dajx-staff-api
git pull
git checkout sprint5
#insert hcg_update_sql && zxd_update_sql
for i in /home/www/dajx-api/documents/hcg_update.sql /home/www/dajx-api/documents/zxd_update.sql /home/www/biglove-cms/sql/hcg-update.sql
do
[ ! -e $i ] && echo "PULL ERROR: $i not exist."&&exit 2
done
mysql -u root -proot <<ENDTAG
use dajx-api;
source /home/www/dajx-api/documents/hcg_update.sql;
source /home/www/dajx-api/documents/zxd_update.sql;
use biglove;
source /home/www/biglove-cms/sql/hcg-update.sql;
ENDTAG
# execlude sql
mysql -uroot -proot -e "use dajx-api;UPDATE \`sys_config\` SET \`value\`='https://api.dajxyl.com/html/page?&view=coupon' where \`key\`='share_url';"
# add crond
echo -e '##Create by HCG for auto end Promotions##\n*/2 * * * * root curl https://api.dajxyl.com/service/auto-end-service-promotion\n####'>>/etc/crontab
service crond restart
#create invtation code
cd /home/www/dajx-api
php yii user-invite/create-invite-code
# pre 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 online root
cd /home/www;for i in `ls |grep -Ev "additional_item|dajx-apibak|wwwlogs"`;do echo -e "\033[031m$i\033[0m";cd $i ;git log -1 --oneline; git status; cd ..;done
#
部署sos项目
/root/init/certbot-auto certonly --webroot --no-self-upgrade -w /tmp -d m.dajxyl.com
#nginx配置
配置文件比对
安装测试
上传APK
- 路径为项目download/
- 给运营人员正式包,更新应用市场
online更新信息
online-1.3.1
- dajx-api项目更新
- 操作步骤:
cd /home/www/dajx-api
git pull
- 更新结果:
git status;git log -1
# On branch sprint5
nothing to commit (working directory clean)
commit 143ed7fd0398791b62d6bee6e36b460198e616c4
Author: hcg <532508307@qq.com>
Date: Wed Sep 23 09:23:31 2020 +0800
[提交任务]任务编号272: 修改领取优惠券H5页面的活动时间
http://zentao.dajxyl.com/zentao/task-view-272.html
online-1.3.2
- dajx-api项目更新
- 操作步骤:
cd /home/www/dajx-api
git pull
- 更新结果:
git status; git log -1
# On branch sprint5
nothing to commit (working directory clean)
commit 9df14950be39e4ff41fff5344a4dd7b1c4515549
Author: hcg <532508307@qq.com>
Date: Wed Sep 23 11:01:36 2020 +0800
[BUG修复]BUG编号312: 获取首页促销服务列表接口,增加显示全国,隐藏对应城市的逻辑
http://zentao.dajxyl.com/zentao/bug-view-312.html
测试范围:小程序首页展示促销服务的列表展示是否有误
####online-用户协议更新
cd /home/www/biglove-cms
git pull
[root@dajx-online biglove-cms]# git status
# On branch sprint5
nothing to commit (working directory clean)
[root@dajx-online biglove-cms]# git log -1
commit 4b8f77d1265c36a2871863ed988880f7b9492ca5
Author: eson <834767372@qq.com>
Date: Fri Sep 25 10:12:40 2020 +0800
【更新】- 用户端隐私协议
[root@dajx-online biglove-cms]#