sofa-ark icon indicating copy to clipboard operation
sofa-ark copied to clipboard

add feature:embed嵌入模式支持静态合并部署

Open DalianRollingKing opened this issue 2 years ago • 6 comments

Motivation:

本次提交是由于 1.部分使用ark的用户暂不需要热部署能力,所以需要静态合并部署也就是将biz包通过pom的形式引入,目前的使用过程是不使用ark2.0的特性也就是启动参数没有-Dsofa.ark.embed.enable=true,并且打包使用sofa-ark-maven-plugin,相当于使用ark1.1.6的能力 2.基于上述的使用方式进行静态合并部署时,使用junit进行单元测试,在HandleArchiveStage阶段会引发npe。 3.所以目前无法进行静态合并部署的测试,解决思路有两种一是修复1.1.6的逻辑,二是优化embed的逻辑适配静态合并部署的场景

Modification:

HandleArchiveStage#processEmbed增加注册biz包的逻辑 EmbedClassPathArchive#getBizArchives增加查找biz包的逻辑

Result:

Fixes #<GitHub issue number>.

If there is no issue then describe the changes introduced by this PR.

DalianRollingKing avatar Jul 07 '22 12:07 DalianRollingKing

Hi @DalianRollingKing, welcome to SOFAStack community, Please sign Contributor License Agreement!

After you signed CLA, we will automatically sync the status of this pull request in 3 minutes.

sofastack-bot[bot] avatar Jul 07 '22 12:07 sofastack-bot[bot]

Codecov Report

Merging #539 (2a91856) into master (f765b71) will increase coverage by 0.00%. The diff coverage is 64.28%.

@@            Coverage Diff            @@
##             master     #539   +/-   ##
=========================================
  Coverage     60.42%   60.43%           
- Complexity      696      697    +1     
=========================================
  Files           157      157           
  Lines          6042     6093   +51     
  Branches        863      868    +5     
=========================================
+ Hits           3651     3682   +31     
- Misses         2056     2072   +16     
- Partials        335      339    +4     
Impacted Files Coverage Δ
...m/alipay/sofa/ark/bootstrap/ClasspathLauncher.java 36.64% <ø> (ø)
...va/com/alipay/sofa/ark/container/ArkContainer.java 66.31% <0.00%> (-2.17%) :arrow_down:
...ofa/ark/container/pipeline/HandleArchiveStage.java 30.18% <0.00%> (-1.50%) :arrow_down:
...ay/sofa/ark/container/pipeline/DeployBizStage.java 50.00% <40.00%> (-21.43%) :arrow_down:
...ofa/ark/support/startup/EmbedSofaArkBootstrap.java 79.54% <71.42%> (-4.33%) :arrow_down:
.../alipay/sofa/ark/loader/EmbedClassPathArchive.java 78.43% <82.14%> (+3.43%) :arrow_up:
...java/com/alipay/sofa/ark/common/util/JarUtils.java 72.50% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

codecov[bot] avatar Jul 13 '22 02:07 codecov[bot]

embed模式下在HandleArchiveStage阶段扫描所有满足条件的biz,而后在DeployBizStage阶段启动 ,此时master biz的spring上下文实际还未启动,需要评估下影响

yuanyuancin avatar Jul 13 '22 06:07 yuanyuancin

@DalianRollingKing 麻烦本地执行下这个 mvn clean install -DskipTests -Dmaven.javadoc.skip=true -B -U,有些格式化的问题导致检查没通过

lvjing2 avatar Jul 20 '22 06:07 lvjing2

#252 单元测试失败的原因与issue#252类似,目前在本地不能复现。

DalianRollingKing avatar Jul 29 '22 09:07 DalianRollingKing

#252 单元测试失败的原因与issue#252类似,目前在本地不能复现。

我也遇到类似问题了,我看看原因。

lvjing2 avatar Aug 10 '22 06:08 lvjing2

这个特性能尽快合入下一个版本呢?还是另有其他计划?谢谢

zyclove avatar Sep 20 '22 09:09 zyclove

这个特性能尽快合入下一个版本呢?还是另有其他计划?谢谢

正在调整,使得biz在masterbiz启动之后再启动

gaosaroma avatar Sep 20 '22 10:09 gaosaroma