Skip to content

Commit

Permalink
merge from master to 3.0.x (#861)
Browse files Browse the repository at this point in the history
* netty support 0.9.x (#843)

* modify test for zip fill to support jdk9+

* fix export import config

* support multi sdk

* format test

* support netty 0.9

(cherry picked from commit 92daff0)

* Update README.md (#846)

(cherry picked from commit 815ea32)

* support multi sdk

(cherry picked from commit 5f7fe98)

* format test

(cherry picked from commit 0f8c409)

* using 0.9 netty

(cherry picked from commit 233f6d7)

* no lib for netty ark plugin

(cherry picked from commit 68c3509)

* set scope = provided for netty

(cherry picked from commit 957f714)

* fix test error "No Ark Container Jar File Found"

(cherry picked from commit e6bfade)

* fix test error (#854)

(cherry picked from commit 917941c)

* fix test error (#855)

* fix test error

* just warn for stop tomcat

* fix test error

(cherry picked from commit c8c384c)

* fix test error (#856)

(cherry picked from commit a77b061)

* update guava version to aviod guava cache pin problem (#853)

* update guava version

* update guava version in container jar

* remove file

---------

Co-authored-by: leo james <[email protected]>

(cherry picked from commit 51ba5e0)

* update version

* no maven tree when single bundle

---------

Co-authored-by: g-stream <[email protected]>
  • Loading branch information
lvjing2 and g-stream authored Mar 12, 2024
1 parent 7747913 commit bc57014
Show file tree
Hide file tree
Showing 14 changed files with 53 additions and 32 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
![maven](https://img.shields.io/nexus/r/https/oss.sonatype.org/com.alipay.sofa/sofa-ark-all.svg)


欢迎大家移步:https://github.com/sofastack/sofa-serverless ,一起讨论 SOFAServerless 开源版能力共建
SOFAArk 作为类隔离组件,在蚂蚁内部演进出了一套完整的模块化应用研发框架和平台能力,欢迎大家移步:https://github.com/koupleless/koupleless ,一起讨论和建设模块化架构能力,一起探索微服务的下一站


SOFAArk 是一款基于 Java 实现的动态热部署和轻量级类隔离框架,由蚂蚁集团开源贡献,主要提供应用模块的动态热部署和类隔离能力。基于 [Fat Jar](https://docs.spring.io/spring-boot/docs/current/reference/html/executable-jar.html#executable-jar-jar-file-structure) 技术,可以将多个应用模块打包成一个自包含可运行的 Fat Jar,应用既可以是简单的单模块 Java 应用也可以是 SpringBoot/SOFABoot 应用。[访问网址](https://www.sofastack.tech/sofa-boot/docs/sofa-ark-readme?lang=zh-cn)进入快速开始并获取更多详细信息。
Expand Down Expand Up @@ -59,7 +59,7 @@ SOFAArk 基于类隔离能力,实现了应用的合并部署,可以简单分

无论是静态还是动态合并部署都会有宿主应用(master app)的概念, 如果 Ark 包只打包了一个 Biz,则该 Biz 默认成为宿主应用。如果 Ark 包打包了多个 Biz 包,需要配置指定宿主应用。宿主应用不允许被卸载,一般而言,宿主应用会作为流量入口的中台系统,具体的服务实现会放在不同的动态 Biz 中,供宿主应用调用。宿主应用可以使用 SOFAArk 提供的客户端 API 实现动态应用的部署和卸载。除了 API, SOFAArk 提供了 Config Plugin,用于对接配置中心(目前支持 Zookeeper),运行时接受动态配置。Config Plugin 会解析下发的配置,控制动态模块的部署和卸载。

随着近几年 Serverless 技术的兴起,蚂蚁集团在 Serverless 领域进行了持续的建设和探索,基于 SOFAArk 动态合并部署技术打造了比较成熟的 SOFAServerless 技术体系,去深入解决企业的研发和运维效率问题。其核心方式是通过快速热部署、动态服务发布等技术,将应用从代码结构和开发者阵型划分为模块和基座。其中基座为业务模块提供计算环境并屏蔽基础设施,让模块开发者不用感知机器和容量等底层设施而专注于某个功能模块的开发迭代来帮助业务快速向前发展。
随着近几年 模块化、Serverless 技术的兴起,蚂蚁集团在应用研发领域进行了持续的建设和探索,基于 SOFAArk 动态合并部署技术打造了比较成熟的 Koupleless 技术体系,去深入解决企业的研发和运维效率问题。其核心方式是通过快速热部署、动态服务发布等技术,将应用从代码结构和开发者阵型划分为模块和基座。其中基座为业务模块提供计算环境并屏蔽基础设施,让模块开发者不用感知机器和容量等底层设施而专注于某个功能模块的开发迭代来帮助业务快速向前发展。

在应用架构领域,不可避免的问题是应用随着业务的复杂度不断增加,研发运维的过程中的问题会不断暴露出来。首先我们看一下普通应用研发和运维过程中的流程是什么样的:

Expand All @@ -85,7 +85,7 @@ SOFAArk 基于类隔离能力,实现了应用的合并部署,可以简单分

从这张图里可以看到 Serverless 应用拆分的形态,通过把一个普通的 Java 应用拆出多个模块,进一步对应用进行了拆分:基座和模块,对应的研发人员也划分为基座开发者和模块开发者。

基座负责沉淀通用的逻辑,为模块提供计算和环境,并为模块开发者屏蔽基础设施,让模块开发者不需要关心容量和资源等。各个模块则是独立的代码仓库,可以进行独立的研发运维,这样研发运维粒度就得到了精细化,并且由于基座为模块屏蔽了环境与基础设施,模块开发者可以专注于业务开发从而提高了业务创新效率。SOFAServerless 开源版首个版本计划在 10 月左右透出,届时欢迎大家一起来建设社区 Serverless 技术
基座负责沉淀通用的逻辑,为模块提供计算和环境,并为模块开发者屏蔽基础设施,让模块开发者不需要关心容量和资源等。各个模块则是独立的代码仓库,可以进行独立的研发运维,这样研发运维粒度就得到了精细化,并且由于基座为模块屏蔽了环境与基础设施,模块开发者可以专注于业务开发从而提高了业务创新效率。Koupleless 开源版首个 1.0 版本计划已经发布,欢迎大家一起来建设社区 Koupleless 模块化技术



Expand Down
3 changes: 2 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
</modules>

<properties>
<sofa.ark.version>3.0.2</sofa.ark.version>
<sofa.ark.version>3.0.3-SNAPSHOT</sofa.ark.version>
<sofa.ark.version.old>3.0.2</sofa.ark.version.old>
<project.encoding>UTF-8</project.encoding>
<java.version>17</java.version>
<license.maven.plugin>3.0</license.maven.plugin>
Expand Down
3 changes: 2 additions & 1 deletion sofa-ark-bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
<maven.plugin.plugin>3.6.1</maven.plugin.plugin>
<surefire.version>2.22.2</surefire.version>
<netty.version>4.1.94.Final</netty.version>
<reactor-netty.version>0.9.19.RELEASE</reactor-netty.version>
<spring.boot.version>3.0.9</spring.boot.version>
</properties>

Expand Down Expand Up @@ -193,7 +194,7 @@
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>32.1.3-jre</version>
<version>33.0.0-jre</version>
</dependency>

<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public class DirectoryContainerArchive implements ContainerArchive {
private final URL[] urls;

private final static String[] AKR_CONTAINER_JAR = { "aopalliance-1.0", "commons-io-2.7",
"guava-32.1.3-jre", "guice-6.0.0", "failureaccess-1.0.1", "javax.inject-1",
"guava-33.0.0-jre", "guice-6.0.0", "failureaccess-1.0.1", "javax.inject-1",
"jakarta.inject-api-2.0.1", "logback-core-1.4.14", "logback-classic-1.4.14",
"slf4j-api-2.0.11", "sofa-common-tools", "netty-all-4.1.94.Final",
"netty-transport-4.1.94.Final", "netty-common-4.1.94.Final",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -398,14 +398,16 @@ private Set<ArtifactItem> getAllArtifact() throws MojoExecutionException, MojoFa
return results;
}

private Set<ArtifactItem> getAllArtifactByMavenTree() throws MojoExecutionException {
private Set<ArtifactItem> getAllArtifactByMavenTree() throws MojoExecutionException,
MojoFailureException {
MavenProject rootProject = MavenUtils.getRootProject(this.mavenProject);
getLog().info("root project path: " + rootProject.getBasedir().getAbsolutePath());

// run maven dependency:tree
try {
if (this.mavenProject.getBasedir() != null) {
return doGetAllArtifactByMavenTree(this.mavenProject);
doGetAllArtifactByMavenTree(this.mavenProject);
return getAllArtifact();
}
} catch (MojoExecutionException e) {
getLog().warn(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
<dependency>
<groupId>com.alipay.sofa</groupId>
<artifactId>sofa-ark-all</artifactId>
<version>${sofa.ark.version.old}</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
<dependency>
<groupId>com.alipay.sofa</groupId>
<artifactId>sofa-ark-all</artifactId>
<version>${sofa.ark.version.old}</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,15 @@
<scope>test</scope>
</dependency>

<!-- fix https://github.com/sofastack/sofa-ark/issues/851 -->
<dependency>
<groupId>com.alipay.sofa</groupId>
<artifactId>sofa-ark-all</artifactId>
<!-- please notice to use the old version to make ide import sofa-ark-all by jar rather than local classpath -->
<version>${sofa.ark.version.old}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.alipay.sofa</groupId>
<artifactId>web-ark-plugin</artifactId>
Expand Down Expand Up @@ -151,7 +160,8 @@
<dependency>
<groupId>io.projectreactor.netty</groupId>
<artifactId>reactor-netty</artifactId>
<version>1.0.22</version>
<version>${reactor-netty.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ private HttpServer initEmbedNetty(){
if (this.resourceFactory != null) {
LoopResources resources = this.resourceFactory.getLoopResources();
Assert.notNull(resources, "No LoopResources: is ReactorResourceFactory not initialized yet?");
server = ((HttpServer)server.runOn(resources)).bindAddress(this::getListenAddress);
server = server.tcpConfiguration((tcpServer) -> tcpServer.runOn(resources)).bindAddress(this::getListenAddress);
} else {
server = server.bindAddress(this::getListenAddress);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,8 @@ public int getPort() {

private String getStartedOnMessage(DisposableServer server) {
StringBuilder message = new StringBuilder();
this.tryAppend(message, "port %s", () -> {
return server.port();
});
this.tryAppend(message, "path %s", () -> {
return server.path();
});
this.tryAppend(message, "port %s", server::port);
this.tryAppend(message, "host %s", server::host);
return message.length() > 0 ? " on " + message : "";
}

Expand Down
27 changes: 15 additions & 12 deletions sofa-ark-parent/support/ark-support-starter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,17 @@
<!--SOFAArk modules-->
<dependency>
<groupId>com.alipay.sofa</groupId>
<artifactId>sofa-ark-all</artifactId>
<exclusions>
<exclusion>
<groupId>com.alipay.sofa</groupId>
<artifactId>sofa-ark-container</artifactId>
</exclusion>
<exclusion>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
</exclusion>
</exclusions>
<artifactId>sofa-ark-common</artifactId>
</dependency>

<dependency>
<groupId>com.alipay.sofa</groupId>
<artifactId>sofa-ark-spi</artifactId>
</dependency>

<dependency>
<groupId>com.alipay.sofa</groupId>
<artifactId>sofa-ark-archive</artifactId>
</dependency>

<!--junit-->
Expand All @@ -85,9 +85,12 @@
</dependency>

<!--test-->
<!-- fix https://github.com/sofastack/sofa-ark/issues/851 -->
<dependency>
<groupId>com.alipay.sofa</groupId>
<artifactId>sofa-ark-container</artifactId>
<artifactId>sofa-ark-all</artifactId>
<!-- please notice to use the old version to make ide import sofa-ark-all by jar rather than local classpath -->
<version>${sofa.ark.version.old}</version>
<scope>test</scope>
</dependency>

Expand Down
9 changes: 7 additions & 2 deletions sofa-ark-plugin/netty-ark-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId>
<version>${spring.boot.version}</version>
<scope>provided</scope>
</dependency>


<dependency>
<groupId>io.projectreactor.netty</groupId>
<artifactId>reactor-netty</artifactId>
<version>1.0.22</version>
<version>${reactor-netty.version}</version>
<scope>provided</scope>
</dependency>

<dependency>
Expand Down Expand Up @@ -56,6 +57,10 @@
<package>org.apache.*</package>
</packages>
</exported>
<excludes>
<exclude>*:*:*</exclude>
<exclude>com.alipay.sofa:netty-ark-plugin</exclude>
</excludes>
</configuration>
</execution>
</executions>
Expand Down
1 change: 1 addition & 0 deletions sofa-ark-plugin/web-ark-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<version>${spring.boot.version}</version>
<scope>provided</scope>
</dependency>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ public void stop(PluginContext context) {
try {
webServer.destroy();
} catch (Exception ex) {
ArkLoggerFactory.getDefaultLogger().error("Unable to stop embedded Tomcat", ex);
ArkLoggerFactory.getDefaultLogger().warn("Unable to stop embedded Tomcat", ex);
}
}
}
}
}

0 comments on commit bc57014

Please sign in to comment.