Browse Source

[Bug] fix run on docker and k8s (#10026)

* fix docker-compose init schema

* recovery depend on zk

* update doc and dockerfile

* fix run on k8s

* udpate doc

* add DOCKER flag & update doc

* remove repeat DOCKER env
3.1.0-release
caishunfeng 2 years ago committed by GitHub
parent
commit
b1885c7a26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 22
      deploy/docker/docker-compose.yml
  2. 2
      deploy/kubernetes/dolphinscheduler/templates/deployment-dolphinscheduler-alert.yaml
  3. 6
      deploy/kubernetes/dolphinscheduler/templates/deployment-dolphinscheduler-api.yaml
  4. 4
      deploy/kubernetes/dolphinscheduler/templates/job-dolphinscheduler-schema-initializer.yaml
  5. 2
      deploy/kubernetes/dolphinscheduler/templates/statefulset-dolphinscheduler-master.yaml
  6. 2
      deploy/kubernetes/dolphinscheduler/templates/statefulset-dolphinscheduler-worker.yaml
  7. 17
      docs/docs/en/guide/start/docker.md
  8. 17
      docs/docs/zh/guide/start/docker.md
  9. 4
      dolphinscheduler-tools/src/main/bin/upgrade-schema.sh
  10. 3
      dolphinscheduler-tools/src/main/docker/Dockerfile

22
deploy/docker/docker-compose.yml

@ -19,6 +19,9 @@ version: "3.8"
services:
dolphinscheduler-postgresql:
image: bitnami/postgresql:11.11.0
ports:
- "5432:5432"
profiles: ["all", "schema"]
environment:
POSTGRESQL_USERNAME: root
POSTGRESQL_PASSWORD: root
@ -35,6 +38,7 @@ services:
dolphinscheduler-zookeeper:
image: bitnami/zookeeper:3.6.2
profiles: ["all"]
environment:
ALLOW_ANONYMOUS_LOGIN: "yes"
ZOO_4LW_COMMANDS_WHITELIST: srvr,ruok,wchs,cons
@ -51,7 +55,8 @@ services:
dolphinscheduler-schema-initializer:
image: ${HUB}/dolphinscheduler-tools:${TAG}
env_file: .env
command: [ bin/create-schema.sh ]
profiles: ["schema"]
command: [ tools/bin/upgrade-schema.sh ]
depends_on:
dolphinscheduler-postgresql:
condition: service_healthy
@ -66,15 +71,14 @@ services:
image: ${HUB}/dolphinscheduler-api:${TAG}
ports:
- "12345:12345"
profiles: ["all"]
env_file: .env
healthcheck:
test: [ "CMD", "curl", "http://localhost:12345/actuator/health" ]
test: [ "CMD", "curl", "http://localhost:12345/dolphinscheduler/actuator/health" ]
interval: 30s
timeout: 5s
retries: 3
depends_on:
dolphinscheduler-schema-initializer:
condition: service_completed_successfully
dolphinscheduler-zookeeper:
condition: service_healthy
volumes:
@ -86,15 +90,13 @@ services:
dolphinscheduler-alert:
image: ${HUB}/dolphinscheduler-alert-server:${TAG}
profiles: ["all"]
env_file: .env
healthcheck:
test: [ "CMD", "curl", "http://localhost:50053/actuator/health" ]
interval: 30s
timeout: 5s
retries: 3
depends_on:
dolphinscheduler-schema-initializer:
condition: service_completed_successfully
volumes:
- dolphinscheduler-logs:/opt/dolphinscheduler/logs
networks:
@ -102,6 +104,7 @@ services:
dolphinscheduler-master:
image: ${HUB}/dolphinscheduler-master:${TAG}
profiles: ["all"]
env_file: .env
healthcheck:
test: [ "CMD", "curl", "http://localhost:5679/actuator/health" ]
@ -109,8 +112,6 @@ services:
timeout: 5s
retries: 3
depends_on:
dolphinscheduler-schema-initializer:
condition: service_completed_successfully
dolphinscheduler-zookeeper:
condition: service_healthy
volumes:
@ -121,6 +122,7 @@ services:
dolphinscheduler-worker:
image: ${HUB}/dolphinscheduler-worker:${TAG}
profiles: ["all"]
env_file: .env
healthcheck:
test: [ "CMD", "curl", "http://localhost:1235/actuator/health" ]
@ -128,8 +130,6 @@ services:
timeout: 5s
retries: 3
depends_on:
dolphinscheduler-schema-initializer:
condition: service_completed_successfully
dolphinscheduler-zookeeper:
condition: service_healthy
volumes:

2
deploy/kubernetes/dolphinscheduler/templates/deployment-dolphinscheduler-alert.yaml

@ -67,6 +67,8 @@ spec:
env:
- name: TZ
value: {{ .Values.timezone }}
- name: SPRING_JACKSON_TIME_ZONE
value: {{ .Values.timezone }}
{{- include "dolphinscheduler.database.env_vars" . | nindent 12 }}
{{ range $key, $value := .Values.alert.env }}
- name: {{ $key }}

6
deploy/kubernetes/dolphinscheduler/templates/deployment-dolphinscheduler-api.yaml

@ -65,6 +65,8 @@ spec:
env:
- name: TZ
value: {{ .Values.timezone }}
- name: SPRING_JACKSON_TIME_ZONE
value: {{ .Values.timezone }}
{{- include "dolphinscheduler.database.env_vars" . | nindent 12 }}
{{- include "dolphinscheduler.registry.env_vars" . | nindent 12 }}
{{- include "dolphinscheduler.fs_s3a.env_vars" . | nindent 12 }}
@ -82,7 +84,7 @@ spec:
{{- if .Values.api.livenessProbe.enabled }}
livenessProbe:
exec:
command: ["curl", "-s", "http://localhost:12345/actuator/health/liveness"]
command: ["curl", "-s", "http://localhost:12345/dolphinscheduler/actuator/health/liveness"]
initialDelaySeconds: {{ .Values.api.livenessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.api.livenessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.api.livenessProbe.timeoutSeconds }}
@ -92,7 +94,7 @@ spec:
{{- if .Values.api.readinessProbe.enabled }}
readinessProbe:
exec:
command: ["curl", "-s", "http://localhost:12345/actuator/health/readiness"]
command: ["curl", "-s", "http://localhost:12345/dolphinscheduler/actuator/health/readiness"]
initialDelaySeconds: {{ .Values.api.readinessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.api.readinessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.api.readinessProbe.timeoutSeconds }}

4
deploy/kubernetes/dolphinscheduler/templates/job-dolphinscheduler-schema-initializer.yaml

@ -38,10 +38,12 @@ spec:
image: {{ include "dolphinscheduler.image.fullname.tools" . }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
args:
- bin/create-schema.sh
- tools/bin/upgrade-schema.sh
env:
- name: TZ
value: {{ .Values.timezone }}
- name: SPRING_JACKSON_TIME_ZONE
value: {{ .Values.timezone }}
{{- include "dolphinscheduler.database.env_vars" . | nindent 12 }}
{{- include "dolphinscheduler.registry.env_vars" . | nindent 12 }}
{{- include "dolphinscheduler.fs_s3a.env_vars" . | nindent 12 }}

2
deploy/kubernetes/dolphinscheduler/templates/statefulset-dolphinscheduler-master.yaml

@ -62,6 +62,8 @@ spec:
env:
- name: TZ
value: {{ .Values.timezone }}
- name: SPRING_JACKSON_TIME_ZONE
value: {{ .Values.timezone }}
{{- include "dolphinscheduler.database.env_vars" . | nindent 12 }}
{{- include "dolphinscheduler.registry.env_vars" . | nindent 12 }}
{{- include "dolphinscheduler.fs_s3a.env_vars" . | nindent 12 }}

2
deploy/kubernetes/dolphinscheduler/templates/statefulset-dolphinscheduler-worker.yaml

@ -62,6 +62,8 @@ spec:
env:
- name: TZ
value: {{ .Values.timezone }}
- name: SPRING_JACKSON_TIME_ZONE
value: {{ .Values.timezone }}
- name: ALERT_LISTEN_HOST
value: {{ include "dolphinscheduler.fullname" . }}-alert
{{- include "dolphinscheduler.database.env_vars" . | nindent 12 }}

17
docs/docs/en/guide/start/docker.md

@ -9,7 +9,7 @@ or zookeeper server already exists.
## Prepare
- [Docker](https://docs.docker.com/engine/install/) 1.13.1+
- [Docker Compose](https://docs.docker.com/compose/) 1.11.0+
- [Docker Compose](https://docs.docker.com/compose/) 1.28.0+
## Start Server
@ -54,9 +54,13 @@ $ tar -zxf apache-dolphinscheduler-"${DOLPHINSCHEDULER_VERSION}"-src.tar.gz
# Going to docker-compose's location
# For Mac or Linux users
$ cd apache-dolphinscheduler-"${DOLPHINSCHEDULER_VERSION}"-src/deploy/docker
# For Windows users
$ cd apache-dolphinscheduler-"${DOLPHINSCHEDULER_VERSION}"-src\deploy\docker
$ docker-compose up -d
# For Windows users, you should run command `cd apache-dolphinscheduler-"${DOLPHINSCHEDULER_VERSION}"-src\deploy\docker`
# Initialize the database, use profile schema
$ docker-compose --profile schema up -d
# start all dolphinscheduler server, use profile all
$ docker-compose --profile all up -d
```
> NOTES: It will not only start DolphinScheduler servers but also some others necessary services like PostgreSQL(with `root`
@ -78,6 +82,7 @@ $ docker run -d --name dolphinscheduler-tools \
-e SPRING_DATASOURCE_URL="jdbc:postgresql://localhost:5432/<DATABASE>" \
-e SPRING_DATASOURCE_USERNAME="<USER>" \
-e SPRING_DATASOURCE_PASSWORD="<PASSWORD>" \
--net host \
apache/dolphinscheduler-tools:"${DOLPHINSCHEDULER_VERSION}" bin/create-schema.sh
# Starting DolphinScheduler service
$ docker run -d --name dolphinscheduler-master \
@ -87,6 +92,7 @@ $ docker run -d --name dolphinscheduler-master \
-e SPRING_DATASOURCE_USERNAME="<USER>" \
-e SPRING_DATASOURCE_PASSWORD="<PASSWORD>" \
-e REGISTRY_ZOOKEEPER_CONNECT_STRING="localhost:2181" \
--net host \
-d apache/dolphinscheduler-master:"${DOLPHINSCHEDULER_VERSION}"
$ docker run -d --name dolphinscheduler-worker \
-e DATABASE="postgresql" \
@ -95,6 +101,7 @@ $ docker run -d --name dolphinscheduler-worker \
-e SPRING_DATASOURCE_USERNAME="<USER>" \
-e SPRING_DATASOURCE_PASSWORD="<PASSWORD>" \
-e REGISTRY_ZOOKEEPER_CONNECT_STRING="localhost:2181" \
--net host \
-d apache/dolphinscheduler-worker:"${DOLPHINSCHEDULER_VERSION}"
$ docker run -d --name dolphinscheduler-api \
-e DATABASE="postgresql" \
@ -103,6 +110,7 @@ $ docker run -d --name dolphinscheduler-api \
-e SPRING_DATASOURCE_USERNAME="<USER>" \
-e SPRING_DATASOURCE_PASSWORD="<PASSWORD>" \
-e REGISTRY_ZOOKEEPER_CONNECT_STRING="localhost:2181" \
--net host \
-d apache/dolphinscheduler-api:"${DOLPHINSCHEDULER_VERSION}"
$ docker run -d --name dolphinscheduler-alert-server \
-e DATABASE="postgresql" \
@ -111,6 +119,7 @@ $ docker run -d --name dolphinscheduler-alert-server \
-e SPRING_DATASOURCE_USERNAME="<USER>" \
-e SPRING_DATASOURCE_PASSWORD="<PASSWORD>" \
-e REGISTRY_ZOOKEEPER_CONNECT_STRING="localhost:2181" \
--net host \
-d apache/dolphinscheduler-alert-server:"${DOLPHINSCHEDULER_VERSION}"
```

17
docs/docs/zh/guide/start/docker.md

@ -7,7 +7,7 @@
## 前置条件
- [Docker](https://docs.docker.com/engine/install/) 1.13.1+
- [Docker Compose](https://docs.docker.com/compose/) 1.11.0+
- [Docker Compose](https://docs.docker.com/compose/) 1.28.0+
## 启动服务
@ -47,9 +47,13 @@ $ DOLPHINSCHEDULER_VERSION=<version>
$ tar -zxf apache-dolphinscheduler-"${DOLPHINSCHEDULER_VERSION}"-src.tar.gz
# Mac Linux 用户
$ cd apache-dolphinscheduler-"${DOLPHINSCHEDULER_VERSION}"-src/deploy/docker
# Windows 用户
$ cd apache-dolphinscheduler-"${DOLPHINSCHEDULER_VERSION}"-src\deploy\docker
$ docker-compose up -d
# Windows 用户, `cd apache-dolphinscheduler-"${DOLPHINSCHEDULER_VERSION}"-src\deploy\docker`
# 如果需要初始化或者升级数据库结构,需要指定profile为schema
$ docker-compose --profile schema up -d
# 启动dolphinscheduler所有服务,指定profile为all
$ docker-compose --profile all up -d
```
> 提醒:通过 docker-compose 启动服务时,除了会启动 DolphinScheduler 对应的服务外,还会启动必要依赖服务,如数据库 PostgreSQL(用户
@ -70,6 +74,7 @@ $ docker run -d --name dolphinscheduler-tools \
-e SPRING_DATASOURCE_URL="jdbc:postgresql://localhost:5432/<DATABASE>" \
-e SPRING_DATASOURCE_USERNAME="<USER>" \
-e SPRING_DATASOURCE_PASSWORD="<PASSWORD>" \
--net host \
apache/dolphinscheduler-tools:"${DOLPHINSCHEDULER_VERSION}" bin/create-schema.sh
# 启动 DolphinScheduler 对应的服务
$ docker run -d --name dolphinscheduler-master \
@ -79,6 +84,7 @@ $ docker run -d --name dolphinscheduler-master \
-e SPRING_DATASOURCE_USERNAME="<USER>" \
-e SPRING_DATASOURCE_PASSWORD="<PASSWORD>" \
-e REGISTRY_ZOOKEEPER_CONNECT_STRING="localhost:2181" \
--net host \
-d apache/dolphinscheduler-master:"${DOLPHINSCHEDULER_VERSION}"
$ docker run -d --name dolphinscheduler-worker \
-e DATABASE="postgresql" \
@ -87,6 +93,7 @@ $ docker run -d --name dolphinscheduler-worker \
-e SPRING_DATASOURCE_USERNAME="<USER>" \
-e SPRING_DATASOURCE_PASSWORD="<PASSWORD>" \
-e REGISTRY_ZOOKEEPER_CONNECT_STRING="localhost:2181" \
--net host \
-d apache/dolphinscheduler-worker:"${DOLPHINSCHEDULER_VERSION}"
$ docker run -d --name dolphinscheduler-api \
-e DATABASE="postgresql" \
@ -95,6 +102,7 @@ $ docker run -d --name dolphinscheduler-api \
-e SPRING_DATASOURCE_USERNAME="<USER>" \
-e SPRING_DATASOURCE_PASSWORD="<PASSWORD>" \
-e REGISTRY_ZOOKEEPER_CONNECT_STRING="localhost:2181" \
--net host \
-d apache/dolphinscheduler-api:"${DOLPHINSCHEDULER_VERSION}"
$ docker run -d --name dolphinscheduler-alert-server \
-e DATABASE="postgresql" \
@ -103,6 +111,7 @@ $ docker run -d --name dolphinscheduler-alert-server \
-e SPRING_DATASOURCE_USERNAME="<USER>" \
-e SPRING_DATASOURCE_PASSWORD="<PASSWORD>" \
-e REGISTRY_ZOOKEEPER_CONNECT_STRING="localhost:2181" \
--net host \
-d apache/dolphinscheduler-alert-server:"${DOLPHINSCHEDULER_VERSION}"
```

4
dolphinscheduler-tools/src/main/bin/upgrade-schema.sh

@ -19,7 +19,9 @@
BIN_DIR=$(dirname $0)
DOLPHINSCHEDULER_HOME=${DOLPHINSCHEDULER_HOME:-$(cd $BIN_DIR/../..; pwd)}
source "$DOLPHINSCHEDULER_HOME/bin/env/dolphinscheduler_env.sh"
if [ "$DOCKER" != "true" ]; then
source "$DOLPHINSCHEDULER_HOME/bin/env/dolphinscheduler_env.sh"
fi
JAVA_OPTS=${JAVA_OPTS:-"-server -Duser.timezone=${SPRING_JACKSON_TIME_ZONE} -Xms1g -Xmx1g -Xmn512m -XX:+PrintGCDetails -Xloggc:gc.log -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=dump.hprof"}

3
dolphinscheduler-tools/src/main/docker/Dockerfile

@ -27,6 +27,7 @@ RUN apt update ; \
WORKDIR $DOLPHINSCHEDULER_HOME
ADD ./target/tools $DOLPHINSCHEDULER_HOME
# see doc: https://dolphinscheduler.apache.org/en-us/docs/dev/user_doc/guide/upgrade.html
ADD ./target/tools $DOLPHINSCHEDULER_HOME/tools
ENTRYPOINT [ "/bin/bash" ]

Loading…
Cancel
Save