当前位置: 首页 > news >正文

东莞高埗网站建设大连网站建设 仟亿

东莞高埗网站建设,大连网站建设 仟亿,为什么浙江建设厅网站,如何创建链接背景 远程部署时spring boot 包&#xff0c;比较大。可以采用依赖库和业务包分离的方式。提供一个脚本进行自动部署 maven 配置分离jar包 <build><finalName>${project.artifactId}</finalName><plugins><plugin><groupId>org.springfra…

背景

远程部署时spring boot 包,比较大。可以采用依赖库和业务包分离的方式。提供一个脚本进行自动部署

maven 配置分离jar包

 <build><finalName>${project.artifactId}</finalName><plugins><plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId><version>${spring-boot.version}</version><configuration><!-- 导入系统路径包 --><includeSystemScope>true</includeSystemScope><includes><include><groupId>nothing</groupId><artifactId>nothing</artifactId></include></includes></configuration></plugin><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-jar-plugin</artifactId><configuration><archive><!-- 生成的jar中不要包含pom.xml和pom.properties这两个文件 --><addMavenDescriptor>false</addMavenDescriptor><manifest><addClasspath>true</addClasspath><classpathPrefix>lib/</classpathPrefix><!--这里需要修改为你的项目的主启动类--><mainClass>com.ruoyi.RuoYiApplication</mainClass></manifest></archive></configuration></plugin><!--设置将 lib 拷贝到应用 Jar 外面--><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-dependency-plugin</artifactId><executions><execution><id>copy-lib</id><phase>package</phase><goals><goal>copy-dependencies</goal></goals><configuration><outputDirectory>target/lib</outputDirectory><excludeTransitive>false</excludeTransitive><stripVersion>false</stripVersion><includeScope>runtime</includeScope></configuration></execution></executions></plugin></plugins></build>

部署脚本

#!/bin/bashAppName="smart_engineering_admin.jar"
RemoteUser="root"
RemoteHost="xxx.xxx.xxx.xxx"
JVM_OPTS=" -Dloader.path=smart_engineering/lib -Dserver.port=8080 -Dname=$AppName  -Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8 -Duser.timezone=Asia/Shanghai -Xms512m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError -XX:+PrintGCDateStamps  -XX:+PrintGCDetails -XX:NewRatio=1 -XX:SurvivorRatio=30 -XX:+UseParallelGC -XX:+UseParallelOldGC"start() {echo "Starting $AppName on $RemoteHost"# 定义一个内嵌的函数来远程查询 PIDquery() {ssh "${RemoteUser}@${RemoteHost}" "ps -ef | grep java | grep '$AppName' | grep -v grep | awk '{print \$2}'"}# 获取远程进程 IDPID=$(query)if [ -n "$PID" ]; thenecho "$AppName is already running on $RemoteHost (pid: $PID)..."elseecho "Starting $AppName on $RemoteHost..."ssh "${RemoteUser}@${RemoteHost}" "nohup java $JVM_OPTS -jar smart_engineering/$AppName > /dev/null 2>&1 &"echo "$AppName started successfully on $RemoteHost."ssh "${RemoteUser}@${RemoteHost}" "tail -f logs/sys-console.log"fi
}sync() {rsync -avc --delete ruoyi-admin/target/lib/ root@140.143.209.33:smart_engineering/libscp ruoyi-admin/target/smart_engineering_admin.jar root@140.143.209.33:smart_engineering/
}stop() {echo "Stopping $AppName on $RemoteHost"# 定义一个内嵌的函数来远程查询 PIDquery() {ssh "${RemoteUser}@${RemoteHost}" "ps -ef | grep java | grep '$AppName' | grep -v grep | awk '{print \$2}'"}# 获取进程 IDPID=$(query)if [ -n "$PID" ]; thenecho "$AppName (pid:$PID) is running. Sending TERM signal..."ssh "${RemoteUser}@${RemoteHost}" "kill -TERM $PID"# 等待进程退出while [ -n "$PID" ]; dosleep 1PID=$(query)doneecho "$AppName has exited."elseecho "$AppName is already stopped."fi
}sync
stop
sleep 2
start
  • 优点
    • 依赖包不变化不会同步,减少上传的文件
    • 每次都同步业务包,保证准确性
    • 提升发布速度

要求

  • windows 的wsl下可用
  • 需要和服务器配置ssh互信

进一步封装

#!/bin/bash./mvnw -T 1C clean package -P prod./push_run.sh
http://www.15wanjia.com/news/176036.html

相关文章:

  • 宁夏网站开发设计说明书wordpress1003无标题
  • asp网站开发开题报告汶上网站制作
  • 济南历城区网站建设简述网络营销策略
  • 优化网站结构人像摄影网站有哪些
  • asp网站加速考试类网站如何做
  • 深圳手机网站建设公司seo是干什么的
  • 来年做哪些网站致富wordpress 签到 排行
  • 柳州网站建设工作室各大网站博客怎么做推广
  • 做招聘网站的风投科技创新的重要前沿是
  • 廊坊市网站亚马逊雨林动物大全
  • 做网站标题图片大小西安短视频制作
  • 免备案手机网站哈尔滨建设鞋城
  • 服务专业的网络建站公司企业网站建设视频
  • 多用户建站系统源码抖音小程序定制
  • 如何在720云网站做全景视频下载wordpress pckr
  • 苏州室内设计学校360优化大师最新版
  • 做企业网站建设公司哪家好重庆市建设工程信息网文件打不开
  • 西安做网站 怎样备案网站制作应该注意到的问题
  • 中企动力做网站好吗wordpress 创建表
  • 比较好的源码网站北京 网站建设大全
  • 站酷网素材图库免费下载韩国网站never
  • 如何自学建网站关闭网站需要多久
  • 济宁建设公司网站商城网站做推广方案
  • 高端网站建设哪里好许昌做网站联系电话
  • 内蒙古建设厅门户网站做个网站费用多少合适
  • 菏泽手机网站建设备案后可以修改网站吗
  • 怎么用小旋风网站建设教程俄罗斯女孩制作论文网站
  • 自己做视频网站 在优酷推广什么直播可以做游戏视频网站
  • 电子商务网站后台模板东莞外贸优化公司
  • 网站规划与建设与安全管理asp网站模板下载