Skip to content

Commit

Permalink
[feature] add kubernetes deploy (DataLinkDC#3516)
Browse files Browse the repository at this point in the history
Co-authored-by: 唐修红 <[email protected]>
  • Loading branch information
tgluon and 唐修红 authored May 22, 2024
1 parent 82366df commit 67b7a7e
Show file tree
Hide file tree
Showing 38 changed files with 1,663 additions and 28 deletions.
File renamed without changes.
File renamed without changes.
42 changes: 42 additions & 0 deletions deploy/docker/DockerfileDinkyFlink
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

FROM openjdk:11 as build-stage
ARG FLINK_VERSION=1.17
ENV DINKY_VERSION=1.0.2
ADD dinky-release-${FLINK_VERSION}-${DINKY_VERSION}.tar.gz /

USER root
RUN mv /dinky-release-${FLINK_VERSION}-${DINKY_VERSION} /dinky/
RUN mkdir -p /dinky/run && mkdir -p /dinky/logs && touch /dinky/logs/dinky.log
RUN chmod -R 777 /dinky/


FROM flink:scala_2.12-java11 as reqired-stage

FROM openjdk:11 as production-stage
ARG FLINK_VERSION=1-17
COPY --from=build-stage /dinky/ /dinky/
COPY --from=reqired-stage /opt/flink/lib/*.jar /dinky/extends/flink${FLINK_VERSION}/
RUN rm -f /dinky/extends/flink${FLINK_VERSION}/flink-table-planner-loader*.jar
COPY --from=reqired-stage /opt/flink/opt/flink-table-planner*.jar /dinky/extends/flink${FLINK_VERSION}/
ADD mysql-connector-j-8.1.0.jar /dinky/extends/flink${FLINK_VERSION}/
WORKDIR /dinky/

EXPOSE 8888

CMD ./auto.sh restart && tail -f /dinky/logs/dinky.log
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ version: "3.9"
services:
mysql:
build:
context: ..
context: ../..
dockerfile: ${PWD:-.}/DockerfileMysql

dinky:
image: dinky-standalone-server:${DINKY_VERSION}
build:
context: ..
context: ../..
dockerfile: ${PWD:-.}/Dockerfile
args:
- DINKY_VERSION
Expand All @@ -18,7 +18,7 @@ services:

standalone:
build:
context: ..
context: ../..
dockerfile: ${PWD:-.}/DockerfileDinkyFlink
args:
- FLINK_BIG_VERSION
Expand All @@ -31,5 +31,5 @@ services:

web:
build:
context: ..
context: ../..
dockerfile: ${PWD:-.}/DockerfileWeb
File renamed without changes.
File renamed without changes.
File renamed without changes.
23 changes: 23 additions & 0 deletions deploy/kubernetes/helm/dinky/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
26 changes: 26 additions & 0 deletions deploy/kubernetes/helm/dinky/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#

apiVersion: v2
name: dinky
description: Dinky 为 Apache Flink 而生,让 Flink SQL 纵享丝滑
home: https://www.dinky.org.cn
icon: https://www.dinky.org.cn/side_dinky.svg
type: application
version: 1.0.0
appVersion: 1.0.0
33 changes: 33 additions & 0 deletions deploy/kubernetes/helm/dinky/conf/application-flyway.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#


spring:
flyway:
enabled: true # Is it enabled
group: true # Enable grouping
locations:
- classpath:db/migration/${spring.profiles.active}
table: _dinky_flyway_schema_history
placeholder-replacement: false # Placeholder Replacement
baseline-on-migrate: true # Baseline during migration
baseline-version: 1.0.2 # Baseline version
validate-on-migrate: false # Verify during migration
placeholder-prefix: '##{'
placeholder-suffix: '}##'
fail-on-missing-locations: true # Does the non-existent migration file throw an exception

33 changes: 33 additions & 0 deletions deploy/kubernetes/helm/dinky/conf/application-h2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

spring:
datasource:
driver-class-name: org.h2.Driver
url: jdbc:h2:mem:dinky;MODE=MySQL;DB_CLOSE_DELAY=-1;DATABASE_TO_LOWER=true;
# Note: Since dinky version 1.1.0, Flyway has been integrated, so h2 defaults to memory mode and no longer uses file mode (persistence).
# File mode can cause Flyway to fail to execute duplicate column addition operations correctly
# as h2 does not support stored procedures and cannot determine the existence of columns through stored procedures. Therefore, please do not use file mode
# url: jdbc:h2:./tmp/db/h2;MODE=MySQL;DB_CLOSE_DELAY=-1;DATABASE_TO_LOWER=true;AUTO_SERVER=TRUE;AUTO_SERVER_PORT=29099;
druid:
initial-size: 1
username: dinky
password: dinky
h2:
console:
enabled: true
path: /api/h2
42 changes: 42 additions & 0 deletions deploy/kubernetes/helm/dinky/conf/application-jmx.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#


management:
endpoints:
web:
exposure:
include: "*"
exclude:
- heapdump
- threaddump
- env
enabled-by-default: true
jmx:
exposure:
include: "*"
health:
redis:
enabled: false
ldap:
enabled: false
endpoint:
health:
show-details: always
metrics:
tags:
application: ${spring.application.name}
23 changes: 23 additions & 0 deletions deploy/kubernetes/helm/dinky/conf/application-mysql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

spring:
datasource:
url: jdbc:mysql://${MYSQL_ADDR:127.0.0.1:3306}/${MYSQL_DATABASE:dinky}?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false&zeroDateTimeBehavior=convertToNull&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
username: ${MYSQL_USERNAME:dinky}
password: ${MYSQL_PASSWORD:dinky}
driver-class-name: com.mysql.cj.jdbc.Driver
24 changes: 24 additions & 0 deletions deploy/kubernetes/helm/dinky/conf/application-pgsql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

spring:
datasource:
username: ${POSTGRES_USER:dinky}
password: ${POSTGRES_PASSWORD:dinky}
driver-class-name: org.postgresql.Driver
# The POSTGRES_ADDR variable is not officially provided. If you use docker, please manually add an env to support it.
url: jdbc:postgresql://${POSTGRES_ADDR:localhost:5432}/${POSTGRES_DB:dinky}?stringtype=unspecified
Loading

0 comments on commit 67b7a7e

Please sign in to comment.