Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify the use of Agent's Docker Image #33356

Merged
merged 1 commit into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions RELEASE-NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
1. Proxy Native: Change the Base Docker Image of ShardingSphere Proxy Native - [#33263](https://github.com/apache/shardingsphere/issues/33263)
1. Proxy: Add query parameters and check for mysql kill processId - [#33274](https://github.com/apache/shardingsphere/pull/33274)
1. SQL Parser: Support parsing Doris INSTR - [#33289](https://github.com/apache/shardingsphere/pull/33289)
1. Agent: Simplify the use of Agent's Docker Image - [#33356](https://github.com/apache/shardingsphere/pull/33356)

### Bug Fixes

Expand Down
8 changes: 5 additions & 3 deletions distribution/agent/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
FROM eclipse-temurin:22-jdk
FROM eclipse-temurin:23-jdk
LABEL org.opencontainers.image.authors="ShardingSphere [email protected]"
ARG APP_NAME
ADD target/${APP_NAME} /usr
ARG DIRECTORY_NAME
ARG JAR_NAME
ADD target/${DIRECTORY_NAME} /usr
RUN mv /usr/agent/${JAR_NAME} /usr/agent/shardingsphere-agent.jar
8 changes: 6 additions & 2 deletions distribution/agent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,9 @@
<arguments>
<argument>build</argument>
<argument>--build-arg</argument>
<argument>APP_NAME=apache-shardingsphere-${project.version}-shardingsphere-agent-bin</argument>
<argument>DIRECTORY_NAME=apache-shardingsphere-${project.version}-shardingsphere-agent-bin</argument>
<argument>--build-arg</argument>
<argument>JAR_NAME=shardingsphere-agent-${project.version}.jar</argument>
<argument>.</argument>
<argument>-t</argument>
<argument>apache/shardingsphere-agent:${project.version}</argument>
Expand Down Expand Up @@ -184,7 +186,9 @@
<argument>--platform</argument>
<argument>linux/amd64,linux/arm64</argument>
<argument>--build-arg</argument>
<argument>APP_NAME=apache-shardingsphere-${project.version}-shardingsphere-agent-bin</argument>
<argument>DIRECTORY_NAME=apache-shardingsphere-${project.version}-shardingsphere-agent-bin</argument>
<argument>--build-arg</argument>
<argument>JAR_NAME=shardingsphere-agent-${project.version}.jar</argument>
<argument>.</argument>
<argument>-t</argument>
<argument>${agent.image.repository}:${agent.image.tag}</argument>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,8 @@ docker network create example-net
docker run --rm -d \
--name jaeger \
-e COLLECTOR_ZIPKIN_HOST_PORT=:9411 \
-p 16686:16686 \
-p 4317:4317 \
-p 4318:4318 \
-p 9411:9411 \
--network example-net \
jaegertracing/all-in-one:1.60.0
jaegertracing/all-in-one:1.62.0
```

2. 假设 `./custom-agent.yaml` 包含 ShardingSphere Agent 的配置,内容可能如下,
Expand All @@ -175,7 +171,7 @@ plugins:
FROM ghcr.io/apache/shardingsphere-agent:latest
COPY ./target/example.jar /app.jar
COPY ./custom-agent.yaml /usr/agent/conf/agent.yaml
ENTRYPOINT ["java","-javaagent:/usr/agent/shardingsphere-agent-5.5.2-SNAPSHOT.jar","-jar","/app.jar"]
ENTRYPOINT ["java","-javaagent:/usr/agent/shardingsphere-agent.jar","-jar","/app.jar"]
```

如果是通过本地构建 `apache/shardingsphere-agent:latest` 的 Docker Image,`Dockerfile` 可能如下,
Expand All @@ -184,7 +180,7 @@ ENTRYPOINT ["java","-javaagent:/usr/agent/shardingsphere-agent-5.5.2-SNAPSHOT.ja
FROM apache/shardingsphere-agent:latest
COPY ./target/example.jar /app.jar
COPY ./custom-agent.yaml /usr/agent/conf/agent.yaml
ENTRYPOINT ["java","-javaagent:/usr/agent/shardingsphere-agent-5.5.2-SNAPSHOT.jar","-jar","/app.jar"]
ENTRYPOINT ["java","-javaagent:/usr/agent/shardingsphere-agent.jar","-jar","/app.jar"]
```

4. 享受它,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,12 +151,8 @@ docker network create example-net
docker run --rm -d \
--name jaeger \
-e COLLECTOR_ZIPKIN_HOST_PORT=:9411 \
-p 16686:16686 \
-p 4317:4317 \
-p 4318:4318 \
-p 9411:9411 \
--network example-net \
jaegertracing/all-in-one:1.60.0
jaegertracing/all-in-one:1.62.0
```

2. Assume `./custom-agent.yaml` contains the configuration of ShardingSphere Agent, and the content may be as follows,
Expand All @@ -177,7 +173,7 @@ you can use the ShardingSphere Agent in the nightly built Docker Image for a JAR
FROM ghcr.io/apache/shardingsphere-agent:latest
COPY ./target/example.jar /app.jar
COPY ./custom-agent.yaml /usr/agent/conf/agent.yaml
ENTRYPOINT ["java","-javaagent:/usr/agent/shardingsphere-agent-5.5.2-SNAPSHOT.jar","-jar","/app.jar "]
ENTRYPOINT ["java","-javaagent:/usr/agent/shardingsphere-agent.jar","-jar","/app.jar"]
```

If you build the Docker Image of `apache/shardingsphere-agent:latest` locally, the `Dockerfile` may be as follows,
Expand All @@ -186,7 +182,7 @@ If you build the Docker Image of `apache/shardingsphere-agent:latest` locally, t
FROM apache/shardingsphere-agent:latest
COPY ./target/example.jar /app.jar
COPY ./custom-agent.yaml /usr/agent/conf/agent.yaml
ENTRYPOINT ["java","-javaagent:/usr/agent/shardingsphere-agent-5.5.2-SNAPSHOT.jar","-jar","/app.jar"]
ENTRYPOINT ["java","-javaagent:/usr/agent/shardingsphere-agent.jar","-jar","/app.jar"]
```

4. Enjoy it,
Expand Down