Dockerfile文件内容
FROM openjdk:8-jre-alpine
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories && apk add --no-cache tzdata bash && cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo "Asia/Shanghai" > /etc/timezone && mkdir -p /opt/dagu/dags && echo '#!/bin/bash' > /usr/local/bin/rundagu && echo 'dagu scheduler 2> /opt/dagu/scheduler.log &' >> /usr/local/bin/rundagu && echo 'dagu server' >> /usr/local/bin/rundagu && chmod 755 /usr/local/bin/rundagu
COPY dagu /usr/local/bin/
COPY replicadb /opt/replicadb/
ENV DAGU_HOME=/opt/dagu
ENV DAGU_HOST=0.0.0.0
ENV DAGU_PORT=8080
ENV DAGU_DAGS=$DAGU_HOME/dags
ENV DAGU_IS_BASICAUTH=1
ENV DAGU_BASICAUTH_USERNAME="admin"
ENV DAGU_BASICAUTH_PASSWORD="admin"
ENV DAGU_LOG_DIR=$DAGU_HOME/logs
ENV DAGU_DATA_DIR=$DAGU_HOME/data
ENV DAGU_SUSPEND_FLAGS_DIR=$DAGU_HOME/suspend
ENV DAGU_ADMIN_LOG_DIR=$DAGU_HOME/logs/admin
ENV DAGU_BASE_CONFIG=$DAGU_HOME/config.yaml
ENV DAGU_NAVBAR_COLOR="#a0aeba"
ENV DAGU_NAVBAR_TITLE="Dagu"
EXPOSE 8080
ENTRYPOINT rundagu
构建
docker build -t dagu-replicadb:v1.12.5 -f Dockerfile .
运行
docker run -it --name dagu -p 8081:8080 --rm dagu-replicadb:v1.12.5
编写测试任务
浏览器访问http://192.168.1.88:8081/
在线编写yaml文件保存并运行(注意缩进)
name: ETL-test1
description: "测试ETL"
schedule: "0 01 * * *"
steps:
- name: "测试replicadb1"
command: "bash"
script: |
/opt/replicadb/bin/replicadb --mode=complete -j=1 \
--source-connect=jdbc:oracle:thin:@192.168.1.66:1521/ORCLPDB1 \
--source-user=TEST1 \
--source-password='test1000' \
--source-query='SELECT T.ID, T.RYZT, T.RYZTM, T.PX, T1.RYZT RYZT1
FROM JZG_JCSJ_PX T
LEFT JOIN JZG_JCSJ_PX T1 ON T.ID=T1.ID' \
--sink-connect=jdbc:oracle:thin:@192.168.1.66:1521/ORCLPDB1 \
--sink-user=TEST1 \
--sink-password='test1000' \
--sink-table=TEST_JZG_JCSJ_PX \
--sink-columns=ID,RYZT,RYZTM,PX,RYZT1 \
--verbose