[TD-2451]<test>: add test case
This commit is contained in:
parent
abf394ae8d
commit
dd1347da09
|
@ -0,0 +1,36 @@
|
||||||
|
FROM ubuntu:latest AS builder
|
||||||
|
|
||||||
|
ARG PACKAGE=TDengine-server-1.6.5.10-Linux-x64.tar.gz
|
||||||
|
ARG EXTRACTDIR=TDengine-enterprise-server
|
||||||
|
ARG CONTENT=taos.tar.gz
|
||||||
|
|
||||||
|
WORKDIR /root
|
||||||
|
|
||||||
|
COPY ${PACKAGE} .
|
||||||
|
|
||||||
|
RUN tar -zxf ${PACKAGE}
|
||||||
|
RUN mv ${EXTRACTDIR}/driver ./lib
|
||||||
|
RUN tar -zxf ${EXTRACTDIR}/${CONTENT}
|
||||||
|
|
||||||
|
FROM ubuntu:latest
|
||||||
|
|
||||||
|
WORKDIR /root
|
||||||
|
|
||||||
|
RUN apt-get update
|
||||||
|
RUN apt-get install -y vim tmux net-tools
|
||||||
|
RUN echo 'alias ll="ls -l --color=auto"' >> /root/.bashrc
|
||||||
|
|
||||||
|
COPY --from=builder /root/bin/taosd /usr/bin
|
||||||
|
COPY --from=builder /root/bin/taos /usr/bin
|
||||||
|
COPY --from=builder /root/cfg/taos.cfg /etc/taos/
|
||||||
|
COPY --from=builder /root/lib/libtaos.so.* /usr/lib/libtaos.so.1
|
||||||
|
|
||||||
|
ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/lib"
|
||||||
|
ENV LC_CTYPE=en_US.UTF-8
|
||||||
|
ENV LANG=en_US.UTF-8
|
||||||
|
|
||||||
|
EXPOSE 6030-6041/tcp 6060/tcp 6030-6039/udp
|
||||||
|
|
||||||
|
# VOLUME [ "/var/lib/taos", "/var/log/taos", "/etc/taos" ]
|
||||||
|
|
||||||
|
CMD [ "bash" ]
|
|
@ -0,0 +1,102 @@
|
||||||
|
#!/bin/bash
|
||||||
|
echo "Executing buildClusterEnv.sh"
|
||||||
|
DOCKER_DIR=/data
|
||||||
|
CURR_DIR=`pwd`
|
||||||
|
|
||||||
|
if [ $# != 4 ]; then
|
||||||
|
echo "argument list need input : "
|
||||||
|
echo " -n numOfNodes"
|
||||||
|
echo " -v version"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
NUM_OF_NODES=
|
||||||
|
VERSION=
|
||||||
|
while getopts "n:v:" arg
|
||||||
|
do
|
||||||
|
case $arg in
|
||||||
|
n)
|
||||||
|
NUM_OF_NODES=$OPTARG
|
||||||
|
;;
|
||||||
|
v)
|
||||||
|
VERSION=$OPTARG
|
||||||
|
;;
|
||||||
|
?)
|
||||||
|
echo "unkonwn argument"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
|
function createDIR {
|
||||||
|
for i in {1.. $2}
|
||||||
|
do
|
||||||
|
mkdir -p /data/node$i/data
|
||||||
|
mkdir -p /data/node$i/log
|
||||||
|
mkdir -p /data/node$i/cfg
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
function cleanEnv {
|
||||||
|
for i in {1..3}
|
||||||
|
do
|
||||||
|
echo /data/node$i/data/*
|
||||||
|
rm -rf /data/node$i/data/*
|
||||||
|
echo /data/node$i/log/*
|
||||||
|
rm -rf /data/node$i/log/*
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
function prepareBuild {
|
||||||
|
|
||||||
|
if [ -d $CURR_DIR/../../../../release ]; then
|
||||||
|
echo release exists
|
||||||
|
rm -rf $CURR_DIR/../../../../release/*
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd $CURR_DIR/../../../../packaging
|
||||||
|
./release.sh -v edge -n $VERSION >> /dev/null
|
||||||
|
|
||||||
|
if [ ! -f $CURR_DIR/../../../../release/TDengine-server-$VERSION-Linux-x64.tar.gz ]; then
|
||||||
|
echo "no TDengine install package found"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd $CURR_DIR/../../../../release
|
||||||
|
mv TDengine-server-$VERSION-Linux-x64.tar.gz $DOCKER_DIR
|
||||||
|
|
||||||
|
rm -rf $DOCKER_DIR/*.yml
|
||||||
|
cd $CURR_DIR
|
||||||
|
|
||||||
|
cp docker-compose.yml $DOCKER_DIR
|
||||||
|
cp Dockerfile $DOCKER_DIR
|
||||||
|
|
||||||
|
if [ $NUM_OF_NODES -eq 4 ]; then
|
||||||
|
cp ../node4.yml $DOCKER_DIR
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $NUM_OF_NODES -eq 5 ]; then
|
||||||
|
cp ../node5.yml $DOCKER_DIR
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function clusterUp {
|
||||||
|
|
||||||
|
cd $DOCKER_DIR
|
||||||
|
|
||||||
|
if [ $NUM_OF_NODES -eq 3 ]; then
|
||||||
|
PACKAGE=TDengine-server-$VERSION-Linux-x64.tar.gz DIR=TDengine-server-$VERSION docker-compose up -d
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $NUM_OF_NODES -eq 4 ]; then
|
||||||
|
PACKAGE=TDengine-server-$VERSION-Linux-x64.tar.gz DIR=TDengine-server-$VERSION docker-compose -f docker-compose.yml -f node4.yml up -d
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $NUM_OF_NODES -eq 5 ]; then
|
||||||
|
PACKAGE=TDengine-server-$VERSION-Linux-x64.tar.gz DIR=TDengine-server-$VERSION docker-compose -f docker-compose.yml -f node4.yml -f node5.yml up -d
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
cleanEnv
|
||||||
|
# prepareBuild
|
||||||
|
# clusterUp
|
|
@ -0,0 +1,127 @@
|
||||||
|
version: '3.7'
|
||||||
|
|
||||||
|
services:
|
||||||
|
td2.0-node1:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
args:
|
||||||
|
- PACKAGE=${PACKAGE}
|
||||||
|
- EXTRACTDIR=${DIR}
|
||||||
|
image: 'tdengine:2.0.13.1'
|
||||||
|
container_name: 'td2.0-node1'
|
||||||
|
cap_add:
|
||||||
|
- ALL
|
||||||
|
stdin_open: true
|
||||||
|
tty: true
|
||||||
|
environment:
|
||||||
|
TZ: "Asia/Shanghai"
|
||||||
|
command: >
|
||||||
|
sh -c "ln -snf /usr/share/zoneinfo/$TZ /etc/localtime &&
|
||||||
|
echo $TZ > /etc/timezone &&
|
||||||
|
exec my-main-application"
|
||||||
|
volumes:
|
||||||
|
# bind data directory
|
||||||
|
- type: bind
|
||||||
|
source: /data/node1/data
|
||||||
|
target: /var/lib/taos
|
||||||
|
# bind log directory
|
||||||
|
- type: bind
|
||||||
|
source: /data/node1/log
|
||||||
|
target: /var/log/taos
|
||||||
|
# bind configuration
|
||||||
|
- type: bind
|
||||||
|
source: /data/node1/cfg
|
||||||
|
target: /etc/taos
|
||||||
|
- type: bind
|
||||||
|
source: /data
|
||||||
|
target: /root
|
||||||
|
networks:
|
||||||
|
taos_update_net:
|
||||||
|
ipv4_address: 172.27.0.7
|
||||||
|
command: taosd
|
||||||
|
|
||||||
|
td2.0-node2:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
args:
|
||||||
|
- PACKAGE=${PACKAGE}
|
||||||
|
- EXTRACTDIR=${DIR}
|
||||||
|
image: 'tdengine:2.0.13.1'
|
||||||
|
container_name: 'td2.0-node2'
|
||||||
|
cap_add:
|
||||||
|
- ALL
|
||||||
|
stdin_open: true
|
||||||
|
tty: true
|
||||||
|
environment:
|
||||||
|
TZ: "Asia/Shanghai"
|
||||||
|
command: >
|
||||||
|
sh -c "ln -snf /usr/share/zoneinfo/$TZ /etc/localtime &&
|
||||||
|
echo $TZ > /etc/timezone &&
|
||||||
|
exec my-main-application"
|
||||||
|
volumes:
|
||||||
|
# bind data directory
|
||||||
|
- type: bind
|
||||||
|
source: /data/node2/data
|
||||||
|
target: /var/lib/taos
|
||||||
|
# bind log directory
|
||||||
|
- type: bind
|
||||||
|
source: /data/node2/log
|
||||||
|
target: /var/log/taos
|
||||||
|
# bind configuration
|
||||||
|
- type: bind
|
||||||
|
source: /data/node2/cfg
|
||||||
|
target: /etc/taos
|
||||||
|
- type: bind
|
||||||
|
source: /data
|
||||||
|
target: /root
|
||||||
|
networks:
|
||||||
|
taos_update_net:
|
||||||
|
ipv4_address: 172.27.0.8
|
||||||
|
command: taosd
|
||||||
|
|
||||||
|
td2.0-node3:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
args:
|
||||||
|
- PACKAGE=${PACKAGE}
|
||||||
|
- EXTRACTDIR=${DIR}
|
||||||
|
image: 'tdengine:2.0.13.1'
|
||||||
|
container_name: 'td2.0-node3'
|
||||||
|
cap_add:
|
||||||
|
- ALL
|
||||||
|
stdin_open: true
|
||||||
|
tty: true
|
||||||
|
environment:
|
||||||
|
TZ: "Asia/Shanghai"
|
||||||
|
command: >
|
||||||
|
sh -c "ln -snf /usr/share/zoneinfo/$TZ /etc/localtime &&
|
||||||
|
echo $TZ > /etc/timezone &&
|
||||||
|
exec my-main-application"
|
||||||
|
volumes:
|
||||||
|
# bind data directory
|
||||||
|
- type: bind
|
||||||
|
source: /data/node3/data
|
||||||
|
target: /var/lib/taos
|
||||||
|
# bind log directory
|
||||||
|
- type: bind
|
||||||
|
source: /data/node3/log
|
||||||
|
target: /var/log/taos
|
||||||
|
# bind configuration
|
||||||
|
- type: bind
|
||||||
|
source: /data/node3/cfg
|
||||||
|
target: /etc/taos
|
||||||
|
- type: bind
|
||||||
|
source: /data
|
||||||
|
target: /root
|
||||||
|
networks:
|
||||||
|
taos_update_net:
|
||||||
|
ipv4_address: 172.27.0.9
|
||||||
|
command: taosd
|
||||||
|
|
||||||
|
networks:
|
||||||
|
taos_update_net:
|
||||||
|
# external: true
|
||||||
|
ipam:
|
||||||
|
driver: default
|
||||||
|
config:
|
||||||
|
- subnet: "172.27.0.0/24"
|
|
@ -0,0 +1,41 @@
|
||||||
|
version: '3.7'
|
||||||
|
|
||||||
|
services:
|
||||||
|
td2.0-node4:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
args:
|
||||||
|
- PACKAGE=${PACKAGE}
|
||||||
|
- EXTRACTDIR=${DIR}
|
||||||
|
image: 'tdengine:2.0.13.1'
|
||||||
|
container_name: 'td2.0-node4'
|
||||||
|
cap_add:
|
||||||
|
- ALL
|
||||||
|
stdin_open: true
|
||||||
|
tty: true
|
||||||
|
environment:
|
||||||
|
TZ: "Asia/Shanghai"
|
||||||
|
command: >
|
||||||
|
sh -c "ln -snf /usr/share/zoneinfo/$TZ /etc/localtime &&
|
||||||
|
echo $TZ > /etc/timezone &&
|
||||||
|
exec my-main-application"
|
||||||
|
volumes:
|
||||||
|
# bind data directory
|
||||||
|
- type: bind
|
||||||
|
source: /data/node4/data
|
||||||
|
target: /var/lib/taos
|
||||||
|
# bind log directory
|
||||||
|
- type: bind
|
||||||
|
source: /data/node4/log
|
||||||
|
target: /var/log/taos
|
||||||
|
# bind configuration
|
||||||
|
- type: bind
|
||||||
|
source: /data/node4/cfg
|
||||||
|
target: /etc/taos
|
||||||
|
- type: bind
|
||||||
|
source: /data
|
||||||
|
target: /root
|
||||||
|
networks:
|
||||||
|
taos_update_net:
|
||||||
|
ipv4_address: 172.27.0.10
|
||||||
|
command: taosd
|
|
@ -0,0 +1,41 @@
|
||||||
|
version: '3.7'
|
||||||
|
|
||||||
|
services:
|
||||||
|
td2.0-node5:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
args:
|
||||||
|
- PACKAGE=${PACKAGE}
|
||||||
|
- EXTRACTDIR=${DIR}
|
||||||
|
image: 'tdengine:2.0.13.1'
|
||||||
|
container_name: 'td2.0-node5'
|
||||||
|
cap_add:
|
||||||
|
- ALL
|
||||||
|
stdin_open: true
|
||||||
|
tty: true
|
||||||
|
environment:
|
||||||
|
TZ: "Asia/Shanghai"
|
||||||
|
command: >
|
||||||
|
sh -c "ln -snf /usr/share/zoneinfo/$TZ /etc/localtime &&
|
||||||
|
echo $TZ > /etc/timezone &&
|
||||||
|
exec my-main-application"
|
||||||
|
volumes:
|
||||||
|
# bind data directory
|
||||||
|
- type: bind
|
||||||
|
source: /data/node5/data
|
||||||
|
target: /var/lib/taos
|
||||||
|
# bind log directory
|
||||||
|
- type: bind
|
||||||
|
source: /data/node5/log
|
||||||
|
target: /var/log/taos
|
||||||
|
# bind configuration
|
||||||
|
- type: bind
|
||||||
|
source: /data/node5/cfg
|
||||||
|
target: /etc/taos
|
||||||
|
- type: bind
|
||||||
|
source: /data
|
||||||
|
target: /root
|
||||||
|
networks:
|
||||||
|
taos_update_net:
|
||||||
|
ipv4_address: 172.27.0.11
|
||||||
|
command: taosd
|
Loading…
Reference in New Issue