Merge pull request #30446 from taosdata/enh/add_ts_server
enh: add Dockerfile for TDgpt and modify dockerbuild.sh for cloud-tdgpt
This commit is contained in:
commit
2782c64a22
|
@ -0,0 +1,26 @@
|
||||||
|
FROM tdgpt_env:1.0
|
||||||
|
WORKDIR /root
|
||||||
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
ARG pkgFile
|
||||||
|
ARG dirName
|
||||||
|
ARG modelDlUrl
|
||||||
|
|
||||||
|
# for timer-moe
|
||||||
|
# ADD ${modelDlUrl}/timer-moe.tar.gz /root/
|
||||||
|
# RUN tar -xzf timer-moe.tar.gz && rm -rf timer-moe.tar.gz
|
||||||
|
|
||||||
|
ADD ${pkgFile} \
|
||||||
|
${modelDlUrl}/taos.pth \
|
||||||
|
${modelDlUrl}/taos_ts_server.py \
|
||||||
|
${modelDlUrl}/fc_australia.sql \
|
||||||
|
/root/
|
||||||
|
|
||||||
|
RUN cd ${dirName}/ && \
|
||||||
|
/bin/bash install.sh -e no && \
|
||||||
|
cd .. && \
|
||||||
|
rm -rf ${dirName}
|
||||||
|
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
|
||||||
|
RUN chmod +x /usr/local/bin/entrypoint.sh /root/taos_ts_server.py
|
||||||
|
EXPOSE 6090 8387 5000
|
||||||
|
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
|
||||||
|
|
|
@ -9,9 +9,22 @@ RUN apt-get -o Acquire::Check-Valid-Until=false -o Acquire::Check-Date=false upd
|
||||||
rm -rf /var/lib/apt/lists/* && \
|
rm -rf /var/lib/apt/lists/* && \
|
||||||
python3.10 -m venv /var/lib/taos/taosanode/venv && \
|
python3.10 -m venv /var/lib/taos/taosanode/venv && \
|
||||||
pip install --upgrade pip && \
|
pip install --upgrade pip && \
|
||||||
pip install --ignore-installed blinker && \
|
pip install --no-cache-dir --ignore-installed blinker && \
|
||||||
pip install numpy==1.26.4 pandas==1.5.0 scikit-learn outlier_utils statsmodels pyculiarity pmdarima flask matplotlib uwsgi -i https://pypi.tuna.tsinghua.edu.cn/simple && \
|
pip install --no-cache-dir torch --index-url https://download.pytorch.org/whl/cpu && \
|
||||||
pip install torch --index-url https://download.pytorch.org/whl/cpu && \
|
pip install --no-cache-dir \
|
||||||
|
numpy==1.26.4 \
|
||||||
|
pandas==1.5.0 \
|
||||||
|
scikit-learn \
|
||||||
|
outlier_utils \
|
||||||
|
statsmodels \
|
||||||
|
pyculiarity \
|
||||||
|
pmdarima \
|
||||||
|
flask \
|
||||||
|
matplotlib \
|
||||||
|
uwsgi \
|
||||||
|
transformers==4.40.0 \
|
||||||
|
accelerate \
|
||||||
|
-i https://pypi.tuna.tsinghua.edu.cn/simple && \
|
||||||
pip install --upgrade keras -i https://pypi.tuna.tsinghua.edu.cn/simple
|
pip install --upgrade keras -i https://pypi.tuna.tsinghua.edu.cn/simple
|
||||||
|
|
||||||
FROM python:3.10-slim
|
FROM python:3.10-slim
|
|
@ -17,11 +17,13 @@ cpuTypeAlias=""
|
||||||
version=""
|
version=""
|
||||||
passWord=""
|
passWord=""
|
||||||
pkgFile=""
|
pkgFile=""
|
||||||
|
tdgptPkgFile=""
|
||||||
verType="stable"
|
verType="stable"
|
||||||
dockerLatest="n"
|
dockerLatest="n"
|
||||||
cloudBuild="n"
|
cloudBuild="n"
|
||||||
|
modelDlUrl=""
|
||||||
|
|
||||||
while getopts "hc:n:p:f:V:a:b:d:" arg
|
while getopts "hc:n:p:f:V:g:u:a:b:d:" arg
|
||||||
do
|
do
|
||||||
case $arg in
|
case $arg in
|
||||||
c)
|
c)
|
||||||
|
@ -48,6 +50,14 @@ do
|
||||||
#echo "verType=$OPTARG"
|
#echo "verType=$OPTARG"
|
||||||
verType=$(echo $OPTARG)
|
verType=$(echo $OPTARG)
|
||||||
;;
|
;;
|
||||||
|
g)
|
||||||
|
#echo "tdgptPkgFile=$OPTARG"
|
||||||
|
tdgptPkgFile=$(echo $OPTARG)
|
||||||
|
;;
|
||||||
|
u)
|
||||||
|
#echo "modelDlUrl=$OPTARG"
|
||||||
|
modelDlUrl=$(echo $OPTARG)
|
||||||
|
;;
|
||||||
d)
|
d)
|
||||||
#echo "cloudBuild=$OPTARG"
|
#echo "cloudBuild=$OPTARG"
|
||||||
cloudBuild=$(echo $OPTARG)
|
cloudBuild=$(echo $OPTARG)
|
||||||
|
@ -61,6 +71,8 @@ do
|
||||||
echo " -n [version number] "
|
echo " -n [version number] "
|
||||||
echo " -p [password for docker hub] "
|
echo " -p [password for docker hub] "
|
||||||
echo " -V [stable | beta] "
|
echo " -V [stable | beta] "
|
||||||
|
echo " -g [pkg name for tdgpt] "
|
||||||
|
echo " -u [model download url] "
|
||||||
echo " -f [pkg file] "
|
echo " -f [pkg file] "
|
||||||
echo " -a [y | n ] "
|
echo " -a [y | n ] "
|
||||||
echo " -d [cloud build ] "
|
echo " -d [cloud build ] "
|
||||||
|
@ -82,9 +94,15 @@ done
|
||||||
if [ "$verType" == "beta" ]; then
|
if [ "$verType" == "beta" ]; then
|
||||||
dockername=${cpuType}-${verType}
|
dockername=${cpuType}-${verType}
|
||||||
dirName=${pkgFile%-beta*}
|
dirName=${pkgFile%-beta*}
|
||||||
|
if [ -n "$tdgptPkgFile" ];then
|
||||||
|
tdgptDirName=${tdgptPkgFile%-beta*}
|
||||||
|
fi
|
||||||
elif [ "$verType" == "stable" ]; then
|
elif [ "$verType" == "stable" ]; then
|
||||||
dockername=${cpuType}
|
dockername=${cpuType}
|
||||||
dirName=${pkgFile%-Linux*}
|
dirName=${pkgFile%-Linux*}
|
||||||
|
if [ -n "$tdgptPkgFile" ];then
|
||||||
|
tdgptDirName=${tdgptPkgFile%-Linux*}
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
echo "unknow verType, nor stabel or beta"
|
echo "unknow verType, nor stabel or beta"
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -103,7 +121,11 @@ communityDir=${scriptDir}/../../../community
|
||||||
DockerfilePath=${communityDir}/packaging/docker/
|
DockerfilePath=${communityDir}/packaging/docker/
|
||||||
if [ "$cloudBuild" == "y" ]; then
|
if [ "$cloudBuild" == "y" ]; then
|
||||||
communityArchiveDir=/nas/TDengine/v$version/cloud
|
communityArchiveDir=/nas/TDengine/v$version/cloud
|
||||||
|
if [ -n "$tdgptPkgFile" ];then
|
||||||
|
Dockerfile=${communityDir}/packaging/docker/DockerfileCloudTDgpt
|
||||||
|
else
|
||||||
Dockerfile=${communityDir}/packaging/docker/DockerfileCloud
|
Dockerfile=${communityDir}/packaging/docker/DockerfileCloud
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
communityArchiveDir=/nas/TDengine/v$version/community
|
communityArchiveDir=/nas/TDengine/v$version/community
|
||||||
Dockerfile=${communityDir}/packaging/docker/Dockerfile
|
Dockerfile=${communityDir}/packaging/docker/Dockerfile
|
||||||
|
@ -125,6 +147,15 @@ else
|
||||||
fi
|
fi
|
||||||
# check the tdengine cloud base image existed or not
|
# check the tdengine cloud base image existed or not
|
||||||
if [ "$cloudBuild" == "y" ]; then
|
if [ "$cloudBuild" == "y" ]; then
|
||||||
|
if [ -n "$tdgptPkgFile" ];then
|
||||||
|
CloudBase=$(docker images | grep tdengine/tdengine-cloud-tdgpt-base ||:)
|
||||||
|
if [[ "$CloudBase" == "" ]]; then
|
||||||
|
echo "Rebuild tdengine cloud tdgpt base image..."
|
||||||
|
docker build --rm -f "${communityDir}/packaging/docker/DockerfileCloudTDgpt.base" -t tdengine/tdengine-cloud-tdgpt-base "." --build-arg cpuType=${cpuTypeAlias}
|
||||||
|
else
|
||||||
|
echo "Already found tdengine cloud tdgpt base image"
|
||||||
|
fi
|
||||||
|
else
|
||||||
CloudBase=$(docker images | grep tdengine/tdengine-cloud-base ||:)
|
CloudBase=$(docker images | grep tdengine/tdengine-cloud-base ||:)
|
||||||
if [[ "$CloudBase" == "" ]]; then
|
if [[ "$CloudBase" == "" ]]; then
|
||||||
echo "Rebuild tdengine cloud base image..."
|
echo "Rebuild tdengine cloud base image..."
|
||||||
|
@ -132,9 +163,14 @@ if [ "$cloudBuild" == "y" ]; then
|
||||||
else
|
else
|
||||||
echo "Already found tdengine cloud base image"
|
echo "Already found tdengine cloud base image"
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
docker build --rm -f "${Dockerfile}" --network=host -t tdengine/tdengine-${dockername}:${version} "." --build-arg pkgFile=${pkgFile} --build-arg dirName=${dirName} --build-arg cpuType=${cpuTypeAlias}
|
if [ -n "$tdgptPkgFile" ];then
|
||||||
|
docker build --rm -f "${Dockerfile}" --network=host -t tdengine/tdengine-${dockername}:${version} "." --build-arg pkgFile=${pkgFile} --build-arg dirName=${dirName} --build-arg tdgptPkgFile=${tdgptPkgFile} --build-arg tdgptDirName=${tdgptDirName} --build-arg cpuType=${cpuTypeAlias} --build-arg modelDlUrl=${modelDlUrl}
|
||||||
|
else
|
||||||
|
docker build --rm -f "${Dockerfile}" --network=host -t tdengine/tdengine-${dockername}:${version} "." --build-arg pkgFile=${pkgFile} --build-arg dirName=${dirName} --build-arg cpuType=${cpuTypeAlias}
|
||||||
|
fi
|
||||||
if [ "$cloudBuild" != "y" ]; then
|
if [ "$cloudBuild" != "y" ]; then
|
||||||
docker login -u tdengine -p ${passWord} #replace the docker registry username and password
|
docker login -u tdengine -p ${passWord} #replace the docker registry username and password
|
||||||
docker push tdengine/tdengine-${dockername}:${version}
|
docker push tdengine/tdengine-${dockername}:${version}
|
||||||
|
|
|
@ -0,0 +1,46 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
export PATH="/usr/local/taos/taosanode/venv/bin:$PATH"
|
||||||
|
export LANG=en_US.UTF-8
|
||||||
|
export LC_CTYPE=en_US.UTF-8
|
||||||
|
export LC_ALL=en_US.UTF-8
|
||||||
|
|
||||||
|
CONFIG_FILE="/usr/local/taos/taosanode/cfg/taosanode.ini"
|
||||||
|
TS_SERVER_FILE="/root/taos_ts_server.py"
|
||||||
|
TIMER_POE_FILE="/root/timer-moe/timer-moe_server.py"
|
||||||
|
|
||||||
|
if [ ! -f "$CONFIG_FILE" ]; then
|
||||||
|
echo "Error: Configuration file $CONFIG_FILE not found!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
if [ -f $TS_SERVER_FILE ];then
|
||||||
|
echo "Starting tdtsfm server..."
|
||||||
|
python3 $TS_SERVER_FILE --action server &
|
||||||
|
TAOS_TS_PID=$!
|
||||||
|
|
||||||
|
if ! ps -p $TAOS_TS_PID > /dev/null; then
|
||||||
|
echo "Error: tdtsfm server failed to start!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if [ -f $TIMER_POE_FILE ];then
|
||||||
|
echo "Starting timer-moe server..."
|
||||||
|
cd $(dirname "$TIMER_POE_FILE")
|
||||||
|
python3 $TIMER_POE_FILE --action server &
|
||||||
|
TIMER_MOE_PID=$!
|
||||||
|
|
||||||
|
if ! ps -p $TIMER_MOE_PID > /dev/null; then
|
||||||
|
echo "Error: timer-moe server failed to start!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Starting uWSGI with config: $CONFIG_FILE"
|
||||||
|
exec /usr/local/taos/taosanode/venv/bin/uwsgi --ini "$CONFIG_FILE"
|
||||||
|
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo "uWSGI failed to start. Exiting..."
|
||||||
|
exit 1
|
||||||
|
fi
|
|
@ -1 +0,0 @@
|
||||||
docker build -t "tdgpt_env:1.0" .
|
|
|
@ -1,11 +0,0 @@
|
||||||
FROM tdgpt_env:1.0
|
|
||||||
WORKDIR /apps
|
|
||||||
ENV DEBIAN_FRONTEND=noninteractive
|
|
||||||
ARG pkgFile
|
|
||||||
ARG dirName
|
|
||||||
ADD ${pkgFile} /apps
|
|
||||||
RUN cd ${dirName}/ && /bin/bash install.sh -e no && cd .. && rm -rf ${dirName}
|
|
||||||
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
|
|
||||||
RUN chmod +x /usr/local/bin/entrypoint.sh
|
|
||||||
EXPOSE 6090 8387
|
|
||||||
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
|
|
|
@ -1 +0,0 @@
|
||||||
docker build --build-arg pkgFile=TDengine-anode-3.3.6.0-Linux-x64.tar.gz --build-arg dirName=TDengine-anode-3.3.6.0 -t "tdgpt-ce:3.3.6.0" .
|
|
|
@ -1,20 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
export PATH="/usr/local/taos/taosanode/venv/bin:$PATH"
|
|
||||||
export LANG=en_US.UTF-8
|
|
||||||
export LC_CTYPE=en_US.UTF-8
|
|
||||||
export LC_ALL=en_US.UTF-8
|
|
||||||
|
|
||||||
CONFIG_FILE="/usr/local/taos/taosanode/cfg/taosanode.ini"
|
|
||||||
if [ ! -f "$CONFIG_FILE" ]; then
|
|
||||||
echo "Error: Configuration file $CONFIG_FILE not found!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Starting uWSGI with config: $CONFIG_FILE"
|
|
||||||
exec /usr/local/taos/taosanode/venv/bin/uwsgi --ini "$CONFIG_FILE"
|
|
||||||
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
echo "uWSGI failed to start. Exiting..."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
Loading…
Reference in New Issue