update
This commit is contained in:
67
datax-web/ADD/ccmd
Executable file
67
datax-web/ADD/ccmd
Executable file
@@ -0,0 +1,67 @@
|
||||
#!/bin/bash
|
||||
|
||||
##################################################
|
||||
# Mount dir #
|
||||
# - /opt/datax-web-2.1.2/modules/datax-admin/logs#
|
||||
# - /opt/datax-web-2.1.2/modules/datax-admin/bin/console.out#
|
||||
# - /opt/datax-web-2.1.2/modules/datax-datax-executor/logs#
|
||||
# - /opt/datax-web-2.1.2/modules/datax-datax-executor/bin/console.out#
|
||||
# ENV #
|
||||
# - JAVA_OPTS #
|
||||
# - TIMEOUT #
|
||||
# - MAX_PROCS #
|
||||
##################################################
|
||||
|
||||
set -euo pipefail
|
||||
export LANG=en_US.UTF-8
|
||||
trap Quit EXIT
|
||||
|
||||
GOT_SIGTERM=
|
||||
TIMEOUT="${TIMEOUT:-10m}"
|
||||
MAX_PROCS=${MAX_PROCS:-1}
|
||||
|
||||
function Print {
|
||||
local file=/dev/null
|
||||
[ '-f' = "$1" ] && file=$2 && shift && shift
|
||||
date +"[%F %T] $*" | tee -a $file
|
||||
}
|
||||
|
||||
function Quit {
|
||||
while :; do
|
||||
pkill -f java && Print killing java ... || break
|
||||
sleep 1
|
||||
done
|
||||
# exec 1022<&-
|
||||
Print Container stopped.
|
||||
test -n "$GOT_SIGTERM"
|
||||
}
|
||||
|
||||
|
||||
|
||||
function ModifyConf {
|
||||
local kv=
|
||||
Print Modify bootstrap.properties ...
|
||||
while read kv; do
|
||||
[ -z "$kv" ] && return 0
|
||||
Print Modify property: ${kv%%=*} ...
|
||||
sed -i "/^#${kv%%=*} *=/c$kv" /opt/datax-web-2.1.2/modules/datax-admin/conf/bootstrap.properties
|
||||
done <<< "$(env | grep '^_CONF_' | sed 's/_CONF_//')"
|
||||
}
|
||||
|
||||
function StartProc {
|
||||
Print Start datax-web
|
||||
cd /opt/datax-web-2.1.2
|
||||
/usr/bin/bash bin/start-all.sh
|
||||
tail -f /dev/null
|
||||
}
|
||||
|
||||
|
||||
function Main {
|
||||
ModifyConf
|
||||
trap "GOT_SIGTERM=1; Print Got SIGTERM ...; exit" SIGTERM
|
||||
StartProc
|
||||
}
|
||||
|
||||
# Start here
|
||||
Main
|
||||
|
11
datax-web/Dockerfile
Normal file
11
datax-web/Dockerfile
Normal file
@@ -0,0 +1,11 @@
|
||||
ARG ARCH
|
||||
FROM harbor.colben.cn/general/jdk$ARCH:8u202
|
||||
MAINTAINER Colben colbenlee@gmail.com
|
||||
ADD --chown=root:root /ADD/ /opt/
|
||||
RUN tar xf /opt/datax-web-2.1.2.tar.gz -C /opt/ && \
|
||||
cd /opt/datax-web-2.1.2 && \
|
||||
./bin/install.sh -f && \
|
||||
yum makecache fast && yum install -y awk && rm -rf /var/cache/tdnf/ && \
|
||||
rm -rf /opt/datax-web-2.1.2.tar.gz
|
||||
CMD ["/opt/ccmd"]
|
||||
|
18
datax-web/README.md
Normal file
18
datax-web/README.md
Normal file
@@ -0,0 +1,18 @@
|
||||
# 构建 datax-web 镜像
|
||||
|
||||
## 导入文件
|
||||
- [下载 datax-web.git]( https://github.com/WeiYe-Jing/datax-web.git)
|
||||
|
||||
|
||||
## 外挂目录和文件
|
||||
- /opt/datax-web-2.1.2/modules/datax-admin/bin/console.out: admin 日志文件
|
||||
- /opt/datax-web-2.1.2/modules/datax-datax-executor/bin/console.out: 执行器日志文件
|
||||
|
||||
## db文件在容器里边
|
||||
- 启动容器后docker cp {datax-web}:/opt/datax-web-2.1.2/bin/db/datax_web.sql .
|
||||
- 创建数据库: create database datax_web;
|
||||
- 导入数据:use datax_web ; source datax_web.sql;
|
||||
- 创建用户:create user admin@'%' identified by '123456';
|
||||
- 授权用户:grant all on datax_web.* to admin@'%';
|
||||
- 访问地址 http://服务器ip:9527/index.html 帐号:admin 密码:123456
|
||||
## docker-compose.yml案例
|
77
datax-web/datax-web.sh
Executable file
77
datax-web/datax-web.sh
Executable file
@@ -0,0 +1,77 @@
|
||||
#!/bin/bash
|
||||
|
||||
#=========================================
|
||||
# Author : colben
|
||||
#=========================================
|
||||
|
||||
set -euo pipefail
|
||||
export LANG=en_US.UTF-8
|
||||
trap Quit EXIT
|
||||
|
||||
[ 'x86_64' == "$(uname -m)" ] && ARCH='' || ARCH="-$(uname -m)"
|
||||
ROOT_DIR="$(cd $(dirname $0) && pwd)"
|
||||
IMAGE="harbor.colben.cn/general/$(basename ${0%.sh})$ARCH:latest"
|
||||
|
||||
if [ -t 0 ]; then
|
||||
function Print { echo -e "\033[36;1m$(date +'[%F %T]')\033[32;1m $*\033[0m"; }
|
||||
function Warn { echo -e "\033[36;1m$(date +'[%F %T]')\033[33;1m $*\033[0m"; }
|
||||
function Error { echo -e "\033[36;1m$(date +'[%F %T]')\033[31;1m $*\033[0m"; exit 1; }
|
||||
else
|
||||
function Print { echo -e "$(date +'[%F %T INFO]') $*"; }
|
||||
function Warn { echo -e "$(date +'[%F %T WARN]') $*"; }
|
||||
function Error { echo -e "$(date +'[%F %T ERROR]') $*"; exit 1; }
|
||||
fi
|
||||
|
||||
function Quit {
|
||||
local exitCode=$?
|
||||
[ 0 -ne $exitCode ] && Error Failed to build or push image!
|
||||
[ -z "${END:-}" ] && echo && Error Interrupted manually!
|
||||
Print Succeeded to build and push image.
|
||||
}
|
||||
|
||||
function YesOrNo {
|
||||
Warn $*
|
||||
local sw=
|
||||
while :; do
|
||||
read -p '(Yes/No/Quit) ' -n1 sw
|
||||
[[ "$sw" =~ ^Y|y$ ]] && echo && return 0
|
||||
[[ "$sw" =~ ^N|n$ ]] && echo && return 1
|
||||
[[ "$sw" =~ ^Q|q$ ]] && echo && exit 0
|
||||
[ -n "$sw" ] && echo
|
||||
done
|
||||
}
|
||||
|
||||
function Update {
|
||||
Warn Preparing datax ...
|
||||
cd $ROOT_DIR/ADD
|
||||
rm -rf $(ls | grep -v ccmd || true)
|
||||
tar zxf /release/RUNTIME/datax.tar.gz -C .
|
||||
rm -rf datax/tmp datax/job/*.json
|
||||
rm -f datax/plugin/writer/mysqlwriter/libs/mysql-connector-java-5.1.34.jar
|
||||
rm -f datax/plugin/reader/mysqlreader/libs/mysql-connector-java-5.1.34.jar
|
||||
cp /release/RUNTIME/mysql-connector-java-8.0.27.jar datax/plugin/reader/mysqlreader/libs/
|
||||
cp /release/RUNTIME/mysql-connector-java-8.0.27.jar datax/plugin/writer/mysqlwriter/libs/
|
||||
find datax/ -type f | xargs chmod 0644
|
||||
mkdir datax/{hook,log,log_perf}
|
||||
}
|
||||
|
||||
function Build {
|
||||
local yn
|
||||
cd $ROOT_DIR
|
||||
docker images --format='{{.Repository}}:{{.Tag}}' | grep "^$IMAGE$" \
|
||||
&& Warn Removing image $IMAGE ... \
|
||||
&& docker rmi $IMAGE
|
||||
Warn Building image: $IMAGE ...
|
||||
docker build --force-rm --build-arg ARCH="$ARCH" -t $IMAGE .
|
||||
# YesOrNo Push image: $IMAGE? && docker push $IMAGE
|
||||
}
|
||||
|
||||
function Main {
|
||||
# Update
|
||||
Build
|
||||
END=1
|
||||
}
|
||||
|
||||
# Start here
|
||||
Main
|
||||
|
26
datax-web/docker-compose.yml
Normal file
26
datax-web/docker-compose.yml
Normal file
@@ -0,0 +1,26 @@
|
||||
version: "3.7"
|
||||
|
||||
services:
|
||||
datax-web:
|
||||
image: harbor.colben.cn/general/datax-web
|
||||
container_name: datax-web
|
||||
command: /opt/ccmd
|
||||
restart: on-failure
|
||||
privileged: true
|
||||
stop_grace_period: 1m
|
||||
network_mode: "host"
|
||||
ports:
|
||||
- "9527:9527"
|
||||
environment:
|
||||
_CONF_DB_HOST: 10.0.4.115
|
||||
_CONF_DB_PORT: 3336
|
||||
_CONF_DB_USERNAME: admin
|
||||
_CONF_DB_PASSWORD: 123456
|
||||
_CONF_DB_DATABASE: datax_web
|
||||
volumes:
|
||||
- type: bind
|
||||
source: ./data-admin.console.out
|
||||
target: /opt/datax-web-2.1.2/modules/datax-admin/bin/console.out
|
||||
- type: bind
|
||||
source: ./executor-console.out
|
||||
target: /opt/datax-web-2.1.2/modules/datax-datax-executor/bin/console.out
|
Reference in New Issue
Block a user