Skip to content

Commit fc03db1

Browse files
committed
feat: uni-architecture redesign
1 parent 206383e commit fc03db1

2,015 files changed

Lines changed: 30216 additions & 164332 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.dockerignore

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
1+
# Build outputs — regenerated inside the image, never shipped from context.
12
dist/
3+
dist-connector/
24
build/
5+
**/build/
36

4-
# VCS
7+
# VCS and gradle caches (the wrapper is not used; system gradle lives in the
8+
# builder image).
59
.git/
610
.gitignore
11+
.gradle/
12+
**/.gradle/
713

814
# Non-Java SDKs (not included in Gradle build)
915
eventmesh-sdks/eventmesh-sdk-rust/
@@ -14,10 +20,12 @@ eventmesh-sdks/eventmesh-sdk-c/
1420
**/target/
1521
**/node_modules/
1622

17-
# IDE
23+
# IDE / editor cruft.
1824
.idea/
1925
.vscode/
2026
*.iml
27+
*.ipr
28+
*.iws
2129

2230
# Docs & misc
2331
docs/

.github/workflows/docker.yml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,16 @@ on:
2323
jobs:
2424
docker:
2525
runs-on: ubuntu-latest
26+
strategy:
27+
fail-fast: false
28+
matrix:
29+
include:
30+
# EventMesh unified runtime (traffic HTTP + admin).
31+
- image: apache/eventmesh
32+
dockerfile: ./docker/Dockerfile
33+
# Connector-runtime (separate process, talks HTTP+CloudEvents to the runtime).
34+
- image: apache/eventmesh-connector
35+
dockerfile: ./docker/Dockerfile.connector
2636
steps:
2737
- name: Checkout repository
2838
uses: actions/checkout@v6
@@ -37,14 +47,13 @@ jobs:
3747
id: meta
3848
uses: docker/metadata-action@v5
3949
with:
40-
images: |
41-
apache/eventmesh
50+
images: ${{ matrix.image }}
4251

