提交 309bbd65 编写于 作者: P Ping Xiao

[TD-2846]<test>: imporve docker cluster scripts

上级 4e2e7596
...@@ -9,6 +9,7 @@ WORKDIR /root ...@@ -9,6 +9,7 @@ WORKDIR /root
COPY ${PACKAGE} . COPY ${PACKAGE} .
RUN tar -zxf ${PACKAGE} RUN tar -zxf ${PACKAGE}
RUN tar -zxf ${TARBITRATORPKG}
RUN mv ${EXTRACTDIR}/driver ./lib RUN mv ${EXTRACTDIR}/driver ./lib
RUN tar -zxf ${EXTRACTDIR}/${CONTENT} RUN tar -zxf ${EXTRACTDIR}/${CONTENT}
...@@ -19,8 +20,18 @@ WORKDIR /root ...@@ -19,8 +20,18 @@ WORKDIR /root
RUN apt-get update RUN apt-get update
RUN apt-get install -y vim tmux net-tools RUN apt-get install -y vim tmux net-tools
RUN echo 'alias ll="ls -l --color=auto"' >> /root/.bashrc RUN echo 'alias ll="ls -l --color=auto"' >> /root/.bashrc
RUN echo 'node1 172.27.0.7' >> /etc/hosts
RUN echo 'node2 172.27.0.8' >> /etc/hosts
RUN echo 'node3 172.27.0.9' >> /etc/hosts
RUN echo 'node4 172.27.0.10' >> /etc/hosts
RUN echo 'node5 172.27.0.11' >> /etc/hosts
RUN ulimit -c unlimited
RUN mkdir /coredump
RUN echo 'kernel.core_pattern=/coredump/core_%e_%p' >> /etc/sysctl.conf
RUN sysctl -p
COPY --from=builder /root/bin/taosd /usr/bin COPY --from=builder /root/bin/taosd /usr/bin
COPY --from=builder /root/bin/tarbitrator /usr/bin
COPY --from=builder /root/bin/taos /usr/bin COPY --from=builder /root/bin/taos /usr/bin
COPY --from=builder /root/cfg/taos.cfg /etc/taos/ COPY --from=builder /root/cfg/taos.cfg /etc/taos/
COPY --from=builder /root/lib/libtaos.so.* /usr/lib/libtaos.so.1 COPY --from=builder /root/lib/libtaos.so.* /usr/lib/libtaos.so.1
...@@ -29,7 +40,7 @@ ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/lib" ...@@ -29,7 +40,7 @@ ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/lib"
ENV LC_CTYPE=en_US.UTF-8 ENV LC_CTYPE=en_US.UTF-8
ENV LANG=en_US.UTF-8 ENV LANG=en_US.UTF-8
EXPOSE 6030-6041/tcp 6060/tcp 6030-6039/udp EXPOSE 6030-6042/tcp 6060/tcp 6030-6039/udp
# VOLUME [ "/var/lib/taos", "/var/log/taos", "/etc/taos" ] # VOLUME [ "/var/lib/taos", "/var/log/taos", "/etc/taos" ]
......
...@@ -34,6 +34,7 @@ function createDIR { ...@@ -34,6 +34,7 @@ function createDIR {
mkdir -p /data/node$i/data mkdir -p /data/node$i/data
mkdir -p /data/node$i/log mkdir -p /data/node$i/log
mkdir -p /data/node$i/cfg mkdir -p /data/node$i/cfg
mkdir -p /data/node$i/core
done done
} }
...@@ -54,16 +55,25 @@ function prepareBuild { ...@@ -54,16 +55,25 @@ function prepareBuild {
rm -rf $CURR_DIR/../../../../release/* rm -rf $CURR_DIR/../../../../release/*
fi 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 if [ ! -e $DOCKER_DIR/TDengine-server-$VERSION-Linux-x64.tar.gz && ! -e TDengine-arbitrator-$VERSION-Linux-x64.tar.gz ]; then
echo "no TDengine install package found" cd $CURR_DIR/../../../../packaging
exit 1 ./release.sh -v edge -n $VERSION >> /dev/null
fi
if [ ! -e $CURR_DIR/../../../../release/TDengine-server-$VERSION-Linux-x64.tar.gz ]; then
echo "no TDengine install package found"
exit 1
fi
cd $CURR_DIR/../../../../release if [ ! -e $CURR_DIR/../../../../release/TDengine-arbitrator-$VERSION-Linux-x64.tar.gz ]; then
mv TDengine-server-$VERSION-Linux-x64.tar.gz $DOCKER_DIR echo "no arbitrator install package found"
exit 1
fi
cd $CURR_DIR/../../../../release
mv TDengine-server-$VERSION-Linux-x64.tar.gz $DOCKER_DIR
mv TDengine-arbitrator-$VERSION-Linux-x64.tar.gz $DOCKER_DIR
fi
rm -rf $DOCKER_DIR/*.yml rm -rf $DOCKER_DIR/*.yml
cd $CURR_DIR cd $CURR_DIR
......
version: '3.7' version: '3.7'
services: services:
td2.0-node1: td2.0-node1:
build: build:
context: . context: .
args: args:
- PACKAGE=${PACKAGE} - PACKAGE=${PACKAGE}
- TARBITRATORPKG=${TARBITRATORPKG}
- EXTRACTDIR=${DIR} - EXTRACTDIR=${DIR}
image: 'tdengine:${VERSION}' image: 'tdengine:${VERSION}'
container_name: 'td2.0-node1' container_name: 'tdnode1'
cap_add: cap_add:
- ALL - ALL
stdin_open: true stdin_open: true
...@@ -32,14 +33,18 @@ services: ...@@ -32,14 +33,18 @@ services:
- type: bind - type: bind
source: /data/node1/cfg source: /data/node1/cfg
target: /etc/taos target: /etc/taos
# bind core dump path
- type: bind
source: /data/node2/core
target: /coredump
- type: bind - type: bind
source: /data source: /data
target: /root target: /root
hostname: node1 hostname: tdnode1
networks: networks:
taos_update_net: taos_update_net:
ipv4_address: 172.27.0.7 ipv4_address: 172.27.0.7
command: taosd command: taosd && tarbitrator
td2.0-node2: td2.0-node2:
build: build:
...@@ -48,7 +53,7 @@ services: ...@@ -48,7 +53,7 @@ services:
- PACKAGE=${PACKAGE} - PACKAGE=${PACKAGE}
- EXTRACTDIR=${DIR} - EXTRACTDIR=${DIR}
image: 'tdengine:${VERSION}' image: 'tdengine:${VERSION}'
container_name: 'td2.0-node2' container_name: 'tdnode2'
cap_add: cap_add:
- ALL - ALL
stdin_open: true stdin_open: true
...@@ -72,9 +77,15 @@ services: ...@@ -72,9 +77,15 @@ services:
- type: bind - type: bind
source: /data/node2/cfg source: /data/node2/cfg
target: /etc/taos target: /etc/taos
# bind configuration
- type: bind
source: /data/node2/core
target: /coredump
# bind core dump path
- type: bind - type: bind
source: /data source: /data
target: /root target: /root
hostname: tdnode2
networks: networks:
taos_update_net: taos_update_net:
ipv4_address: 172.27.0.8 ipv4_address: 172.27.0.8
...@@ -87,7 +98,7 @@ services: ...@@ -87,7 +98,7 @@ services:
- PACKAGE=${PACKAGE} - PACKAGE=${PACKAGE}
- EXTRACTDIR=${DIR} - EXTRACTDIR=${DIR}
image: 'tdengine:${VERSION}' image: 'tdengine:${VERSION}'
container_name: 'td2.0-node3' container_name: 'tdnode3'
cap_add: cap_add:
- ALL - ALL
stdin_open: true stdin_open: true
...@@ -96,7 +107,7 @@ services: ...@@ -96,7 +107,7 @@ services:
TZ: "Asia/Shanghai" TZ: "Asia/Shanghai"
command: > command: >
sh -c "ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && sh -c "ln -snf /usr/share/zoneinfo/$TZ /etc/localtime &&
echo $TZ > /etc/timezone && echo $TZ > /etc/timezone &&
exec my-main-application" exec my-main-application"
volumes: volumes:
# bind data directory # bind data directory
...@@ -111,9 +122,11 @@ services: ...@@ -111,9 +122,11 @@ services:
- type: bind - type: bind
source: /data/node3/cfg source: /data/node3/cfg
target: /etc/taos target: /etc/taos
# bind core dump path
- type: bind - type: bind
source: /data source: /data
target: /root target: /root
hostname: tdnode3
networks: networks:
taos_update_net: taos_update_net:
ipv4_address: 172.27.0.9 ipv4_address: 172.27.0.9
......
...@@ -8,7 +8,7 @@ services: ...@@ -8,7 +8,7 @@ services:
- PACKAGE=${PACKAGE} - PACKAGE=${PACKAGE}
- EXTRACTDIR=${DIR} - EXTRACTDIR=${DIR}
image: 'tdengine:2.0.13.1' image: 'tdengine:2.0.13.1'
container_name: 'td2.0-node4' container_name: 'tdnode4'
cap_add: cap_add:
- ALL - ALL
stdin_open: true stdin_open: true
...@@ -17,7 +17,7 @@ services: ...@@ -17,7 +17,7 @@ services:
TZ: "Asia/Shanghai" TZ: "Asia/Shanghai"
command: > command: >
sh -c "ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && sh -c "ln -snf /usr/share/zoneinfo/$TZ /etc/localtime &&
echo $TZ > /etc/timezone && echo $TZ > /etc/timezone &&
exec my-main-application" exec my-main-application"
volumes: volumes:
# bind data directory # bind data directory
...@@ -32,9 +32,14 @@ services: ...@@ -32,9 +32,14 @@ services:
- type: bind - type: bind
source: /data/node4/cfg source: /data/node4/cfg
target: /etc/taos target: /etc/taos
# bind core dump path
- type: bind
source: /data/node2/core
target: /coredump
- type: bind - type: bind
source: /data source: /data
target: /root target: /root
hostname: tdnode4
networks: networks:
taos_update_net: taos_update_net:
ipv4_address: 172.27.0.10 ipv4_address: 172.27.0.10
......
...@@ -8,7 +8,7 @@ services: ...@@ -8,7 +8,7 @@ services:
- PACKAGE=${PACKAGE} - PACKAGE=${PACKAGE}
- EXTRACTDIR=${DIR} - EXTRACTDIR=${DIR}
image: 'tdengine:2.0.13.1' image: 'tdengine:2.0.13.1'
container_name: 'td2.0-node5' container_name: 'tdnode5'
cap_add: cap_add:
- ALL - ALL
stdin_open: true stdin_open: true
...@@ -32,9 +32,18 @@ services: ...@@ -32,9 +32,18 @@ services:
- type: bind - type: bind
source: /data/node5/cfg source: /data/node5/cfg
target: /etc/taos target: /etc/taos
# bind core dump path
- type: bind
source: /data/node2/core
target: /coredump
# bind core dump path
- type: bind
source: /data/node2/core
target: /coredump
- type: bind - type: bind
source: /data source: /data
target: /root target: /root
hostname: tdnode5
networks: networks:
taos_update_net: taos_update_net:
ipv4_address: 172.27.0.11 ipv4_address: 172.27.0.11
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册