4.syncd项目管理篇2

  1. 部署前指令(直接copy过去,改username参数的值):
1
2
3
4
username=zdmprd \
    && syncd_deploy_path="/home/$username/deploy" \
    && rm -rf $syncd_deploy_path \
    && mkdir $syncd_deploy_path
  1. 部署后执行(直接copy,改username、module_name、action_profile、version的值)
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
username=zdmprd \
    && module_name="trial-bottal-activity" \
    && active_profile=prod1 \
    && version="1.0-SNAPSHOT" \
    && syncd_deploy_path="/home/$username/deploy" \
    && platform_base="/home/$username/deploy_$active_profile" \
    && platform_home=$platform_base/$module_name \
    && mkdir -p $platform_home \
    && sudo rsync -avz --delete --exclude "logs/" $syncd_deploy_path/ $platform_home \
    && cd $platform_home \
    && sudo sh/start_service.sh $module_name $version $platform_home $active_profile
  1. 构建脚本(直接copy过去,改module_name参数的值)
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
module_name="promotion-api"
 
 
package_base="/home/zdmprd/DeployTools/package"
package_path=$package_base/$module_name
 
cd ${env_workspace}
 
mvn package -Dmaven.test.skip=true
 
# 如果master上存放的构建后项目目录结构的文件夹不存在则创建它
if [ ! -d $package_path ];then
    cp -r $package_base/template/ $package_path
fi
 
 
rsync -avz $module_name/target/lib $package_path
rsync -avz $module_name/target/classes/config $package_path
rsync -avx $module_name/target/*.jar $package_path
 
cd $package_path
tar -zcvf ${env_pack_file} *