4352
- name: Build and push
4453
uses: docker/build-push-action@v6
4554
with:
4655
push: true
4756
tags: ${{ steps.meta.outputs.tags }}
4857
labels: ${{ steps.meta.outputs.labels }}
49-
file: ./docker/Dockerfile_jdk8
50-
context: ./
58+
file: ${{ matrix.dockerfile }}
59+
context: ./

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,15 @@ x86/
4444
[Aa][Rr][Mm]64/
4545
bld/
4646
[Bb]in/
47+
# … but keep source service scripts shipped from module bin/ dirs (dist copies them to dist/bin).
48+
!eventmesh-runtime/bin/
49+
!eventmesh-connector-runtime/bin/
4750
[Oo]bj/
4851
[Ll]og/
4952
[Ll]ogs/
5053
**/org/apache/eventmesh/connector/jdbc/antlr4/autogeneration/*
5154

5255
#rust
5356
Cargo.lock
57+
rocketmq-pull-offsets.properties
58+
kafka-pull-offsets.properties

build.gradle

Lines changed: 69 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,6 @@ import java.util.concurrent.TimeUnit
3232
buildscript {
3333
repositories {
3434
mavenCentral()
35-
maven {
36-
url "https://maven.aliyun.com/repository/public"
37-
}
3835
maven {
3936
url "https://plugins.gradle.org/m2/"
4037
}
@@ -74,8 +71,8 @@ allprojects {
7471
compileJava.options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
7572

7673
java {
77-
sourceCompatibility = "1.8"
78-
targetCompatibility = "1.8"
74+
sourceCompatibility = JavaVersion.VERSION_21
75+
targetCompatibility = JavaVersion.VERSION_21
7976
}
8077

8178
clean.doFirst {
@@ -105,9 +102,6 @@ allprojects {
105102
dependencies {
106103
repositories {
107104
mavenCentral()
108-
maven {
109-
url "https://maven.aliyun.com/repository/public"
110-
}
111105
}
112106
testImplementation "org.junit.jupiter:junit-jupiter:5.11.0"
113107
}
@@ -159,22 +153,18 @@ tasks.register('dist') {
159153
dependsOn("${subProject.path}:jar")
160154
}
161155
dependsOn('generateDistLicense', 'generateDistNotice')
156+
// Only modules that ship on the runtime classpath of the unified runtime
157+
// (EventMeshApplication). Legacy api/registry/retry/security/trace/meta/
158+
// metrics/starter/runtime-v2/openconnect modules were deleted in the uni
159+
// rewrite; listing them here made `findProject` return null and NPE.
162160
def includedProjects =
163161
["eventmesh-common",
164-
"eventmesh-meta:eventmesh-meta-api",
165-
"eventmesh-metrics-plugin:eventmesh-metrics-api",
166-
"eventmesh-openconnect:eventmesh-openconnect-java",
167-
"eventmesh-openconnect:eventmesh-openconnect-offsetmgmt-plugin:eventmesh-openconnect-offsetmgmt-api",
168-
"eventmesh-protocol-plugin:eventmesh-protocol-api",
169-
"eventmesh-registry:eventmesh-registry-api",
170-
"eventmesh-retry:eventmesh-retry-api",
171162
"eventmesh-runtime",
172-
"eventmesh-runtime-v2",
173-
"eventmesh-security-plugin:eventmesh-security-api",
174163
"eventmesh-spi",
175-
"eventmesh-starter",
176164
"eventmesh-storage-plugin:eventmesh-storage-api",
177-
"eventmesh-trace-plugin:eventmesh-trace-api"]
165+
"eventmesh-protocol-plugin:eventmesh-protocol-api",
166+
"eventmesh-protocol-plugin:eventmesh-protocol-meshmessage",
167+
"eventmesh-protocol-plugin:eventmesh-protocol-a2a"]
178168
doLast {
179169
includedProjects.each {
180170
def subProject = findProject(it)
@@ -207,53 +197,13 @@ tasks.register('dist') {
207197
}
208198
}
209199

210-
tasks.register('dist-admin') {
211-
subprojects.forEach { subProject ->
212-
dependsOn("${subProject.path}:jar")
213-
}
214-
def includedProjects =
215-
[
216-
"eventmesh-admin-server",
217-
"eventmesh-common",
218-
"eventmesh-spi",
219-
"eventmesh-registry:eventmesh-registry-api",
220-
"eventmesh-registry:eventmesh-registry-nacos",
221-
"eventmesh-openconnect:eventmesh-openconnect-offsetmgmt-plugin:eventmesh-openconnect-offsetmgmt-api"
222-
]
223-
doLast {
224-
includedProjects.each {
225-
def subProject = findProject(it)
226-
copy {
227-
from subProject.jar.archivePath
228-
into rootProject.file('dist/apps')
229-
}
230-
copy {
231-
from subProject.configurations.runtimeClasspath
232-
into rootProject.file('dist/lib')
233-
exclude 'eventmesh-*'
234-
}
235-
copy {
236-
from subProject.file('bin')
237-
into rootProject.file('dist/bin')
238-
}
239-
copy {
240-
from subProject.file('conf')
241-
from subProject.sourceSets.main.resources.srcDirs
242-
into rootProject.file('dist/conf')
243-
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
244-
exclude 'META-INF'
245-
}
246-
247-
}
248-
}
249-
250-
}
251-
252200
tasks.register('installPlugin') {
253201
var pluginProjects = subprojects.findAll {
254202
it.file('gradle.properties').exists()
255203
&& it.properties.containsKey('pluginType')
256204
&& it.properties.containsKey('pluginName')
205+
// connectors ship in the connector-runtime image (dist-connector), not the runtime image
206+
&& it.properties.get('pluginType') != 'connector'
257207
}
258208
doLast {
259209
String[] libJars = java.util.Optional.ofNullable(file('dist/lib').list()).orElse(new String[0])
@@ -281,6 +231,64 @@ tasks.register('installPlugin') {
281231
}
282232
}
283233

234+
tasks.register('dist-connector') {
235+
subprojects.forEach { subProject ->
236+
dependsOn("${subProject.path}:jar")
237+
}
238+
dependsOn('generateDistLicense', 'generateDistNotice')
239+
doLast {
240+
// Core: the connector-runtime process jar + its third-party deps (cloudevents, jackson,
241+
// rocksdb, log4j binding, …). ConnectorApplication loads connectors via Class.forName, so
242+
// connector jars must be on the classpath — start-connector.sh builds -cp from plugin/**/*.jar.
243+
def core = findProject('eventmesh-connector-runtime')
244+
logger.lifecycle('Install module: module: {}', core.name)
245+
copy {
246+
from core.jar.archivePath
247+
into rootProject.file('dist-connector/apps')
248+
}
249+
copy {
250+
from core.configurations.runtimeClasspath
251+
into rootProject.file('dist-connector/lib')
252+
exclude 'eventmesh-*'
253+
}
254+
copy {
255+
from core.file('bin')
256+
into rootProject.file('dist-connector/bin')
257+
}
258+
copy {
259+
from core.file('conf')
260+
from core.sourceSets.main.resources.srcDirs
261+
into rootProject.file('dist-connector/conf')
262+
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
263+
exclude 'META-INF'
264+
}
265+
// Connector plugins (pluginType == connector) into dist-connector/plugin/connector/<name>/
266+
String[] libJars = java.util.Optional.ofNullable(file('dist-connector/lib').list()).orElse(new String[0])
267+
def connectorPlugins = subprojects.findAll {
268+
it.file('gradle.properties').exists()
269+
&& it.properties.containsKey('pluginType')
270+
&& it.properties.get('pluginType') == 'connector'
271+
}
272+
connectorPlugins.forEach(subProject -> {
273+
var pluginName = subProject.properties.get('pluginName')
274+
logger.lifecycle('Install connector plugin: {}, module: {}', pluginName, subProject.name)
275+
copy {
276+
from subProject.jar.archivePath
277+
into rootProject.file("dist-connector/plugin/connector/${pluginName}")
278+
}
279+
copy {
280+
from subProject.configurations.runtimeClasspath
281+
into rootProject.file("dist-connector/plugin/connector/${pluginName}")
282+
exclude(libJars)
283+
}
284+
})
285+
copy {
286+
from 'tools/dist-license'
287+
into rootProject.file('dist-connector')
288+
}
289+
}
290+
}
291+
284292
tasks.register('tar', Tar) {
285293
archiveBaseName.set(project.name)
286294
archiveVersion.set(project.version.toString())
@@ -630,7 +638,6 @@ subprojects {
630638

631639
repositories {
632640
mavenCentral()
633-
maven { url "https://maven.aliyun.com/repository/public" }
634641
}
635642

636643
configurations.configureEach {

docker/Dockerfile

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one or more
3+
# contributor license agreements. See the NOTICE file distributed with
4+
# this work for additional information regarding copyright ownership.
5+
# The ASF licenses this file to You under the Apache License, Version 2.0
6+
# (the "License"); you may not use this file except in compliance with
7+
# the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
18+
# Builder: Gradle 8.5 + JDK 21, matching the fork's local build setup. The
19+
# gradle wrapper (8.7) is intentionally not used: its distribution is fetched
20+
# from services.gradle.org, which is unreachable on this fork's network.
21+
# Dependencies resolve against the Maven repositories configured in settings.gradle / build.gradle.
22+
FROM gradle:8.5.0-jdk21 AS builder
23+
USER root
24+
WORKDIR /build
25+
COPY . .
26+
# `dist` builds every subproject jar and assembles dist/{apps,lib,conf,bin};
27+
# `installPlugin` lays out dist/plugin/<type>/<name>/ (storage + protocol only;
28+
# connectors are filtered out — they ship in the connector image). Neither runs
29+
# tests nor style gates (jar does not depend on check/test).
30+
RUN gradle clean dist --no-daemon \
31+
&& gradle installPlugin --no-daemon
32+
33+
# Runtime: EventMeshApplication boots traffic HTTP + admin HTTP (+ opt-in
34+
# WebSocket) as one JVM. Storage/protocol plugins are discovered from ./plugin/
35+
# by the SPI JarExtensionClassLoader, so only conf/apps/lib need the classpath.
36+
# bin/start.sh assembles the classpath and maps ENV vars to -D flags.
37+
FROM eclipse-temurin:21-jre
38+
RUN apt-get update && apt-get install -y --no-install-recommends locales procps \
39+
&& rm -rf /var/lib/apt/lists/*
40+
RUN localedef -i en_US -f UTF-8 en_US.UTF-8 --quiet
41+
WORKDIR /data/app/eventmesh
42+
COPY --from=builder /build/dist ./
43+
RUN chmod +x bin/*.sh
44+
45+
# 8080 = traffic HTTP (/events/* CloudEvents + legacy /eventmesh/*).
46+
# 8081 = independent admin port (UniAdminServer /admin/*).
47+
# 8082 = WebSocket push transport (opt-in via -Deventmesh.ws.port in JAVA_OPTS).
48+
EXPOSE 8080 8081 8082
49+
50+
ENV DOCKER=true
51+
ENV EVENTMESH_HOME=/data/app/eventmesh
52+
ENV EVENTMESH_LOG_HOME=/data/app/eventmesh/logs
53+
ENV CONFPATH=/data/app/eventmesh/conf
54+
# Only kafka/rocketmq storage plugins ship (standalone was removed). Override
55+
# with -e EVENTMESH_STORAGE_TYPE=rocketmq. Storage bootstrap (namesrv) is read
56+
# from conf/eventmesh.properties — mount a volume over conf/ to override.
57+
ENV EVENTMESH_STORAGE_TYPE=kafka
58+
ENV EVENTMESH_HTTP_PORT=8080
59+
ENV EVENTMESH_ADMIN_PORT=8081
60+
ENV EVENTMESH_OFFSET_PATH=/data/app/eventmesh/data/offset
61+
# Extra -D flags: TLS keystore, ws.port, meta.type/meta.addr for clustering, …
62+
ENV JAVA_OPTS=""
63+
64+
CMD ["bash", "bin/start.sh"]

docker/Dockerfile.connector

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one or more
3+
# contributor license agreements. See the NOTICE file distributed with
4+
# this work for additional information regarding copyright ownership.
5+
# The ASF licenses this file to You under the Apache License, Version 2.0
6+
# (the "License"); you may not use this file except in compliance with
7+
# the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
18+
# Connector-runtime image — a separate process that talks HTTP+CloudEvents to the
19+
# EventMesh runtime and runs source/sink connectors. Built from `dist-connector`
20+
# (connector-runtime jar + deps + every connector plugin under plugin/connector/).
21+
# Same builder constraints as docker/Dockerfile (system gradle 8.5 + JDK 21).
22+
FROM gradle:8.5.0-jdk21 AS builder
23+
USER root
24+
WORKDIR /build
25+
COPY . .
26+
RUN gradle clean dist-connector --no-daemon
27+
28+
# Runtime: ConnectorApplication loads connectors via Class.forName, so bin/start-connector.sh
29+
# flattens plugin/connector/**/*.jar onto the classpath (find is required by that script).
30+
FROM eclipse-temurin:21-jre
31+
RUN apt-get update && apt-get install -y --no-install-recommends locales procps findutils \
32+
&& rm -rf /var/lib/apt/lists/*
33+
RUN localedef -i en_US -f UTF-8 en_US.UTF-8 --quiet
34+
WORKDIR /data/app/connector
35+
COPY --from=builder /build/dist-connector ./
36+
RUN chmod +x bin/*.sh
37+
38+
# Connector admin port is opt-in (CONNECTOR_ADMIN_PORT=0 = off by default). Expose 8083 as the
39+
# conventional port for operators who enable it; the connector otherwise makes only outbound calls.
40+
EXPOSE 8083
41+
42+
ENV DOCKER=true
43+
ENV EVENTMESH_HOME=/data/app/connector
44+
ENV EVENTMESH_LOG_HOME=/data/app/connector/logs
45+
ENV CONFPATH=/data/app/connector/conf
46+
ENV EVENTMESH_RUNTIME_URL=http://localhost:8080
47+
ENV CONNECTOR_ADMIN_PORT=0
48+
ENV CONNECTOR_OFFSET_MODE=remote
49+
ENV CONNECTOR_OFFSET_PATH=/data/app/connector/data/connector-offset
50+
# Connector -D flags, e.g. -Dconnector.1.class=... -Dconnector.1.mode=source -Dconnector.1.topic=t
51+
ENV CONNECTOR_OPTS=""
52+
# Extra -D flags (TLS, …)
53+
ENV JAVA_OPTS=""
54+
55+
CMD ["bash", "bin/start-connector.sh"]

0 commit comments

Comments
 (0)