java
step 1 打包
Maven
clean package -DskipTests -Dmaven.javadoc.skip=true
step 2 上传jar到服务器
SSH Upload
# root 用户上传会上传到 /root/test ,其他用户会上传到 /home/其他/test
%teamcity.build.workingDir%/target/jar名 => /test
step 3 运行jar
SSH Exec
# 1. 移动上传上来的jar 到指定的目录去
mv /root/test/imicams-kdp-1.0-SNAPSHOT.jar /home/detabes/softwares/imicams/java/
# 2. 进入指定的目录
cd /home/detabes/softwares/imicams/java/
# 3. 将jar备个份
cp imicams-kdp-1.0-SNAPSHOT.jar imicams-kdp-1.0-SNAPSHOT.jar-%build.number%
# 4. 启动前先 kill
kill -9 $(ps -ef|grep imicams-kdp-1.0-SNAPSHOT.jar|gawk '$0 !~/grep/ {print $2}' |tr -s '\n' ' ')
# 5. 启动jar
nohup java -jar -Xms512m -Xmx1024m -Xmn1024m -XX:+UseParallelGC -XX:+UseParallelOldGC imicams-kdp-1.0-SNAPSHOT.jar --server.port=9006 --spring.profiles.active=183 >/dev/null 2>&1 &
vue
step 1 npm install
Command Line (windows)
npm install --registry=https://registry.npm.taobao.org
step 2 npm run build
Command Line
npm run build
step 3 上传管理端页面到服务器
SSH Upload
# # root 用户上传会上传到 /root/test/imicams/dist/ ,其他用户会上传到 /home/其他/test/imicams/dist/
%teamcity.build.workingDir%/dist/** => /test/imicams/dist/
step 4 移动到指定目录
SSH Exec
# 1. 移动上传上来的html 到指定的目录去
cp -rf /home/cwwa//test/lib/dist/** /home/cwwa/nginx/html/lib/dist/
# 2, 备个份
cp -r /home/cwwa/nginx/html/lib/ /home/cwwa/nginx/html/lib-%teamcity.build.id%
# 3. 给nginx目录一个权限(可选
chmod -R 777 /home/cwwa/nginx/
JAVA Docker
step 1 打包
Maven
clean package -DskipTests -Dmaven.javadoc.skip=true
step 2 docker 打包
构建镜像(maven打包时会构建) ,随意此处可以忽略
step 3 上传阿里云私服
PowerShell
# 登录私服 在命令端登录没有用,必须在这儿登录
docker login --username=账户 --password=密码 registry.cn-hangzhou.aliyuncs.com
# 开始上传
docker tag detabes/resource_library:latest registry.cn-hangzhou.aliyuncs.com/detabes/resource_library:latest
docker tag detabes/resource_library:latest registry.cn-hangzhou.aliyuncs.com/detabes/resource_library:%build.number%-teamcity
docker push registry.cn-hangzhou.aliyuncs.com/detabes/resource_library:latest
docker push registry.cn-hangzhou.aliyuncs.com/detabes/resource_library:%build.number%-teamcity
step 4 启动项目
SSH Exec
cd /home/cwwa
echo "sudo时可能会出现输入密码这里就时填的密码" | sudo -S docker stop library
echo "sudo时可能会出现输入密码这里就时填的密码" | sudo -S docker rm library
echo "sudo时可能会出现输入密码这里就时填的密码" | sudo -S docker rmi $(docker images -q --filter reference=registry.cn-hangzhou.aliyuncs.com/detabes/resource_library:latest)
# # 登录私服 在命令端登录没有用,必须在这儿登录
echo "sudo时可能会出现输入密码这里就时填的密码" | sudo -S docker login --username=账户 --password=密码 registry.cn-hangzhou.aliyuncs.com
echo "sudo时可能会出现输入密码这里就时填的密码" | sudo -S docker-compose -f docker-compose-jar.yml -p library up -d