Skip to content

Commit

Permalink
Support running DistSQL under Proxy Native in the form of GraalVM Nat…
Browse files Browse the repository at this point in the history
…ive Image
  • Loading branch information
linghengqian committed Oct 2, 2024
1 parent 8e104c0 commit b275e91
Show file tree
Hide file tree
Showing 18 changed files with 1,817 additions and 1,948 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/nightly-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push Docker Image
run: |
./mvnw -am -pl distribution/proxy-native -Prelease.native,docker.buildx.push.native -B -T1C -DskipTests -Dproxy.image.repository=${{ env.PROXY_NATIVE }} -Dproxy.image.tag=${{ github.sha }} clean package
./mvnw -am -pl distribution/proxy-native -Prelease.native,docker.buildx.push.native -B -T1C -DskipTests -Dproxy.native.image.repository=${{ env.PROXY_NATIVE }} -Dproxy.native.image.tag=${{ github.sha }} clean package
build-agent-image:
if: github.repository == 'apache/shardingsphere'
name: Build Agent Image
Expand Down
1 change: 1 addition & 0 deletions RELEASE-NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
### Enhancement

1. SQL Parser: Support PostgreSQL, openGauss function table and update from segment parse - [#32994](https://github.com/apache/shardingsphere/pull/32994)
2. DistSQL: Support running DistSQL under Proxy Native in the form of GraalVM Native Image - [#33095](https://github.com/apache/shardingsphere/pull/33095)

### Bug Fix

Expand Down
20 changes: 5 additions & 15 deletions distribution/proxy-native/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
FROM alpine AS prepare

ARG APP_NAME
ENV LOCAL_PATH /opt/shardingsphere-proxy-native

ADD target/${APP_NAME}.tar.gz /opt
RUN mv /opt/${APP_NAME} ${LOCAL_PATH}

FROM oraclelinux:9-slim
MAINTAINER ShardingSphere "[email protected]"

ARG NATIVE_IMAGE_NAME
ENV LOCAL_PATH /opt/shardingsphere-proxy-native

COPY --from=prepare ${LOCAL_PATH} ${LOCAL_PATH}
ENTRYPOINT ${LOCAL_PATH}/${NATIVE_IMAGE_NAME} 3307 ${LOCAL_PATH}/conf "0.0.0.0" false
LABEL org.opencontainers.image.authors="ShardingSphere [email protected]"
ENV LOCAL_PATH=/opt/shardingsphere-proxy-native-bin
ARG OUTPUT_DIRECTORY_NAME
COPY target/${OUTPUT_DIRECTORY_NAME} ${LOCAL_PATH}
ENTRYPOINT ["${LOCAL_PATH}/proxy-native", "3307", "${LOCAL_PATH}/conf", "0.0.0.0", "false"]
69 changes: 19 additions & 50 deletions distribution/proxy-native/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,14 @@
<version>5.5.1-SNAPSHOT</version>
</parent>
<artifactId>shardingsphere-proxy-native-distribution</artifactId>
<packaging>pom</packaging>
<name>${project.artifactId}</name>

<properties>
<imageName>apache-shardingsphere-proxy-native</imageName>
<native.image.repository>apache/shardingsphere-proxy-native</native.image.repository>
<proxy.native.image.name>proxy-native</proxy.native.image.name>
<proxy.native.image.platform>linux/amd64,linux/arm64</proxy.native.image.platform>
<proxy.native.image.repository>apache/shardingsphere-proxy-native</proxy.native.image.repository>
<proxy.native.image.tag>${project.version}</proxy.native.image.tag>
</properties>

<dependencies>
Expand Down Expand Up @@ -86,6 +89,7 @@
<extensions>true</extensions>
<configuration>
<mainClass>org.apache.shardingsphere.proxy.Bootstrap</mainClass>
<imageName>${proxy.native.image.name}</imageName>
<buildArgs>
<buildArg>-H:+AddAllCharsets</buildArg>
</buildArgs>
Expand Down Expand Up @@ -116,7 +120,7 @@
</configuration>
<executions>
<execution>
<id>shardingsphere-proxy-native-bin</id>
<id>build and package</id>
<goals>
<goal>single</goal>
</goals>
Expand All @@ -133,10 +137,6 @@
</profile>
<profile>
<id>docker.native</id>
<properties>
<proxy.image.repository>${native.image.repository}</proxy.image.repository>
<proxy.image.tag>${project.version}</proxy.image.tag>
</properties>
<build>
<plugins>
<plugin>
Expand All @@ -145,7 +145,7 @@
<version>${exec-maven-plugin.version}</version>
<executions>
<execution>
<id>build</id>
<id>build docker image</id>
<goals>
<goal>exec</goal>
</goals>
Expand All @@ -154,16 +154,13 @@
<executable>docker</executable>
<arguments>
<argument>build</argument>
<argument>--pull</argument>
<argument>--build-arg</argument>
<argument>APP_NAME=${project.build.finalName}-shardingsphere-proxy-native-bin</argument>
<argument>--build-arg</argument>
<argument>NATIVE_IMAGE_NAME=${imageName}</argument>
<argument>OUTPUT_DIRECTORY_NAME=${project.build.finalName}-shardingsphere-proxy-native-bin</argument>
<argument>.</argument>
<argument>-t</argument>
<argument>${proxy.image.repository}:${proxy.image.tag}</argument>
<argument>${proxy.native.image.repository}:${proxy.native.image.tag}</argument>
<argument>-t</argument>
<argument>${proxy.image.repository}:latest</argument>
<argument>${proxy.native.image.repository}:latest</argument>
</arguments>
</configuration>
</execution>
Expand All @@ -174,11 +171,6 @@
</profile>
<profile>
<id>docker.buildx.push.native</id>
<properties>
<proxy.image.platform>linux/amd64,linux/arm64</proxy.image.platform>
<proxy.image.repository>${native.image.repository}</proxy.image.repository>
<proxy.image.tag>${project.version}</proxy.image.tag>
</properties>
<build>
<plugins>
<plugin>
Expand All @@ -197,40 +189,17 @@
<arguments>
<argument>buildx</argument>
<argument>create</argument>
<argument>--use</argument>
<argument>--driver</argument>
<argument>docker-container</argument>
<argument>--name</argument>
<argument>shardingsphere-builder</argument>
<argument>--platform</argument>
<argument>${proxy.image.platform}</argument>
</arguments>
</configuration>
</execution>
<execution>
<id>build</id>
<goals>
<goal>exec</goal>
</goals>
<phase>package</phase>
<configuration>
<executable>docker</executable>
<arguments>
<argument>buildx</argument>
<argument>build</argument>
<argument>--pull</argument>
<argument>--platform</argument>
<argument>${proxy.image.platform}</argument>
<argument>--build-arg</argument>
<argument>APP_NAME=${project.build.finalName}-shardingsphere-proxy-native-bin</argument>
<argument>--build-arg</argument>
<argument>NATIVE_IMAGE_NAME=${imageName}</argument>
<argument>.</argument>
<argument>${proxy.native.image.platform}</argument>
</arguments>
</configuration>
</execution>
<execution>
<id>push</id>
<id>build and push docker image</id>
<goals>
<goal>exec</goal>
</goals>
Expand All @@ -241,17 +210,17 @@
<argument>buildx</argument>
<argument>build</argument>
<argument>--push</argument>
<argument>--builder</argument>
<argument>shardingsphere-builder</argument>
<argument>--platform</argument>
<argument>${proxy.image.platform}</argument>
<argument>--build-arg</argument>
<argument>APP_NAME=${project.build.finalName}-shardingsphere-proxy-native-bin</argument>
<argument>${proxy.native.image.platform}</argument>
<argument>--build-arg</argument>
<argument>NATIVE_IMAGE_NAME=${imageName}</argument>
<argument>OUTPUT_DIRECTORY_NAME=${project.build.finalName}-shardingsphere-proxy-native-bin</argument>
<argument>.</argument>
<argument>-t</argument>
<argument>${proxy.image.repository}:${proxy.image.tag}</argument>
<argument>${proxy.native.image.repository}:${proxy.native.image.tag}</argument>
<argument>-t</argument>
<argument>${proxy.image.repository}:latest</argument>
<argument>${proxy.native.image.repository}:latest</argument>
</arguments>
</configuration>
</execution>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,17 @@
xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd">
<id>shardingsphere-proxy-native-bin</id>
<formats>
<format>dir</format>
<format>tar.gz</format>
</formats>
<includeBaseDirectory>true</includeBaseDirectory>
<baseDirectory>${project.build.finalName}-shardingsphere-proxy-native-bin</baseDirectory>
<includeBaseDirectory>false</includeBaseDirectory>

<fileSets>
<fileSet>
<directory>${project.build.directory}</directory>
<includes>
<include>${imageName}</include>
<include>${proxy.native.image.name}</include>
<include>*.so</include>
</includes>
<outputDirectory>/</outputDirectory>
<fileMode>0755</fileMode>
Expand All @@ -41,7 +42,9 @@
<fileSet>
<directory>../../distribution/proxy/src/main/release-docs</directory>
<includes>
<include>**/*</include>
<include>licenses/*</include>
<include>LICENSE</include>
<include>NOTICE</include>
</includes>
<outputDirectory>/</outputDirectory>
</fileSet>
Expand Down
Loading

0 comments on commit b275e91

Please sign in to comment.