东⽅通TongWeb远程调试相关脚本
由于IDEA未集成TongWeb,⽽且TongWeb在我本地使⽤⾼版本的Oracle JDK,及OpenJDK启动失败(⽬前测试仅Oracle JDK 8u251可正常启动,其他低版本未试。)
遂直接使⽤同事制作好的docker镜像,开启5005远程调试端⼝调试(需在TongWeb启动后进⼊ “启动参数配置 - 其他jvm参数” 添加 “-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005” 使⽤,参数添加完毕重启容器⽣效)
相关脚本如下,配合Alibaba Cloud Toolkit插件实现zip包上传⾃动解包,修改配置,⼿动执⾏restart_tongweb.sh脚本重启容器操作
unpackage.sh(解压缩zip包并修改配置⽂件)
#!/bin/bash
dir=/opt/tongweb/webapps
cd $dir
if [ -f "$dir/admin_war_exploded.zip" ]; then
unzip admin_war_exploded.zip
rm -rf admin
mv admin_war_exploded admin
sed -i 's/192.168.36.107:8080/172.16.249.64:8088/g' $dir/admin/l
sed -i 's/192.168.36.107:8080/172.16.249.64:8088/g' $dir/admin/WEB-INF/classes/config.properties
fi
cd $dir
if [ -f "$dir/portal_war_exploded.zip" ]; then
unzip portal_war_exploded.zip
rm -rf portal
mv portal_war_exploded portal
sed -i 's/192.168.36.107:8080/172.16.249.64:8088/g' $dir/portal/l
sed -i 's/192.168.36.107:8080/172.16.249.64:8088/g' $dir/portal/WEB-INF/classes/config.properties
fi
redeploy_tongweb.sh(重新部署TongWeb,重新部署后需重新添加jvm远程调试参数)当前页面脚本发生错误
#!/bin/bash
docker rm -fv tongweb
docker run -d --name tongweb \
-p 9060:9060 \
-p 8088:8088 \
-p 5005:5005 \
-v /opt/tongweb/lib/tongweb.jar:/srv/tongweb7/tongweb7/lib/tongweb.jar \
-
v /opt/tongweb/l:/srv/tongweb7/tongweb7/l \
-v /opt/tongweb/webapps:/srv/webapps \
tongweb:7 && docker logs -f tongweb
restart_tongweb.sh(清除⽇志并重启TongWeb)
#!/bin/bash
name=tongweb
id=$(docker inspect -f {{.Id}} $name)
echo"" > /var/lib/docker/containers/$id/$id-json.log
docker restart $name
docker logs -f $name