This is an automated email from the ASF dual-hosted git repository.
benjobs pushed a commit to branch dev-2.1.5
in repository https://gitbox.apache.org/repos/asf/incubator-streampark.git
The following commit(s) were added to refs/heads/dev-2.1.5 by this push:
new 42fa759f3 docker improvement (#3928)
42fa759f3 is described below
commit 42fa759f340cbc9eabbc62ebf8e7089a27ef2628
Author: xiangzihao <[email protected]>
AuthorDate: Wed Jul 31 12:03:03 2024 +0800
docker improvement (#3928)
---
docker/Dockerfile | 97 +++++++++++++++++++++++++++++-----------------
docker/README.md | 4 +-
docker/config.yaml | 85 ----------------------------------------
docker/docker-compose.yaml | 50 ++++++++----------------
4 files changed, 81 insertions(+), 155 deletions(-)
diff --git a/docker/Dockerfile b/docker/Dockerfile
index 25f88778f..a49a31da8 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -14,39 +14,66 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
+FROM ubuntu:22.04
-FROM alpine:3.16 as deps-stage
-COPY . /
-WORKDIR /
-RUN tar zxvf dist/apache-streampark_*-*-bin.tar.gz \
-&& mv apache-streampark_*-*-bin streampark
-
-FROM docker:dind
-WORKDIR /streampark
-COPY --from=deps-stage /streampark /streampark
-
-ENV NODE_VERSION=16.1.0
-ENV NPM_VERSION=7.11.2
-
-RUN apk add openjdk8 \
- && apk add maven \
- && apk add wget \
- && apk add vim \
- && apk add bash \
- && apk add curl
-
-ENV JAVA_HOME=/usr/lib/jvm/java-1.8-openjdk
-ENV MAVEN_HOME=/usr/share/java/maven-3
-ENV PATH $JAVA_HOME/bin:$PATH
-ENV PATH $MAVEN_HOME/bin:$PATH
-
-RUN wget
"https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64.tar.gz" \
- && tar zxvf "node-v$NODE_VERSION-linux-x64.tar.gz" -C /usr/local
--strip-components=1 \
- && rm "node-v$NODE_VERSION-linux-x64.tar.gz" \
- && ln -s /usr/local/bin/node /usr/local/bin/nodejs \
- && curl -LO https://dl.k8s.io/release/v1.23.0/bin/linux/amd64/kubectl \
- && install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
-
-RUN mkdir -p ~/.kube
-
-EXPOSE 10000
+USER root
+
+# Install basic tools
+RUN apt update && apt install -y wget curl vim net-tools iputils-ping \
+ && apt install software-properties-common -y \
+ && add-apt-repository ppa:openjdk-r/ppa -y
+RUN apt update && apt install -y openjdk-8-jdk
+RUN JAVA_PATH=$(ls -l /usr/lib/jvm | grep java-8-openjdk | grep ^d | awk -F '
' '{print $9}'); \
+ if [ -z "${JAVA_PATH}" ];then \
+ echo "JAVA_PATH not found: $JAVA_PATH"; \
+ exit 2; \
+ else \
+ ln -s /usr/lib/jvm/$JAVA_PATH/ /usr/lib/jvm/jdk8; \
+ fi
+ENV JAVA_HOME=/usr/lib/jvm/jdk8
+
+
+# Install docker
+RUN \
+ # Add Docker's official GPG key:
+ apt update && \
+ apt install -y ca-certificates curl gnupg && \
+ install -m 0755 -d /etc/apt/keyrings && \
+ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o
/etc/apt/keyrings/docker.gpg && \
+ chmod a+r /etc/apt/keyrings/docker.gpg && \
+ # Add the repository to Apt sources:
+ echo \
+ "deb [arch="$(dpkg --print-architecture)"
signed-by=/etc/apt/keyrings/docker.gpg]
https://download.docker.com/linux/ubuntu \
+ "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
+ tee /etc/apt/sources.list.d/docker.list > /dev/null && \
+ apt update && \
+ # Install the Docker packages.
+ apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin
docker-compose-plugin
+
+
+# Install Tini
+ARG TARGETPLATFORM
+ENV TINI_VERSION v0.19.0
+RUN echo "TARGETPLATFORM: $TARGETPLATFORM"
+RUN \
+ if [ "$TARGETPLATFORM" = "linux/amd64" ];then \
+ TINI_PLATFORM=amd64; \
+ wget --no-check-certificate -O /usr/sbin/tini
https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-$TINI_PLATFORM;
\
+ elif [ "$TARGETPLATFORM" = "linux/arm64" ];then \
+ TINI_PLATFORM=arm64; \
+ wget --no-check-certificate -O /usr/sbin/tini
https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-$TINI_PLATFORM;
\
+ else \
+ echo "unknown TARGETPLATFORM: $TARGETPLATFORM"; \
+ exit 2; \
+ fi
+RUN chmod +x /usr/sbin/tini
+
+
+# Install StreamPark
+COPY dist/apache-streampark_*-bin.tar.gz /
+RUN tar -zxvf apache-streampark_*-bin.tar.gz \
+ && mv apache-streampark_*-bin streampark \
+ && rm -f apache-streampark_*-bin.tar.gz
+
+
+ENTRYPOINT ["/usr/sbin/tini", "--", "/streampark/bin/streampark.sh",
"start_docker"]
diff --git a/docker/README.md b/docker/README.md
index 9b2b114e7..d74b966fd 100644
--- a/docker/README.md
+++ b/docker/README.md
@@ -6,8 +6,8 @@ The latest image tag will be written to
[docker-compose.yaml](./docker-compose.y
```yaml
version: '3.8'
services:
- streampark-console:
- image: apache/streampark:2.2.0
+ streampark:
+ image: apache/streampark:2.1.5
```
### 2. docker-compose up
diff --git a/docker/config.yaml b/docker/config.yaml
deleted file mode 100644
index da0809065..000000000
--- a/docker/config.yaml
+++ /dev/null
@@ -1,85 +0,0 @@
-#
-# 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.
-#
-
-logging:
- level:
- root: info
-
-server:
- port: 10000
- session:
- # The user's login session has a validity period. If it exceeds this time,
the user will be automatically logout
- # unit: s|m|h|d, s: second, m:minute, h:hour, d: day
- ttl: 2h # unit[s|m|h|d], e.g: 24h, 2d....
- undertow: # see:
https://github.com/undertow-io/undertow/blob/master/core/src/main/java/io/undertow/Undertow.java
- buffer-size: 1024
- direct-buffers: true
- threads:
- io: 16
- worker: 256
-
-# system database, default h2, mysql|pgsql|h2
-datasource:
- dialect: h2 #h2, pgsql
- # if datasource.dialect is mysql or pgsql, you need to configure the
following connection information
- # mysql/postgresql connect user
- username:
- # mysql/postgresql connect password
- password:
- # mysql/postgresql connect jdbcURL
- # mysql example: datasource.url:
jdbc:mysql://localhost:3306/streampark?useUnicode=true&characterEncoding=UTF-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8
- # postgresql example:
jdbc:postgresql://localhost:5432/streampark?stringtype=unspecified
- url:
-
-streampark:
- workspace:
- # Local workspace, storage directory of clone projects and compiled
projects,Do not set under $APP_HOME. Set it to a directory outside of $APP_HOME.
- local: /tmp/streampark
- # The root hdfs path of the jars, Same as yarn.provided.lib.dirs for flink
on yarn-application and Same as --jars for spark on yarn
- remote: hdfs:///streampark/
- proxy:
- # lark proxy address, default https://open.feishu.cn
- lark-url:
- # hadoop yarn proxy path, e.g: knox process address
https://streampark.com:8443/proxy/yarn
- yarn-url:
- yarn:
- # flink on yarn or spark on yarn, monitoring job status from yarn, it is
necessary to set hadoop.http.authentication.type
- http-auth: 'simple' # default simple, or kerberos
- # flink on yarn or spark on yarn, HADOOP_USER_NAME
- hadoop-user-name: hdfs
-
-# flink on yarn or spark on yarn, when the hadoop cluster enable kerberos
authentication, it is necessary to set Kerberos authentication parameters.
-security:
- kerberos:
- login:
- debug: false
- enable: false
- keytab:
- krb5:
- principal:
- ttl: 2h # unit [s|m|h|d]
-
-# sign streampark with ldap.
-ldap:
- base-dn: dc=streampark,dc=com # Login Account
- enable: false # ldap enabled'
- username: cn=Manager,dc=streampark,dc=com
- password: streampark
- urls: ldap://99.99.99.99:389 #AD server IP, default port 389
- user:
- email-attribute: mail
- identity-attribute: uid
diff --git a/docker/docker-compose.yaml b/docker/docker-compose.yaml
index 7d6ffe6d0..dbbdc804e 100644
--- a/docker/docker-compose.yaml
+++ b/docker/docker-compose.yaml
@@ -15,50 +15,34 @@
# limitations under the License.
version: '3.8'
+
services:
- streampark-console:
- image: apache/streampark:latest
- command: '/bin/sh -c "wget -P lib
https://repo1.maven.org/maven2/com/mysql/mysql-connector-j/8.0.31/mysql-connector-j-8.0.31.jar
&& bash bin/streampark.sh start_docker "'
+ streampark:
+ image: apache/streampark:2.1.5
ports:
- "10000:10000"
+ environment:
+ - TZ=Asia/Shanghai
+ - DATASOURCE_DIALECT=h2 # h2, mysql, pgsql
+ # If use mysql or pgsql, please set the following parameters
+ # -
DATASOURCE_URL=jdbc:mysql://localhost:3306/streampark?useSSL=false&useUnicode=true&characterEncoding=UTF-8&allowPublicKeyRetrieval=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8
+ # -
DATASOURCE_URL=jdbc:postgresql://localhost:5432/streampark?stringtype=unspecified
+ # - DATASOURCE_USERNAME=root
+ # - DATASOURCE_PASSWORD=streampark
volumes:
- - ./config.yaml:/streampark/conf/config.yaml
- - flink:/streampark/flink/flink1.14.5
- /var/run/docker.sock:/var/run/docker.sock
- /etc/hosts:/etc/hosts:ro
- ~/.kube:/root/.kube:ro
privileged: true
- restart: unless-stopped
- networks:
- - streampark
-
- flink-jobmanager:
- image: flink:1.14.5-scala_2.12
- ports:
- - "8081:8081"
- command: jobmanager
- volumes:
- - flink:/opt/flink
- restart: unless-stopped
- privileged: true
- networks:
- - streampark
-
- flink-taskmanager:
- image: flink:1.14.5-scala_2.12
- depends_on:
- - flink-jobmanager
- command: taskmanager
- deploy:
- replicas: 1
- restart: unless-stopped
- privileged: true
+ restart: always
networks:
- streampark
+ healthcheck:
+ test: [ "CMD", "curl", "http://streampark:10000" ]
+ interval: 5s
+ timeout: 5s
+ retries: 120
networks:
streampark:
driver: bridge
-
-volumes:
- flink: